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 attributing-caching mechanism.
( End of advice to users.)
Rationale.
In one extreme
one
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. To overcome this problem with
attribute caching on communicators,
functions
are also given for
this case. The
functions
to cache on datatypes and windows also
address this issue. For a general discussion of the address
size problem, see Section Addresses
.
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
function.
( End of advice to implementors.)