| Home | Libraries | People | FAQ | More

## Function all_to_all

boost::mpi::all_to_all — Send data from every process to every other process.

## Synopsis

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

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

## Description

`all_to_all` is a collective algorithm that transmits `p` values from every process to every other process. On process i, jth value of the `in_values` vector is sent to process j and placed in the ith position of the `out_values` vector in process `j`. The type `T` of the values may be any type that is serializable or has an associated MPI data type. If `n` is provided, then arrays of `n` values will be transferred from one process to another.

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

Parameters:

`comm` | The communicator over which the all-to-all communication will occur.
`in_values` | A vector or pointer to storage that contains the values to send to each process, indexed by the process ID number.
`out_values` | A vector or pointer to storage that will be updated to contain the values received from other processes. The jth value in `out_values` will come from the procss with rank j.