6 #ifndef NVMLIOGROUP_HPP_INCLUDE
7 #define NVMLIOGROUP_HPP_INCLUDE
37 int push_signal(
const std::string &signal_name,
int domain_type,
int domain_idx)
override;
38 int push_control(
const std::string &control_name,
int domain_type,
int domain_idx)
override;
41 double sample(
int batch_idx)
override;
42 void adjust(
int batch_idx,
double setting)
override;
43 double read_signal(
const std::string &signal_name,
int domain_type,
int domain_idx)
override;
44 void write_control(
const std::string &control_name,
int domain_type,
int domain_idx,
double setting)
override;
47 std::function<double(
const std::vector<double> &)>
agg_function(
const std::string &signal_name)
const override;
48 std::function<std::string(
double)>
format_function(
const std::string &signal_name)
const override;
52 void save_control(
const std::string &save_path)
override;
54 std::string
name(
void)
const override;
56 static std::unique_ptr<geopm::IOGroup>
make_plugin(
void);
58 void register_signal_alias(
const std::string &alias_name,
const std::string &signal_name);
59 void register_control_alias(
const std::string &alias_name,
const std::string &control_name);
61 std::map<pid_t, double> gpu_process_map(
void)
const;
62 double cpu_gpu_affinity(
int cpu_idx, std::map<pid_t, double> process_map)
const;
64 static const std::string M_PLUGIN_NAME;
65 static const std::string M_NAME_PREFIX;
69 std::vector<double> m_frequency_max_control_request;
70 std::vector<double> m_frequency_min_control_request;
71 std::vector<double> m_initial_power_limit;
72 std::vector<std::vector<unsigned int> > m_supported_freq;
73 std::vector<double> m_frequency_step;
88 std::string m_description;
89 std::vector<std::shared_ptr<signal_s> > signals;
91 std::function<double(
const std::vector<double> &)>
agg_function;
97 std::string m_description;
98 std::vector<std::shared_ptr<control_s> > controls;
100 std::function<double(
const std::vector<double> &)>
agg_function;
104 std::map<std::string, signal_info> m_signal_available;
105 std::map<std::string, control_info> m_control_available;
106 std::vector<std::shared_ptr<signal_s> > m_signal_pushed;
107 std::vector<std::shared_ptr<control_s> > m_control_pushed;
109 std::shared_ptr<SaveControl> m_mock_save_ctl;
Definition: IOGroup.hpp:21
Definition: NVMLDevicePool.hpp:19
IOGroup that provides signals and controls for NVML GPUs.
Definition: NVMLIOGroup.hpp:24
NVMLIOGroup()
Definition: NVMLIOGroup.cpp:33
bool is_valid_signal(const std::string &signal_name) const override
Test if signal_name refers to a signal supported by the group.
Definition: NVMLIOGroup.cpp:361
void adjust(int batch_idx, double setting) override
Adjust a setting for a particular control that was previously pushed with push_control()....
Definition: NVMLIOGroup.cpp:609
std::string name(void) const override
Get the IOGroup name.
Definition: NVMLIOGroup.cpp:893
double read_signal(const std::string &signal_name, int domain_type, int domain_idx) override
Read from platform and interpret into SI units a signal given its name and domain....
Definition: NVMLIOGroup.cpp:621
virtual ~NVMLIOGroup()=default
std::function< double(const std::vector< double > &)> agg_function(const std::string &signal_name) const override
Return a function that should be used when aggregating the given signal.
Definition: NVMLIOGroup.cpp:804
int push_signal(const std::string &signal_name, int domain_type, int domain_idx) override
Add a signal to the list of signals that is read by read_batch() and sampled by sample().
Definition: NVMLIOGroup.cpp:395
int push_control(const std::string &control_name, int domain_type, int domain_idx) override
Add a control to the list of controls that is written by write_batch() and configured with adjust().
Definition: NVMLIOGroup.cpp:439
std::function< std::string(double)> format_function(const std::string &signal_name) const override
Returns a function that can be used to convert a signal of the given name into a printable string....
Definition: NVMLIOGroup.cpp:816
bool is_valid_control(const std::string &control_name) const override
Test if control_name refers to a control supported by the group.
Definition: NVMLIOGroup.cpp:367
void restore_control(void) override
Restore all controls to values recorded in previous call to the save() method.
Definition: NVMLIOGroup.cpp:781
static std::string plugin_name(void)
Definition: NVMLIOGroup.cpp:899
std::set< std::string > control_names(void) const override
Returns the names of all controls provided by the IOGroup.
Definition: NVMLIOGroup.cpp:351
std::string signal_description(const std::string &signal_name) const override
Returns a description of the signal. This string can be used by tools to generate help text for users...
Definition: NVMLIOGroup.cpp:828
int control_domain_type(const std::string &control_name) const override
Query the domain for a named control.
Definition: NVMLIOGroup.cpp:384
void save_control(void) override
Save the state of all controls so that any subsequent changes made through the IOGroup can be undone ...
Definition: NVMLIOGroup.cpp:771
std::string control_description(const std::string &control_name) const override
Returns a description of the control. This string can be used by tools to generate help text for user...
Definition: NVMLIOGroup.cpp:839
std::set< std::string > signal_names(void) const override
Returns the names of all signals provided by the IOGroup.
Definition: NVMLIOGroup.cpp:341
static std::unique_ptr< geopm::IOGroup > make_plugin(void)
Definition: NVMLIOGroup.cpp:905
void write_batch(void) override
Write all of the pushed controls so that values previously given to adjust() are written to the platf...
Definition: NVMLIOGroup.cpp:558
int signal_behavior(const std::string &signal_name) const override
Returns a hint about how a signal will change as a function of time.
Definition: NVMLIOGroup.cpp:850
void read_batch(void) override
Read all pushed signals from the platform so that the next call to sample() will reflect the updated ...
Definition: NVMLIOGroup.cpp:529
double sample(int batch_idx) override
Retrieve signal value from data read by last call to read_batch() for a particular signal previously ...
Definition: NVMLIOGroup.cpp:593
void write_control(const std::string &control_name, int domain_type, int domain_idx, double setting) override
Interpret the setting and write setting to the platform. Does not modify the values stored by calling...
Definition: NVMLIOGroup.cpp:716
int signal_domain_type(const std::string &signal_name) const override
Query the domain for a named signal.
Definition: NVMLIOGroup.cpp:373
const PlatformTopo & platform_topo(void)
Definition: PlatformTopo.cpp:81