Attributes can be attached to communicators, windows, and datatypes. Attributes are local to the process and specific to the communicator to which they are attached. Attributes are not propagated by MPI from one communicator to another except when the communicator is duplicated using MPI_COMM_DUP (and even then the application must give specific permission through callback functions for the attribute to be copied).
Advice to users.
Attributes in C are of type void *. Typically, such an attribute
will be a pointer to a structure that contains further information, or
a handle to an MPI object.
In Fortran, attributes are of type INTEGER. Such attribute
can be a handle to an MPI object, or just an integer-valued
attribute.
( End of advice to users.)
Advice
to implementors.
Attributes are scalar values, equal in size to, or larger than a C-language
pointer. Attributes can always hold an MPI handle.
( End of advice to implementors.)
The caching interface defined here
requires
that attributes be
stored by MPI opaquely within a communicator,
window, and datatype.
Accessor functions include the following:
Caching and callback functions are only called synchronously, in response to explicit application requests. This avoid problems that result from repeated crossings between user and system space. (This synchronous calling rule is a general property of MPI.)
The choice of key values is under control of MPI. This allows MPI to optimize its implementation of attribute sets. It also avoids conflict between independent modules caching information on the same communicators.
A much smaller interface, consisting of just a callback facility, would allow
the entire caching facility to be implemented by portable code. However, with
the minimal callback interface, some form of table searching is implied by the
need to handle arbitrary communicators. In contrast, the more complete
interface defined here permits rapid access to attributes through the use of
pointers in communicators (to find the attribute table) and cleverly chosen
key values (to retrieve individual attributes). In light of the efficiency
``hit'' inherent in the minimal interface, the more complete interface defined
here is seen to be superior.
( End of advice to implementors.)
MPI provides the following services related to caching. They are
all process local.