MPI messages consist of two basic parts:

  1. The data being sent/received
  2. An envelope of information that helps to route the data

In message-passing calls, there are usually three parameters that describe the data being sent or received: startbuf, count, and datatype.

  • The first argument, startbuf, is the memory address where the data starts.
  • The next argument, count, is the number of elements in the data. The count on the receiving side should be greater than or equal to the count on the sending side.
  • The third argument, datatype, is the MPI datatype.

Data Parameters
Data parameters are the first three parameters in send and receive calls.
Data parameters highlighted in MPI_Send and MPI_Recv.

The next three parameters in message passing calls specify the routing information of the message, much like the outside of an envelope sent in the mail: dest or source, tag, and communicator.

  • The first envelope parameter identifies which process the communication is targeting. For send calls, this parameter is the rank of the destination process; for receive calls, this parameter is the rank of the sender. Setting this parameter to MPI_ANY_SOURCE in a receive call allows the call to access its message from any source.
  • The second envelope parameter, tag, is an arbitrary tag used by both the sender and receiver to further distinguish among messages. A receiver can specify MPI_ANY_TAG to accept messages with any tag.
  • The final envelope parameter, communicator, indicates a group of processes. The communicator specified by the send and receive calls must match. The communicator also determines how the rank parameter is interpreted; an individual process may have different ranks in different communicators.

Envelope Parameters
Envelope Parameters
Envelope parameters highlighted in MPI_Send and MPI_Recv.
 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement