Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Function gather

boost::mpi::gather — Gather the values stored at every process into a vector at the root process.

Synopsis

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


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

Description

gather is a collective algorithm that collects the values stored at each process into a vector of values at the root process. This vector is indexed by the process number that the value 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_Gather to gather the values.

Parameters:

comm

The communicator over which the gather will occur.

in_value

The value to be transmitted by each process. For gathering arrays of values, in_values points to storage for n*comm.size() values.

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, it will be resized accordingly. For non-root processes, this parameter may be omitted. If it is still provided, however, it will be unchanged.

root

The process ID number that will collect the values. This value must be the same on all processes.


PrevUpHomeNext