Boost MPI Collective

In boost/mpi/collectives/reduce.hpp
The template function specialization for reduce-ing a std::vector, should probably be modified.
Ffrom
template

On Aug 25, 2014, at 9:59 AM, Nolen, Steven Douglas
In boost/mpi/collectives/reduce.hpp The template function specialization for reduce-ing a std::vector, should probably be modified.
From
template
void reduce(const communicator & comm, std::vector<T> const & in_values, std::vector<T> & out_values, Op op, int root) { out_values.resize(in_values.size()); reduce(comm, &in_values.front(), in_values.size(), &out_values.front(), op, root); } To
template
void reduce(const communicator & comm, std::vector<T> const & in_values, std::vector<T> & out_values, Op op, int root) { if( comm.rank() == root ) out_values.resize(in_values.size()); reduce(comm, &in_values.front(), in_values.size(), &out_values.front(), op, root); } This will save an extraneous allocation on the non-root nodes.
Hi Steve, This change looks reasonable, I just committed it, thanks for pointing it out. — Noel
participants (2)
-
Belcourt, Kenneth
-
Nolen, Steven Douglas