In addition to the data part, messages carry information that can be used to
distinguish messages and selectively receive them. This information consists
of a fixed number of fields, which we collectively call
the message envelope. These fields are
source
destination
tag
communicator
The message source is implicitly determined by the identity of the
message sender. The other fields are specified by arguments in the send
procedure.
The message destination is specified by the dest argument.
The integer-valued message tag is specified by the tag argument. This integer can be used by the program to distinguish different types of messages. The range of valid tag values is , where the value of UB is implementation dependent. It can be found by querying the value of the attribute MPI_TAG_UB, as described in Chapter MPI Environmental Management. MPI requires that UB be no less than 32767.
The comm argument specifies the communicator that is used for the send operation. Communicators are explained in Chapter Groups, Contexts, Communicators, and Caching; below is a brief summary of their usage.
A communicator specifies the communication context for a communication operation. Each communication context provides a separate ``communication universe'': messages are always received within the context they were sent, and messages sent in different contexts do not interfere.
The communicator also specifies the group of MPI processes that share this communication context. This MPI process group is ordered and MPI processes are identified by their rank within this group. Thus, the range of valid values for dest is 0, ..., n-1 cup {mpiconstMPI_PROC_NULL}, where n is the number of MPI processes in the group. (If the communicator is an inter-communicator, then destinations are identified by their rank in the remote group. See Chapter Groups, Contexts, Communicators, and Caching.)
An MPI process may have a different rank in each group in which it is a member.
When using the World Model (see Section The World Model), a predefined communicator MPI_COMM_WORLD is provided by MPI. It allows communication with all MPI processes that are accessible after MPI initialization and MPI processes are identified by their rank in the group of MPI_COMM_WORLD.
Advice to users.
Users that are comfortable with the notion of a flat name space for MPI processes, and a single communication context, as offered by most existing communication libraries, need only use the World Model for MPI initialization, and the predefined variable MPI_COMM_WORLD as the comm argument. This will allow communication with all the MPI processes available at initialization time.
Users may define new communicators, as explained in Chapter Groups, Contexts, Communicators, and Caching.
Communicators provide an important encapsulation mechanism for libraries and
modules. They allow modules to have their own disjoint communication universe
and their own MPI process numbering scheme.
( End of advice to users.)
Advice
to implementors.
The message envelope
would normally be encoded by a fixed-length message header.
However, the actual encoding
is implementation dependent. Some of the information (e.g.,
source or destination) may be implicit, and need not be
explicitly carried by messages. Also, MPI processes may be identified by
relative ranks, or absolute ids, etc.
( End of advice to implementors.)