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
The message source is implicitly determined by the identity of the message sender. The other fields are specified by arguments in the send operation.
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 0,...,UB, 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 set of processes that share this communication context. This process group is ordered and processes are identified by their rank within this group. Thus, the range of valid values for dest is 0, ... , n-1, where n is the number of 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 .)
A predefined communicator MPI_COMM_WORLD is provided by MPI. It allows communication with all processes that are accessible after MPI initialization and 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 processes, and a single communication context, as offered by most existing communication libraries, need only use the predefined variable MPI_COMM_WORLD as the comm argument. This will allow communication with all the 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 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, processes may be identified by
relative ranks, or absolute ids, etc.
( End of advice to implementors.)