7.9.7. MPI Process-Local Reduction

PreviousUpNext
Up: Global Reduction Operations Next: Reduce-Scatter Previous: All-Reduce

The functions in this section are of importance to library implementors who may want to implement special reduction patterns that are otherwise not easily covered by the standard MPI operations.

The following function applies a reduction operator to local arguments.

MPI_REDUCE_LOCAL(inbuf, inoutbuf, count, datatype, op)
IN inbufinput buffer (choice)
INOUT inoutbufcombined input and output buffer (choice)
IN countnumber of elements in inbuf and inoutbuf buffers (non-negative integer)
IN datatypedatatype of elements of inbuf and inoutbuf buffers (handle)
IN opoperation (handle)
C binding
int MPI_Reduce_local(const void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op)
int MPI_Reduce_local_c(const void *inbuf, void *inoutbuf, MPI_Count count, MPI_Datatype datatype, MPI_Op op)
Fortran 2008 binding
MPI_Reduce_local(inbuf, inoutbuf, count, datatype, op, ierror)

TYPE(*), DIMENSION(..), INTENT(IN) :: inbuf
TYPE(*), DIMENSION(..) :: inoutbuf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Op), INTENT(IN) :: op
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_Reduce_local(inbuf, inoutbuf, count, datatype, op, ierror) !(_c)

TYPE(*), DIMENSION(..), INTENT(IN) :: inbuf
TYPE(*), DIMENSION(..) :: inoutbuf
INTEGER(KIND=MPI_COUNT_KIND), INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Op), INTENT(IN) :: op
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_REDUCE_LOCAL(INBUF, INOUTBUF, COUNT, DATATYPE, OP, IERROR)

<type> INBUF(*), INOUTBUF(*)
INTEGER COUNT, DATATYPE, OP, IERROR

The function applies the operation given by op element-wise to the elements of inbuf and inoutbuf with the result stored element-wise in inoutbuf, as explained for user-defined operations in Section User-Defined Reduction Operations. Both inbuf and inoutbuf (input as well as result) have the same number of elements given by count and the same datatype given by datatype. The MPI_IN_PLACE option is not allowed.

Reduction operations can be queried for their commutativity.

MPI_OP_COMMUTATIVE(op, commute)
IN opoperation (handle)
OUT commute true if op is commutative, false otherwise (logical)
C binding
int MPI_Op_commutative(MPI_Op op, int *commute)
Fortran 2008 binding
MPI_Op_commutative(op, commute, ierror)

TYPE(MPI_Op), INTENT(IN) :: op
LOGICAL, INTENT(OUT) :: commute
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_OP_COMMUTATIVE(OP, COMMUTE, IERROR)

INTEGER OP, IERROR
LOGICAL COMMUTE


PreviousUpNext
Up: Global Reduction Operations Next: Reduce-Scatter Previous: All-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