These examples show the use of the MPI_GET procedure. As all MPI RMA communication procedures are nonblocking, the associated operations must be completed by subsequent calls to synchronization procedures. In the following example, completion is accomplished with the routine MPI_WIN_FENCE, introduced in Section Synchronization Calls.
Example
We show how to implement the generic indirect assignment
A = B(map), where A,
B, and
map have the same
distribution, and map is a permutation. To simplify, we assume
a block distribution with equal size
blocks.
Example
A simpler version can be written that does not require that a
datatype be built for the target buffer. One then needs a
separate get operation for each entry,
as illustrated below. This code is much simpler, but usually much less
efficient, for large arrays.