DIY  3.0
data-parallel out-of-core C++ library
 All Classes Namespaces Functions Typedefs Groups Pages
reduce-operations.hpp
1 #ifndef DIY_REDUCE_OPERATIONS_HPP
2 #define DIY_REDUCE_OPERATIONS_HPP
3 
4 #include "reduce.hpp"
5 #include "partners/swap.hpp"
6 #include "detail/reduce/all-to-all.hpp"
7 
8 namespace diy
9 {
10 
16 template<class Op>
17 void
18 all_to_all(Master& master,
19  const Assigner& assigner,
20  const Op& op,
21  int k = 2
22  )
23 {
24  auto scoped = master.prof.scoped("all_to_all");
25  RegularDecomposer<DiscreteBounds> decomposer(1, interval(0,assigner.nblocks()-1), assigner.nblocks());
26  RegularSwapPartners partners(decomposer, k, false);
27  reduce(master, assigner, partners, detail::AllToAllReduce<Op>(op, assigner), detail::SkipIntermediate(partners.rounds()));
28 }
29 
30 }
31 
32 #endif
int nblocks() const
returns the total number of global blocks
Definition: assigner.hpp:26
Decomposes a regular (discrete or continuous) domain into even blocks; creates Links with Bounds alon...
Definition: decomposition.hpp:75
void reduce(Master &master, const Assigner &assigner, const Partners &partners, const Reduce &reduce, const Skip &skip)
Implementation of the reduce communication pattern (includes swap-reduce, merge-reduce, and any other global communication).
Definition: reduce.hpp:109
void all_to_all(Master &master, const Assigner &assigner, const Op &op, int k=2)
all to all reduction
Definition: reduce-operations.hpp:18
Definition: assigner.hpp:11
Definition: master.hpp:35
diy::DiscreteBounds interval(int from, int to)
Helper to create a 1-dimensional discrete domain with the specified extents.
Definition: types.hpp:28
Partners for swap-reduce.
Definition: swap.hpp:16