Scatter



next up previous contents
Next: An Example Using Up: Collective Communications Previous: Examples Using MPI_GATHERV

Scatter

  scatter

  MPI_SCATTER(sendbuf, sendcount, sendtype, recvbuf, recvcount, 
                      recvtype, root, comm)

    IN       sendbuf          address of send buffer
    IN       sendcount        number of elements send to 
                                        each process
    IN       sendtype         datatype of send buffer elements
    OUT      recvbuf          address of receive buffer
    IN       recvcount        number of elements in 
                                        receive buffer
    IN       recvtype         data type of recv buffer elements
    IN       root             rank of sending process
    IN       comm             communicator

MPI_Scatter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)

MPI_SCATTER(SENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, RECVTYPE, ROOT, COMM, IERROR) <type> SENDBUF(*), RECVBUF(*)
INTEGER SENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE, ROOT, COMM, IERROR

MPI_SCATTER is the inverse operation to MPI_GATHER.

The outcome is as if the root executed n send operations, MPI_Send(sendbuf+i-sendcount-extent(sendtype), sendcount, sendtype, i,...), i = 0 to n - 1. and each process executed a receive, MPI_Recv(recvbuf, recvcount, recvtype, root,...).

An alternative description is that the root sends a message with MPI_Send(sendbuf, sendcount-n, sendtype, ...). This message is split into n equal segments, the ith segment is sent to the ith process in the group, and each process receives this message as above.

The type signature associated with sendcount and sendtype at the root must be equal to the type signature associated with recvcount and recvtype at all processes. This implies that the amount of data sent must be equal to the amount of data received, pairwise between each process and the root. Distinct type maps between sender and receiver are still allowed.

All arguments to the function are significant on process root, while on other processes, only arguments recvbuf, recvcount, recvtype, root, comm are significant. The argument root must have identical values on all processes and comm must represent the same intragroup communication domain. The send buffer is ignored for all non-root processes.

The specification of counts and types should not cause any location on the root to be read more than once.

Rationale. Though not essential, the last restriction is 
   imposed so as to acheive symmetry with MPI_GATHER, where the 
   corresponding restriction(a multiple-write restriction) 
   is necessary. (End of rational)





Jack Dongarra
Fri Sep 1 06:16:55 EDT 1995