Purpose
Gathers individual messages from each task in comm and distributes the resulting message to each task.
C synopsis
#include <mpi.h>
int MPI_Allgather(void* sendbuf,int sendcount,MPI_Datatype sendtype,
void* recvbuf,int recvcount,MPI_Datatype recvtype,MPI_Comm comm);
C++ synopsis
#include mpi.h void MPI::Comm::Allgather(const void* sendbuf, int sendcount, const MPI::Datatype& sendtype, void* recvbuf, int recvcount, const MPI::Datatype& recvtype) const;
FORTRAN synopsis
include 'mpif.h' or use mpi MPI_ALLGATHER(CHOICE SENDBUF,INTEGER SENDCOUNT,INTEGER SENDTYPE, CHOICE RECVBUF,INTEGER RECVCOUNT,INTEGER RECVTYPE, INTEGER COMM,INTEGER IERROR)
Parameters
Description
MPI_ALLGATHER is similar to MPI_GATHER except that all tasks receive the result instead of just the root.
The block of data sent from task j is received by every task and placed in the jth block of the buffer recvbuf.
The type signature associated with sendcount, sendtype at a task must be equal to the type signature associated with recvcount, recvtype at any other task.
The "in place" option for intracommunicators is specified by passing the value MPI_IN_PLACE to sendbuf at all tasks. The sendcount and sendtype arguments are ignored. The input data of each task is assumed to be in the area where that task would receive its own contribution to the receive buffer. Specifically, the outcome of a call to MPI_ALLGATHER in the "in place" case is as if all tasks executed n calls to:
MPI_GATHER(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, recvbuf, recvcount, recvtype, root, comm)
for: root = 0, ..., n - 1.
If comm is an intercommunicator, each task in group A contributes a data item. These items are concatenated and the result is stored at each task in group B. Conversely, the concatenation of the contributions of the tasks in group B is stored at each task in group A. The send buffer arguments in group A must be consistent with the receive buffer arguments in group B, and vice versa.
MPI_IN_PLACE is not supported for intercommunicators.
When you use this subroutine in a threads application, make sure all collective operations on a particular communicator occur in the same order at each task. See IBM Parallel Environment for AIX: MPI Programming Guide for more information on programming with MPI in a threads environment.
Errors
Fatal errors:
Develop mode error if:
Related information