6 #ifndef FFNETAGENT_HPP_INCLUDE
7 #define FFNETAGENT_HPP_INCLUDE
16 #include "geopm_time.h"
42 const PlatformTopo &topo,
43 const std::map<std::pair<geopm_domain_e, int>, std::shared_ptr<DomainNetMap> > &net_map,
44 const std::map<geopm_domain_e, std::shared_ptr<RegionHintRecommender> > &freq_recommender,
45 std::shared_ptr<Waiter> waiter);
47 void init(
int level,
const std::vector<int> &fan_in,
bool is_level_root)
override;
50 std::vector<std::vector<double> > &out_policy)
override;
53 std::vector<double> &out_sample)
override;
58 void wait(
void)
override;
59 std::vector<std::pair<std::string, std::string> >
report_header(
void)
const override;
60 std::vector<std::pair<std::string, std::string> >
report_host(
void)
const override;
61 std::map<uint64_t, std::vector<std::pair<std::string, std::string> > >
63 std::vector<std::string>
trace_names(
void)
const override;
64 std::vector<std::function<std::string(
double)> >
trace_formats(
void)
const override;
66 void enforce_policy(
const std::vector<double> &policy)
const override;
74 struct m_domain_key_s {
77 bool operator<(
const m_domain_key_s &other)
const;
87 static bool is_all_nan(
const std::vector<double> &vec);
88 static std::string get_env_value(
const std::string &env_var);
89 void init_domain_indices(
const PlatformTopo &topo);
91 PlatformIO &m_platform_io;
92 static constexpr
double M_WAIT_SEC = 0.020;
93 bool m_do_write_batch;
95 std::map<std::string, double> m_policy_available;
97 double m_perf_energy_bias;
98 std::map<m_domain_key_s, std::shared_ptr<DomainNetMap> > m_net_map;
99 std::map<geopm_domain_e, std::shared_ptr<RegionHintRecommender> > m_freq_recommender;
101 std::map<m_domain_key_s, m_control_s> m_freq_control;
102 std::vector<geopm_domain_e> m_domain_types;
103 std::vector<m_domain_key_s> m_domains;
104 std::shared_ptr<Waiter> m_waiter;
106 static const std::map<geopm_domain_e, std::string> M_NNET_ENVNAME;
107 static const std::map<geopm_domain_e, std::string> M_FREQMAP_ENVNAME;
108 static const std::map<geopm_domain_e, std::string> M_MAX_FREQ_SIGNAL_NAME;
109 static const std::map<geopm_domain_e, std::string> M_MIN_FREQ_SIGNAL_NAME;
110 static const std::map<geopm_domain_e, std::string> M_MAX_FREQ_CONTROL_NAME;
111 static const std::map<geopm_domain_e, std::string> M_MIN_FREQ_CONTROL_NAME;
112 static const std::map<geopm_domain_e, std::string> M_TRACE_SUFFIX;
Feed Forward Net Agent.
Definition: FFNetAgent.hpp:28
void aggregate_sample(const std::vector< std::vector< double > > &in_sample, std::vector< double > &out_sample) override
Aggregate samples from children for the next level up the tree.
Definition: FFNetAgent.cpp:194
void trace_values(std::vector< double > &values) override
Called by Controller to get latest values to be added to the trace.
Definition: FFNetAgent.cpp:298
void adjust_platform(const std::vector< double > &in_policy) override
Adjust the platform settings based the policy from above.
Definition: FFNetAgent.cpp:206
bool do_write_batch(void) const override
Called by the Controller to decide whether to call write_batch() to update platform controls.
Definition: FFNetAgent.cpp:230
void sample_platform(std::vector< double > &out_sample) override
Read signals from the platform and interpret/aggregate these signals to create a sample which can be ...
Definition: FFNetAgent.cpp:236
std::vector< std::function< std::string(double)> > trace_formats(void) const override
Returns format string for each column added to the trace.
Definition: FFNetAgent.cpp:292
void validate_policy(std::vector< double > &in_policy) const override
Called by Controller to validate incoming policy values and configure defaults requested in incoming ...
Definition: FFNetAgent.cpp:154
void split_policy(const std::vector< double > &in_policy, std::vector< std::vector< double > > &out_policy) override
Called by Controller to split policy for children at next level down the tree.
Definition: FFNetAgent.cpp:180
void wait(void) override
Called by Controller to wait for sample period to elapse. This controls the cadence of the Controller...
Definition: FFNetAgent.cpp:244
static std::vector< std::string > sample_names(void)
Definition: FFNetAgent.cpp:255
std::vector< std::pair< std::string, std::string > > report_header(void) const override
Custom fields that will be added to the report header when this agent is used.
Definition: FFNetAgent.cpp:261
static std::string plugin_name(void)
Definition: FFNetAgent.cpp:122
static std::vector< std::string > policy_names(void)
Definition: FFNetAgent.cpp:250
static std::unique_ptr< Agent > make_plugin(void)
Definition: FFNetAgent.cpp:128
virtual ~FFNetAgent()=default
void init(int level, const std::vector< int > &fan_in, bool is_level_root) override
Set the level where this Agent is active and push signals/controls for that level.
Definition: FFNetAgent.cpp:134
bool do_send_policy(void) const override
Called by Controller to determine if new policy values should be sent down the tree to the Agent's ch...
Definition: FFNetAgent.cpp:189
FFNetAgent()
Definition: FFNetAgent.cpp:55
std::map< uint64_t, std::vector< std::pair< std::string, std::string > > > report_region(void) const override
Custom fields for each region in the report.
Definition: FFNetAgent.cpp:273
void enforce_policy(const std::vector< double > &policy) const override
Enforce the policy one time with PlatformIO::write_control(). Called to enforce static policies in th...
Definition: FFNetAgent.cpp:309
m_policy_e
Definition: FFNetAgent.hpp:30
@ M_POLICY_PERF_ENERGY_BIAS
Perf-energy-bias represents the user's desire to trade off performance for energy efficiency....
Definition: FFNetAgent.hpp:36
@ M_NUM_POLICY
Definition: FFNetAgent.hpp:37
std::vector< std::string > trace_names(void) const override
Column headers to be added to the trace.
Definition: FFNetAgent.cpp:279
std::vector< std::pair< std::string, std::string > > report_host(void) const override
Custom fields for the host section of the report.
Definition: FFNetAgent.cpp:266
bool do_send_sample(void) const override
Definition: FFNetAgent.cpp:201
Definition: Accumulator.cpp:12