| Home | Libraries | People | FAQ | More

## Function all_gather

boost::mpi::all_gather — Gather the values stored at every process into vectors of values from each process.

## Synopsis

    // In header: <boost/mpi/collectives.hpp>

    template<typename T>
      void all_gather(const communicator & comm, const T & in_value,
                      std::vector< T > & out_values);
    template<typename T>
      void all_gather(const communicator & comm, const T & in_value,
                      T * out_values);
    template<typename T>
      void all_gather(const communicator & comm, const T * in_values, int n,
                      std::vector< T > & out_values);
    template<typename T>
      void all_gather(const communicator & comm, const T * in_values, int n,
                      T * out_values);

## Description

`all_gather` is a collective algorithm that collects the values stored at each process into a vector of values indexed by the process number they came from. The type `T` of the values may be any type that is serializable or has an associated MPI data type.

When the type `T` has an associated MPI data type, this routine invokes `MPI_Allgather` to gather the values.

Parameters:

`comm` | The communicator over which the all-gather will occur.
`in_value` | The value to be transmitted by each process. To gather an array of values, `in_values` points to the `n` local values to be transmitted.
`out_values` | A vector or pointer to storage that will be populated with the values from each process, indexed by the process ID number. If it is a vector, the vector will be resized accordingly.