HP-MPI User's Guide (11th Edition)

Introduction
MPI concepts
Chapter 1 13
All–reduce Returns the result of a reduction at all nodes.
Reduce-Scatter Combines the functionality of reduce and scatter
operations.
Scan Performs a prefix reduction on data distributed across
a group.
Section 4.9, “Global Reduction Operations” in the MPI 1.0 standard
describes each of these functions in detail.
Reduction operations are binary and are only valid on numeric data.
Reductions are always associative but may or may not be commutative.
You can select a reduction operation from a predefined list (refer to
section 4.9.2 in the MPI 1.0 standard) or define your own operation. The
operations are invoked by placing the operation name, for example
MPI_SUM or MPI_PROD, in op as described in the MPI_Reduce syntax
below.
To implement a reduction, use
MPI_Reduce(void *sendbuf, void *recvbuf, int count,
MPI_Datatype dtype, MPI_Op op, int root, MPI_Comm comm);
where
sendbuf Specifies the address of the send buffer.
recvbuf Denotes the address of the receive buffer.
count Indicates the number of elements in the send buffer.
dtype Specifies the datatype of the send and receive buffers.
op Specifies the reduction operation.
root Indicates the rank of the root process.
comm Designates the communication context that identifies a
group of processes.
For example “compute_pi.f” on page 241 uses MPI_REDUCE to sum the
elements provided in the input buffer of each process in
MPI_COMM_WORLD, using MPI_SUM, and returns the summed value in the
output buffer of the root process (in this case, process 0).