6 #ifndef TREECOMMLEVEL_HPP_INCLUDE
7 #define TREECOMMLEVEL_HPP_INCLUDE
22 virtual void send_up(
const std::vector<double> &sample) = 0;
24 virtual void send_down(
const std::vector<std::vector<double> > &policy) = 0;
26 virtual bool receive_up(std::vector<std::vector<double> > &sample) = 0;
39 TreeCommLevelImp(std::shared_ptr<Comm> comm,
int num_send_up,
int num_send_down);
44 void send_up(
const std::vector<double> &sample)
override;
45 void send_down(
const std::vector<std::vector<double> > &policy)
override;
46 bool receive_up(std::vector<std::vector<double> > &sample)
override;
51 std::shared_ptr<Comm> m_comm;
54 double *m_sample_mailbox;
55 double *m_policy_mailbox;
56 size_t m_sample_window;
57 size_t m_policy_window;
58 size_t m_overhead_send;
59 std::vector<std::vector<double> > m_policy_last;
61 size_t m_num_send_down;
Abstract base class for interprocess communication in geopm.
Definition: Comm.hpp:20
Definition: TreeCommLevel.hpp:15
virtual size_t overhead_send(void) const =0
Returns the total number of bytes sent at this level.
virtual bool receive_up(std::vector< std::vector< double > > &sample)=0
Receive samples up from children.
virtual int level_rank(void) const =0
Returns the rank for this level.
virtual ~TreeCommLevel()=default
virtual void send_up(const std::vector< double > &sample)=0
Send samples up to the parent.
virtual bool receive_down(std::vector< double > &policy)=0
Receive policies down from the parent.
virtual void send_down(const std::vector< std::vector< double > > &policy)=0
Send policies down to children.
Definition: TreeCommLevel.hpp:37
virtual ~TreeCommLevelImp()
Definition: TreeCommLevel.cpp:35
void send_up(const std::vector< double > &sample) override
Send samples up to the parent.
Definition: TreeCommLevel.cpp:55
TreeCommLevelImp(const TreeCommLevelImp &other)=delete
size_t overhead_send(void) const override
Returns the total number of bytes sent at this level.
Definition: TreeCommLevel.cpp:177
bool receive_down(std::vector< double > &policy) override
Receive policies down from the parent.
Definition: TreeCommLevel.cpp:157
TreeCommLevelImp(std::shared_ptr< Comm > comm, int num_send_up, int num_send_down)
Definition: TreeCommLevel.cpp:17
void send_down(const std::vector< std::vector< double > > &policy) override
Send policies down to children.
Definition: TreeCommLevel.cpp:77
int level_rank(void) const override
Returns the rank for this level.
Definition: TreeCommLevel.cpp:50
bool receive_up(std::vector< std::vector< double > > &sample) override
Receive samples up from children.
Definition: TreeCommLevel.cpp:111
TreeCommLevelImp & operator=(const TreeCommLevelImp &other)=delete
Definition: Accumulator.cpp:12