MPI_Scatterv function - Message Passing Interface (original) (raw)

Scatters data from one member across all members of a group. The MPI_Scatterv function performs the inverse of the operation that is performed by the MPI_Gatherv function.

Syntax

int MPIAPI MPI_Scatterv(
  _In_  void         *sendbuf,
  _In_  int          *sendcounts,
  _In_  int          *displs,
        MPI_Datatype sendtype,
  _Out_ void         *recvbuf,
        int          recvcount,
        MPI_Datatype recvtype,
        int          root,
        MPI_Comm     comm
);

Parameters

Return value

Returns MPI_SUCCESS on success. Otherwise, the return value is an error code.

In Fortran, the return value is stored in the IERROR parameter.

Fortran

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

The MPI_Scatterv function extends the functionality of the MPI_Scatter function by allowing a varying count of data, as specified in the sendcounts array, to be sent to each process.

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

All the function parameters are significant on the root process, only the recvbuf, recvcount, recvtype, root, and comm parameters are significant on the other processes. The root and comm parameters must be identical on all processes.

The type signature as specified by the sendcount, and sendtype parameters for the root process must be equal to the type signature as specified by the recvcount, and recvtype parameters for all processes. Therefore, the amount of data sent must be equal to the amount of data that is received between any pair of processes. Distinct type maps between sender and receiver are still allowed.

If comm is an intracommunicator, the result is as if the root executed n send operations MPI_Send(sendbuf + displs[i]*extent(sendtype), sendcounts[i], sendtype, I, …); and each process executed a receive, MPI_Recv(recvbuf, recvcount, recvtype, i,…).

If the comm parameter references an intercommunicator, then the call involves all processes in the intercommunicator, but with one group, group A, that defines the root process. All processes in the other group, group B, set the same value in root parameter, that is, the rank of the root process in group A. The root process sets the value MPI_ROOT in the root parameter. All other processes in group A set the value MPI_PROC_NULL in the root parameter. Data is broadcast from the root process to all processes in group B. The buffer parameters of the processes in group B must be consistent with the buffer parameter of the root process.

Requirements

Product HPC Pack 2012 MS-MPI Redistributable Package, HPC Pack 2008 R2 MS-MPI Redistributable Package, HPC Pack 2008 MS-MPI Redistributable Package or HPC Pack 2008 Client Utilities
Header Mpi.h; Mpif.h
Library Msmpi.lib
DLL Msmpi.dll

See also

MPI Collective Functions

MPI_Datatype

MPI_Gather

MPI_Gatherv

MPI_Scatter