## 112. Process-Local Reduction

**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 inbuf | input buffer (choice) |

INOUT inoutbuf | combined input and output buffer (choice) |

IN count | number of elements in inbuf and inoutbuf buffers (non-negative integer) |

IN datatype | data type of elements of inbuf and inoutbuf buffers (handle) |

IN op | operation (handle) |

` int MPI_Reduce_local(const void* inbuf, void* inoutbuf, int count, MPI_Datatype datatype, MPI_Op op) `

` 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) `

<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 op | operation (handle) |

OUT commute | true if op is commutative, false otherwise (logical) |

` int MPI_Op_commutative(MPI_Op op, int *commute) `

` MPI_Op_commutative(op, commute, ierror) `

TYPE(MPI_Op), INTENT(IN) :: op

LOGICAL, INTENT(OUT) :: commute

INTEGER, OPTIONAL, INTENT(OUT) :: ierror

` MPI_OP_COMMUTATIVE(OP, COMMUTE, IERROR) `

LOGICAL COMMUTE

INTEGER OP, IERROR

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

Return to MPI-3.1 Standard Index

Return to MPI Forum Home Page

(Unofficial) MPI-3.1 of June 4, 2015

HTML Generated on June 4, 2015