Home | Libraries | People | FAQ | More |
boost::mpi::all_reduce — Combine the values stored by each process into a single value available to all processes.
// In header: <boost/mpi/collectives.hpp> template<typename T, typename Op> void all_reduce(const communicator & comm, const T & in_value, T & out_value, Op op); template<typename T, typename Op> T all_reduce(const communicator & comm, const T & in_value, Op op); template<typename T, typename Op> void all_reduce(const communicator & comm, const T * in_values, int n, T * out_values, Op op);
all_reduce
is a collective algorithm that combines the values stored by each process into a single value available to all processes. The values are combined in a user-defined way, specified via a function object. The type T
of the values may be any type that is serializable or has an associated MPI data type. One can think of this operation as a all_gather
, followed by an std::accumulate()
over the gather values and using the operation op
.
When the type T
has an associated MPI data type, this routine invokes MPI_Allreduce
to perform the reduction. If possible, built-in MPI operations will be used; otherwise, all_reduce()
will create a custom MPI_Op for the call to MPI_Allreduce.
Parameters: |
|
||||||||
Returns: |
If no |