12 namespace alps {
namespace mpi {
18 if (retcode != MPI_SUCCESS)
25 checked(MPI_Comm_test_inter(comm, &flag));
31 namespace alps {
namespace alea {
47 throw std::runtime_error(
"Unable to use in-place communication");
53 (size_t) comm_.size(),
60 mpi::checked(MPI_Allreduce(MPI_IN_PLACE, &data, 1, MPI_LONG,
73 int root()
const {
return root_; }
75 bool am_root()
const {
return comm_.rank() == root_; }
89 const void *sendbuf = am_root() ? MPI_IN_PLACE : data.
data();
92 MPI_SUM, root_, comm_));
reducer_setup get_setup() const override
long get_max(long data) const override
void reduce(view< double > data) const override
void commit() const override
void reduce(view< long > data) const override
mpi_reducer(const mpi::communicator &comm=mpi::communicator(), int root=0)
Header for object-oriented interface to MPI (similar to boost::mpi)
Encapsulation of an MPI communicator and some communicator-related operations.
bool is_intercomm(const communicator &comm)
void inplace_reduce(view< T > data) const
void checked(int retcode)
MPI_Datatype get_mpi_datatype(const T &)
Returns MPI datatype for the value of type T
const mpi::communicator & comm() const