Scatter: Vector Variant



next up previous contents
Next: Examples Using MPI_SCATTERV Up: Scatter Previous: An Example Using

Scatter: Vector Variant

  scatter, vector variant

  MPI_SCATTERV(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount,
                      recvtype, root, comm)

    IN       sendbuf          address of send buffer
    IN       sendcounts       integer array 
    IN       displs           integer array of displacements 
    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_Scatterv(void* sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)

MPI_SCATTERV(SENDBUF, SENDCOUNTS, DISPLS, SENDTYPE, RECVBUF, RECVCOUNT, RECVTYPE, ROOT, COMM, IERROR) <type> SENDBUF(*), RECVBUF(*)
INTEGER SENDCOUNTS(*), DISPLS(*), SENDTYPE, RECVCOUNT, RECVTYPE, ROOT, COMM, IERROR

MPI_SCATTERV is the inverse operation to MPI_GATHERV.

MPI_SCATTERV extends the functionality of MPI_SCATTER by allowing a varying count of data to be sent to each process, since sendcounts is now an array. It also allows more flexibility as to where the data is taken from on the root, by providing the new argument, displs.

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

The type signature implied by sendcount[i] and sendtype at the root must be equal to the type signature implied by recvcount and recvtype at process i. 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 arguments 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, types, and displacements should not cause any location on the root to be read more than once.



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