Edit

Share via


MPI_Allgatherv function

Gathers a variable amount of data from each member of a group and sends the data to all members of the group. The MPI_Allgatherv function is like the MPI_Gatherv, except that all processes receive the result, instead of just the root. The block of data that is sent from the jth process is received by every process and placed in the jth block of the buffer recvbuf. These blocks do not all have to be the same size.

Syntax

int MPIAPI MPI_Allgatherv(
  _In_  void         *sendbuf,
        int          sendcount,
        MPI_Datatype sendtype,
  _Out_ void         *recvbuf,
  _In_  int          *recvcounts,
  _In_  int          *displs,
        MPI_Datatype recvtype,
        MPI_Comm     comm
);

Parameters

  • sendbuf [in]
    The pointer to the data to be sent to all processes in the group. The number and data type of the elements in the buffer are specified in the sendcount and sendtype parameters. Each element in the buffer corresponds to a process in the group.

    If the comm parameter references an intracommunicator, you can specify an in-place option by specifying MPI_IN_PLACE in all processes. The sendcount and sendtype parameters are ignored. Each process enters data in the corresponding receive buffer element. The nth process sends data to the nth element of the receive buffer.

  • sendcount
    The number of data elements that this process sends in the buffer that is specified in the sendbuf parameter. If an element in sendcount is zero, the data part of the message from that process is empty.

  • sendtype
    The MPI data type of the elements in the send buffer.

  • recvbuf [out]
    The pointer to a buffer that contains the data that is received from each process. The number and data type of the elements in the buffer are specified in the recvcount and recvtype parameters.

  • recvcounts [in]
    The number of data elements from each communicator process in the receive buffer.

  • displs [in]
    The location, relative to the recvbuf parameter, of the data from each communicator process.

    In the recvbuf, recvcounts, and displs parameter arrays, the nth element of each array refers to the data that is received from the nth communicator process.

  • recvtype
    The MPI data type of each element in buffer.

  • comm
    The MPI_Comm communicator handle.

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_ALLGATHERV(SENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNTS,DISPLS, RECVTYPE,COMM, IERROR)
        <type> SENDBUF(*), R.ECVBUF(*)
        INTEGER SENDCOUNT, SENDTYPE, RECVCOUNTS(*), DISPLS(*), RECVTYPE, COMM, IERROR

Remarks

The usage rules for MPI_Allgatherv correspond to the rules for MPI_Gatherv.

The type signature that is associated with the sendtype parameter on a process must be equal to the type signature that is associated with the recvtype parameter on any other process.

If the comm parameter references an intracommunicator, the outcome of a call to MPI_Allgatherv(...)is as if all processes executed calls to MPI_GatherV(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs,recvtype,root,comm), for root = 0 , ..., n-1.

If the comm parameter references an intercommunicator, then each process of one group, for example, group A, contributes the number of data items that are specified in the sendcount parameter. This data is concatenated, and the result is stored at each process in the other group, group B. Conversely, the concatenation of the data of the processes in group B is stored at each process in group A. The send buffer parameters in group A must be consistent with the receive buffer parameters in group B, and vice versa.

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_Gatherv

MPI_Datatype