| Home | Libraries | People | FAQ | More

## Function gatherv

boost::mpi::gatherv — Similar to boost::mpi::gather with the difference that the number of values to be send by non-root processes can vary.

## Synopsis

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

    template<typename T>
      void gatherv(const communicator & comm, const std::vector< T > & in_values,
                   T * out_values, const std::vector< int > & sizes,
                   const std::vector< int > & displs, int root);
    template<typename T>
      void gatherv(const communicator & comm, const T * in_values, int in_size,
                   T * out_values, const std::vector< int > & sizes,
                   const std::vector< int > & displs, int root);
    template<typename T>
      void gatherv(const communicator & comm, const std::vector< T > & in_values,
                   int root);
    template<typename T>
      void gatherv(const communicator & comm, const T * in_values, int in_size,
                   int root);
    template<typename T>
      void gatherv(const communicator & comm, const T * in_values, int in_size,
                   T * out_values, const std::vector< int > & sizes, int root);
    template<typename T>
      void gatherv(const communicator & comm, const std::vector< T > & in_values,
                   T * out_values, const std::vector< int > & sizes, int root);

## Description

Parameters: |
`comm` | The communicator over which the gather will occur.
`displs` | A vector such that the i-th entry specifies the displacement (relative to `out_values`) from which to take the ingoing data at the `root` process. Overloaded versions for which `displs` is omitted assume that the data is to be placed contiguously at the root process.
`in_values` | The array of values to be transmitted by each process.
`out_values` | A pointer to storage that will be populated with the values from each process. 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.
`sizes` | A vector containing the number of elements each non-root process will send.