-
Book Overview & Buying
-
Table Of Contents
Python Parallel Programming Cookbook
By :
One of the most important features among those provided by MPI is the point-to-point communication, which is a mechanism that enables data transmission between two processes: a process receiver, and process sender.
The Python module mpi4py enables point-to-point communication via two functions:
Comm.Send(data, process_destination): This sends data to the destination process identified by its rank in the communicator group
Comm.Recv(process_source): This receives data from the source process, which is also identified by its rank in the communicator group
The Comm parameter, which stands for communicator, defines the group of processes, that may communicate through message passing:
comm = MPI.COMM_WORLD
In the following example, we show you how to utilize the comm.send and comm.recv directives to exchange messages between different processes:
from mpi4py import MPI
comm=MPI.COMM_WORLD
rank = comm.rank
print("my rank is : " , rank)
if rank==0:
data...
Change the font size
Change margin width
Change background colour