7.9.2. Predefined Reduction Operations

PreviousUpNext
Up: Global Reduction Operations Next: Signed Characters and Reductions Previous: Reduce

The following predefined operations are supplied for MPI_REDUCE and related functions MPI_ALLREDUCE, MPI_REDUCE_SCATTER_BLOCK, MPI_REDUCE_SCATTER, MPI_SCAN, MPI_EXSCAN, all nonblocking variants of those (see Section Nonblocking Collective Operations), and MPI_REDUCE_LOCAL. These operations are invoked by placing the following in op.

Image file

The two operations MPI_MINLOC and MPI_MAXLOC are discussed separately in Section MINLOC and MAXLOC. For the other predefined operations, we enumerate below the allowed combinations of op and datatype arguments. First, define groups of MPI basic datatypes in the following way.

Image file

Now, the valid datatypes for each operation are specified below.

Image file

These operations together with all listed datatypes are valid in all supported programming languages, see also Reduce Operations in Section MPI Opaque Objects.

The following examples use intra-communicators.


Example A routine that computes the dot product of two vectors that are distributed across a group of MPI processes and returns the answer at node zero.

Image file


Example A routine that computes the product of a vector and an array that are distributed across a group of MPI processes and returns the answer at node zero.

Image file


PreviousUpNext
Up: Global Reduction Operations Next: Signed Characters and Reductions Previous: Reduce


Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023