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

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

Syntax

int MPIAPI MPI_Scatter(
  _In_  void         *sendbuf,
        int          sendcount,
        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_SCATTER(SENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, RECVTYPE, ROOT, COMM, IERROR)
        <type> SENDBUF(*), RECVBUF(*)
        INTEGER SENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE, ROOT, COMM, IERROR

The effect of the MPI_Scatter function is as if the root process sends a message by using the MPI_Send function. This message is split into n equal segments, one for each member of the group. The _i_th segment is sent to the _i_th process in the group.

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

The type signature that is specified by the sendcount and sendtype parameters for the root process must be equal to the type signature that is specified by the recvcount, and recvtype parameters for all processes. Therefore, the amount of data that is 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.

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 specification of counts and types should not cause any location on the root to be read more than one time.

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_Scatterv