ALPSCore reference
boost_mpi.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3  * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4  * For use in publications, see ACKNOWLEDGE.TXT
5  */
6 
7 #pragma once
8 
9 #include <alps/config.hpp>
10 
11 #ifdef ALPS_HAVE_MPI
12 
13  #include "alps/utilities/mpi.hpp"
14  #include <vector>
15 
16  namespace alps {
17  namespace mpi {
18 
20  template<typename T, typename A, typename Op> void reduce(const communicator & comm, std::vector<T, A> const & in_values, Op op, int root) {
21  reduce(comm, &in_values.front(), in_values.size(), op, root);
22  }
23 
25  template<typename T, typename A, typename Op> void reduce(const communicator & comm, std::vector<T, A> const & in_values, std::vector<T, A> & out_values, Op op, int root) {
26  out_values.resize(in_values.size());
27  reduce(comm, &in_values.front(), in_values.size(), &out_values.front(), op, root);
28  }
29  }
30  }
31 
32 #endif
33 
Header for object-oriented interface to MPI (similar to boost::mpi)