The ADI is responsible for sending ``context ids'' as well as the message tags. Many implementations will implement the context ids as an additional integer that is sent with the message. For reasons of efficiency, the number of context ids may be smaller than can be expressed with a C int (for example, there may be a separate message queue for each context or a fixed number of bits in the message envelope). The maximum value of a context id is given by MPID_MAX_CONTEXT_ID.
When a communicator is created or freed, the ADI must be notified by calling MPID_CommInit and MPID_CommFree, respectively. These make sure that the ADI can manage any communicator-specific datastructures that it uses.
The routine MPID_CommInit is called when all other fields in the
communicator have been set, except for the attributes and contexts ids. The
routine MPID_CommFree is called before
the communicator is freed. In other words, the ADI may use any field in the
communicator as part of the initialization or freeing of a communicator.
A typical use is in the case of a heterogeneous system; the appropriate
message representation for all communication within the communicator can be
determined when the communicator is created, rather than on each operation.
Their form is
MPID_CommInit( oldcomm, newcomm )
MPID_CommFree( comm )
The communicators are, as always, of type struct MPIR_COMMUNICATOR *.