A message consists of the data and the message envelope. The envelope provides information on how to match sends to receives. In MPI_Send and MPI_Recv calls, the second set of three parameters specifies the message envelope. Again, here are the type signatures for these calls:

The relevant parameters for defining the message envelope are:

dest(ination) or source
This argument is set to a rank in a communicator (see below). Rank ranges from 0 to (size-1), where size is the number of processes in the communicator. Destination is specified by the send and is used to route the message to the appropriate process. Source is specified by the receive. Only messages coming from that source can be accepted by the receive call, but the receive can set source to MPI_ANY_SOURCE to indicate that any source is acceptable.
tag
An arbitrary number to help distinguish among messages. The tags specified by the sender and receiver must match, but the receiver can specify MPI_ANY_TAG to indicate that any tag is acceptable.
comm(unicator)
The communicator specified by the send must equal that specified by the receive. Communicators will be described in more depth later in this topic. For now, it is enough to know that a communicator defines a communication "universe", and that processes may belong to more than one communicator. In this topic, we will only be working with the predefined communicator MPI_COMM_WORLD which includes all processes in the application.
 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement