|
Boost Users : |
Subject: Re: [Boost-users] [EXTERNAL] Boost MPI Collective
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2014-09-01 23:11:25
On Aug 25, 2014, at 9:59 AM, Nolen, Steven Douglas <drnuke_at_[hidden]> wrote:
> In boost/mpi/collectives/reduce.hpp
> The template function specialization for reduce-ing a std::vector, should probably be modified.
>
> From
>
> template<typename T, typename Op>
> 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<typename T, typename Op>
> 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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net