Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76186 - trunk/boost/mpi/collectives
From: troyer_at_[hidden]
Date: 2011-12-26 12:29:37


Author: troyer
Date: 2011-12-26 12:29:36 EST (Mon, 26 Dec 2011)
New Revision: 76186
URL: http://svn.boost.org/trac/boost/changeset/76186

Log:
Added missing resize of vector, to become compatible with documentation
Text files modified:
   trunk/boost/mpi/collectives/gather.hpp | 7 ++++++-
   1 files changed, 6 insertions(+), 1 deletions(-)

Modified: trunk/boost/mpi/collectives/gather.hpp
==============================================================================
--- trunk/boost/mpi/collectives/gather.hpp (original)
+++ trunk/boost/mpi/collectives/gather.hpp 2011-12-26 12:29:36 EST (Mon, 26 Dec 2011)
@@ -131,7 +131,12 @@
 gather(const communicator& comm, const T* in_values, int n,
        std::vector<T>& out_values, int root)
 {
- ::boost::mpi::gather(comm, in_values, n, &out_values[0], root);
+ if (comm.rank() == root) {
+ out_values.resize(comm.size() * n);
+ ::boost::mpi::gather(comm, in_values, n, &out_values[0], root);
+ }
+ else
+ ::boost::mpi::gather(comm, in_values, n, root);
 }
 
 template<typename T>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk