7.10.1. MPI_REDUCE_SCATTER_BLOCK

PreviousUpNext
Up: Reduce-Scatter Next: MPI_REDUCE_SCATTER Previous: Reduce-Scatter

MPI_REDUCE_SCATTER_BLOCK(sendbuf, recvbuf, recvcount, datatype, op, comm)
IN sendbufstarting address of send buffer (choice)
OUT recvbufstarting address of receive buffer (choice)
IN recvcountelement count per block (non-negative integer)
IN datatypedatatype of elements of send and receive buffers (handle)
IN opoperation (handle)
IN commcommunicator (handle)
C binding
int MPI_Reduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
int MPI_Reduce_scatter_block_c(const void *sendbuf, void *recvbuf, MPI_Count recvcount, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
Fortran 2008 binding
MPI_Reduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, comm, ierror)

TYPE(*), DIMENSION(..), INTENT(IN) :: sendbuf
TYPE(*), DIMENSION(..) :: recvbuf
INTEGER, INTENT(IN) :: recvcount
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Op), INTENT(IN) :: op
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_Reduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, comm, ierror) !(_c)

TYPE(*), DIMENSION(..), INTENT(IN) :: sendbuf
TYPE(*), DIMENSION(..) :: recvbuf
INTEGER(KIND=MPI_COUNT_KIND), INTENT(IN) :: recvcount
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Op), INTENT(IN) :: op
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_REDUCE_SCATTER_BLOCK(SENDBUF, RECVBUF, RECVCOUNT, DATATYPE, OP, COMM, IERROR)

<type> SENDBUF(*), RECVBUF(*)
INTEGER RECVCOUNT, DATATYPE, OP, COMM, IERROR

If comm is an intra-communicator, MPI_REDUCE_SCATTER_BLOCK first performs a global, element-wise reduction on vectors of count = n* recvcount elements in the send buffers defined by sendbuf, count and datatype, using the operation op, where n is the number of MPI processes in the group of comm. The routine is called by all group members using the same arguments for recvcount, datatype, op and comm. The resulting vector is treated as n consecutive blocks of recvcount elements that are scattered to the MPI processes of the group. The i-th block is sent to MPI process i and stored in the receive buffer defined by recvbuf, recvcount, and datatype.


Advice to implementors.

The MPI_REDUCE_SCATTER_BLOCK routine is functionally equivalent to an MPI_REDUCE collective operation with count equal to recvcount* n, followed by an MPI_SCATTER with sendcount equal to recvcount. However, a direct implementation may run faster. ( End of advice to implementors.)
The ``in place'' option for intra-communicators is specified by passing MPI_IN_PLACE in the sendbuf argument on all MPI processes. In this case, the input data is taken from the receive buffer.

If comm is an inter-communicator, then the result of the reduction of the data provided by MPI processes in one group (group A) is scattered among MPI processes in the other group (group B) and vice versa. Within each group, all MPI processes provide the same value for the recvcount argument, and provide input vectors of count = n* recvcount elements stored in the send buffers, where n is the size of the group. The number of elements count must be the same for the two groups. The resulting vector from the other group is scattered in blocks of recvcount elements among the MPI processes in the group.


Rationale.

The last restriction is needed so that the length of the send buffer of one group can be determined by the local recvcount argument of the other group. Otherwise, communication is needed to figure out how many elements are reduced. ( End of rationale.)


PreviousUpNext
Up: Reduce-Scatter Next: MPI_REDUCE_SCATTER Previous: Reduce-Scatter


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