MPI procedures are specified using a language-independent notation. The arguments of procedure calls are marked as IN, OUT, or INOUT. The meanings of these are:
Rationale.
The definition of MPI tries to avoid, to the largest possible extent,
the use of INOUT arguments, because such use is error-prone,
especially for scalar arguments.
( End of rationale.)
MPI's use of IN, OUT, and INOUT is intended
to indicate to the user how an argument is
to be used, but
does not provide a rigorous classification that can be translated
directly into
all
language bindings (e.g., INTENT in Fortran 90 bindings
or const in C bindings). For instance, the ``constant''
MPI_BOTTOM can usually be passed to OUT buffer
arguments. Similarly, MPI_STATUS_IGNORE can be passed as the
OUT status argument.
A common occurrence for MPI functions is an argument that is used as IN by some processes and OUT by other processes. Such an argument is, syntactically, an INOUT argument and is marked as such, although, semantically, it is not used in one call both for input and for output on a single process.
Another frequent situation arises when an argument value is needed only by a subset of the processes. When an argument is not significant at a process then an arbitrary value can be passed as an argument.
Unless specified otherwise, an argument of type OUT or type
INOUT cannot be aliased with any other argument passed to an
MPI procedure. An example of argument aliasing in C appears below.
If we define a C procedure like this,
void copyIntBuffer( int *pin, int *pout, int len ) { int i; for (i=0; i<len; ++i) *pout++ = *pin++; }then a call to it in the following code fragment has aliased arguments.
int a[10]; copyIntBuffer( a, a+3, 7);Although the C language allows this, such usage of MPI procedures is forbidden unless otherwise specified. Note that Fortran prohibits aliasing of arguments.
All MPI functions are first specified in the language-independent notation. Immediately below this, language dependent bindings follow:
``Fortran'' in this document refers to Fortran 90 and higher; see Section Language Binding .