6 #ifndef TREECOMM_HPP_INCLUDE
7 #define TREECOMM_HPP_INCLUDE
43 virtual void send_up(
int level,
const std::vector<double> &sample) = 0;
45 virtual void send_down(
int level,
const std::vector<std::vector<double> > &policy) = 0;
48 virtual bool receive_up(
int level, std::vector<std::vector<double> > &sample) = 0;
50 virtual bool receive_down(
int level, std::vector<double> &policy) = 0;
55 static std::vector<int>
fan_out(
const std::shared_ptr<Comm> &comm);
67 const std::vector<int> &
fan_out,
71 std::vector<std::shared_ptr<TreeCommLevel> > mock_level);
78 void send_down(
int level,
const std::vector<std::vector<double> > &policy)
override;
79 void send_up(
int level,
const std::vector<double> &sample)
override;
80 bool receive_down(
int level, std::vector<double> &policy)
override;
81 bool receive_up(
int level, std::vector<std::vector<double> > &sample)
override;
85 std::vector<std::shared_ptr<TreeCommLevel> > init_level(
86 std::shared_ptr<Comm> comm_cart,
int root_level);
87 std::shared_ptr<Comm> m_comm;
90 std::vector<int> m_fan_out;
100 std::vector<std::shared_ptr<TreeCommLevel> > m_level_ctl;
Definition: TreeComm.hpp:19
virtual int num_level_controlled(void) const =0
Returns the number of tree levels controlled by the Controller on this node. This determines which le...
virtual ~TreeComm()=default
virtual int root_level(void) const =0
Returns the level of the root of the tree, which is equal to the number of levels in the tree.
virtual int level_rank(int level) const =0
Returns the rank of the given level.
virtual void send_up(int level, const std::vector< double > &sample)=0
Send samples up to the parent within a level.
virtual int max_level(void) const =0
Returns the number of tree levels participated in by the Controller on this node. This determines whi...
virtual bool receive_down(int level, std::vector< double > &policy)=0
Receive policies from the parent within a level.
virtual size_t overhead_send(void) const =0
Returns the total number of bytes sent from the entire tree.
virtual void send_down(int level, const std::vector< std::vector< double > > &policy)=0
Send policies down to children within a level.
virtual int level_size(int level) const =0
Returns the number of children for each parent in the given level.
virtual bool receive_up(int level, std::vector< std::vector< double > > &sample)=0
Receive samples from children within a level.
static std::vector< int > fan_out(const std::shared_ptr< Comm > &comm)
Returns the number of children at each level.
Definition: TreeComm.cpp:177
Definition: TreeComm.hpp:61
void send_down(int level, const std::vector< std::vector< double > > &policy) override
Send policies down to children within a level.
Definition: TreeComm.cpp:141
virtual ~TreeCommImp()
Definition: TreeComm.cpp:99
void send_up(int level, const std::vector< double > &sample) override
Send samples up to the parent within a level.
Definition: TreeComm.cpp:132
bool receive_down(int level, std::vector< double > &policy) override
Receive policies from the parent within a level.
Definition: TreeComm.cpp:159
int level_size(int level) const override
Returns the number of children for each parent in the given level.
Definition: TreeComm.cpp:123
int max_level(void) const override
Returns the number of tree levels participated in by the Controller on this node. This determines whi...
Definition: TreeComm.cpp:69
TreeCommImp(std::shared_ptr< Comm > comm, int num_send_down, int num_send_up)
Definition: TreeComm.cpp:22
int num_level_controlled(void) const override
Returns the number of tree levels controlled by the Controller on this node. This determines which le...
Definition: TreeComm.cpp:104
int level_rank(int level) const override
Returns the rank of the given level.
Definition: TreeComm.cpp:114
size_t overhead_send(void) const override
Returns the total number of bytes sent from the entire tree.
Definition: TreeComm.cpp:168
int root_level(void) const override
Returns the level of the root of the tree, which is equal to the number of levels in the tree.
Definition: TreeComm.cpp:109
bool receive_up(int level, std::vector< std::vector< double > > &sample) override
Receive samples from children within a level.
Definition: TreeComm.cpp:150
Definition: TreeCommLevel.hpp:15
Definition: Accumulator.cpp:12