1 #ifndef DIY_PARTNERS_ALL_REDUCE_HPP
2 #define DIY_PARTNERS_ALL_REDUCE_HPP
27 template<
class Decomposer>
30 bool contiguous =
true
32 Parent(decomposer, k, contiguous) {}
35 bool contiguous =
true
37 Parent(divs, kvs, contiguous) {}
40 size_t rounds()
const {
return 2*Parent::rounds(); }
48 int parent_round(
int round)
const {
return round < (int) Parent::rounds() ? round : static_cast<int>(
rounds()) - round; }
51 inline void incoming(
int round,
int gid, std::vector<int>& partners,
const Master& m)
const
53 if (round <= (
int) Parent::rounds())
54 Parent::incoming(round, gid, partners, m);
59 inline void outgoing(
int round,
int gid, std::vector<int>& partners,
const Master& m)
const
61 if (round < (
int) Parent::rounds())
62 Parent::outgoing(round, gid, partners, m);
int size(int round) const
returns size of a group of partners in a given round
Definition: all-reduce.hpp:42
Partners for merge-reduce.
Definition: merge.hpp:16
bool active(int round, int gid, const Master &m) const
returns whether a given block in a given round has dropped out of the merge yet or not ...
Definition: all-reduce.hpp:46
int dim(int round) const
returns dimension (direction of partners in a regular grid) in a given round
Definition: all-reduce.hpp:44
Decomposes a regular (discrete or continuous) domain into even blocks; creates Links with Bounds alon...
Definition: decomposition.hpp:75
RegularMergePartners Parent
base class merge reduction
Definition: all-reduce.hpp:22
Allreduce (reduction with results broadcasted to all blocks) is implemented as two merge reductions...
Definition: all-reduce.hpp:20
Definition: master.hpp:35
RegularAllReducePartners(const Decomposer &decomposer, int k, bool contiguous=true)
contiguous parameter indicates whether to match partners contiguously or in a round-robin fashion; co...
Definition: all-reduce.hpp:28
size_t rounds() const
returns total number of rounds
Definition: all-reduce.hpp:40
int parent_round(int round) const
returns what the current round would be in the first or second parent merge reduction ...
Definition: all-reduce.hpp:48
RegularAllReducePartners(const DivisionVector &divs, const KVSVector &kvs, bool contiguous=true)
Definition: all-reduce.hpp:33