DIY  3.0
data-parallel out-of-core C++ library
 All Classes Namespaces Functions Typedefs Groups Pages
broadcast.hpp
1 #ifndef DIY_PARTNERS_BROADCAST_HPP
2 #define DIY_PARTNERS_BROADCAST_HPP
3 
4 #include "merge.hpp"
5 
6 namespace diy
7 {
8 
9 class Master;
10 
17 {
19 
23  template<class Decomposer>
25  int k,
26  bool contiguous = true
27  ):
28  Parent(decomposer, k, contiguous) {}
29  RegularBroadcastPartners(const DivisionVector& divs,
30  const KVSVector& kvs,
31  bool contiguous = true
32  ):
33  Parent(divs, kvs, contiguous) {}
34 
36  size_t rounds() const { return Parent::rounds(); }
38  int size(int round) const { return Parent::size(parent_round(round)); }
40  int dim(int round) const { return Parent::dim(parent_round(round)); }
42  inline bool active(int round, int gid, const Master& m) const { return Parent::active(parent_round(round), gid, m); }
44  int parent_round(int round) const { return rounds() - round; }
45 
46  // incoming is only valid for an active gid; it will only be called with an active gid
47  inline void incoming(int round, int gid, std::vector<int>& partners, const Master& m) const
48  {
49  Parent::outgoing(parent_round(round), gid, partners, m);
50  }
51 
52  inline void outgoing(int round, int gid, std::vector<int>& partners, const Master& m) const
53  {
54  Parent::incoming(parent_round(round), gid, partners, m);
55  }
56 };
57 
58 } // diy
59 
60 #endif
61 
62 
Partners for merge-reduce.
Definition: merge.hpp:16
RegularBroadcastPartners(const DivisionVector &divs, const KVSVector &kvs, bool contiguous=true)
Definition: broadcast.hpp:29
int size(int round) const
returns size of a group of partners in a given round
Definition: broadcast.hpp:38
int parent_round(int round) const
returns what the current round would be in the first or second parent merge reduction ...
Definition: broadcast.hpp:44
size_t rounds() const
returns total number of rounds
Definition: broadcast.hpp:36
Decomposes a regular (discrete or continuous) domain into even blocks; creates Links with Bounds alon...
Definition: decomposition.hpp:75
int dim(int round) const
returns dimension (direction of partners in a regular grid) in a given round
Definition: broadcast.hpp:40
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: broadcast.hpp:42
Definition: master.hpp:35
RegularBroadcastPartners(const Decomposer &decomposer, int k, bool contiguous=true)
contiguous parameter indicates whether to match partners contiguously or in a round-robin fashion; co...
Definition: broadcast.hpp:24
Partners for broadcast.
Definition: broadcast.hpp:16
RegularMergePartners Parent
base class merge reduction
Definition: broadcast.hpp:18