MPI provides a ``caching'' facility that allows an application to attach arbitrary pieces of information, called attributes, to three kinds of MPI objects, communicators, windows, and datatypes. More precisely, the caching facility allows a portable library to do the following:
Advice to users.
The communicator MPI_COMM_SELF is a suitable choice for posting
process-local attributes, via this
( End of advice to users.)
In one extreme
can allow caching on all opaque handles. The other
extreme is to only allow it on communicators. Caching has a cost
associated with it and should only be allowed when it is clearly needed and
the increased cost is modest.
This is the reason that windows and datatypes were
added but not other handles.
( End of rationale.)
One difficulty is the potential for size differences between Fortran integers and C pointers. For this reason, the Fortran versions of these routines use integers of kind MPI_ADDRESS_KIND.
Advice to implementors.
High-quality implementations should raise an error when a keyval
that was created by a call to MPI_ XXX_CREATE_KEYVAL is
used with an object of the wrong type with a call to
MPI_YYY_GET_ATTR, MPI_YYY_SET_ATTR, MPI_YYY_DELETE_ATTR, or
MPI_YYY_FREE_KEYVAL. To do so, it is necessary to maintain, with
each keyval, information on the type of the associated user
( End of advice to implementors.)