Point-to-point communication

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

How to do it…

In the ...

Get Python Parallel Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.