DIY 3.0 data-parallel out-of-core C++ library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List

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 (void)scoped;
26 RegularDecomposer<DiscreteBounds> decomposer(1, interval(0,assigner.nblocks()-1), assigner.nblocks());
27 RegularSwapPartners partners(decomposer, k, false);
28 reduce(master, assigner, partners, detail::AllToAllReduce<Op>(op, assigner), detail::SkipIntermediate(partners.rounds()));
29 }
30
31 }
32
33 #endif
diy::Assigner::nblocks
int nblocks() const
returns the total number of global blocks
Definition: assigner.hpp:26
diy::RegularDecomposer
Decomposes a regular (discrete or continuous) domain into even blocks; creates Links with Bounds alon...
Definition: decomposition.hpp:75
diy::reduce
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
diy::all_to_all
void all_to_all(Master &master, const Assigner &assigner, const Op &op, int k=2)
all to all reduction
Definition: reduce-operations.hpp:18
diy::Assigner
Definition: assigner.hpp:11
diy::Master
Definition: master.hpp:35
diy::interval
diy::DiscreteBounds interval(int from, int to)
Helper to create a 1-dimensional discrete domain with the specified extents.
Definition: types.hpp:28
diy::RegularSwapPartners
Partners for swap-reduce.
Definition: swap.hpp:16