geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
NVMLDevicePoolImp.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef NVMLDEVICEPOOLIMP_HPP_INCLUDE
7 #define NVMLDEVICEPOOLIMP_HPP_INCLUDE
8 
9 #include "NVMLDevicePool.hpp"
10 
11 namespace geopm
12 {
13 
15  {
16  public:
17  NVMLDevicePoolImp(const int num_cpu);
18  virtual ~NVMLDevicePoolImp();
19  virtual int num_gpu(void) const override;
20  virtual std::unique_ptr<cpu_set_t, std::function<void(cpu_set_t *)> >
21  cpu_affinity_ideal_mask(int gpu_idx) const override;
22  virtual uint64_t frequency_status_sm(int gpu_idx) const override;
23  virtual std::vector<unsigned int> frequency_supported_sm(int gpu_idx) const override;
24  virtual uint64_t utilization(int gpu_idx) const override;
25  virtual uint64_t power(int gpu_idx) const override;
26  virtual uint64_t power_limit(int gpu_idx) const override;
27  virtual uint64_t frequency_status_mem(int gpu_idx) const override;
28  virtual uint64_t throttle_reasons(int gpu_idx) const override;
29  virtual uint64_t temperature(int gpu_idx) const override;
30  virtual uint64_t energy(int gpu_idx) const override;
31  virtual uint64_t performance_state(int gpu_idx) const override;
32  virtual uint64_t throughput_rx_pcie(int gpu_idx) const override;
33  virtual uint64_t throughput_tx_pcie(int gpu_idx) const override;
34  virtual uint64_t utilization_mem(int gpu_idx) const override;
35  virtual std::vector<int> active_process_list(int gpu_idx) const override;
36 
37  virtual void frequency_control_sm(int gpu_idx, int min_freq, int max_freq) const override;
38  virtual void frequency_reset_control(int gpu_idx) const override;
39  virtual void power_control(int gpu_idx, int setting) const override;
40  virtual bool is_privileged_access(void) const override;
41  virtual void reset(void) override;
42 
43  private:
44  const unsigned int M_MAX_CONTEXTS;
45  const unsigned int M_MAX_FREQUENCIES;
46  const unsigned int M_NUM_CPU;
47  void check_gpu_range(int gpu_idx) const;
48  void check_nvml_result(nvmlReturn_t nvml_result, int error, const std::string &message, int line) const;
49  unsigned int m_num_gpu;
50  std::vector<nvmlDevice_t> m_nvml_device;
51  };
52 }
53 #endif
Definition: NVMLDevicePool.hpp:19
Definition: NVMLDevicePoolImp.hpp:15
virtual int num_gpu(void) const override
Number of GPUs on the platform.
Definition: NVMLDevicePool.cpp:85
virtual std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > cpu_affinity_ideal_mask(int gpu_idx) const override
CPU Affinitization mask for a particular GPU.
Definition: NVMLDevicePool.cpp:100
NVMLDevicePoolImp(const int num_cpu)
Definition: NVMLDevicePool.cpp:32
virtual std::vector< unsigned int > frequency_supported_sm(int gpu_idx) const override
Get the supported NVML device streaming multiprocessor frequencies in MHz.
Definition: NVMLDevicePool.cpp:133
virtual uint64_t utilization(int gpu_idx) const override
Get the NVML device utilization metric.
Definition: NVMLDevicePool.cpp:157
virtual std::vector< int > active_process_list(int gpu_idx) const override
Get the list of PIDs with an active context on an NVML device.
Definition: NVMLDevicePool.cpp:299
virtual uint64_t power(int gpu_idx) const override
Get the NVML device power in milliwatts.
Definition: NVMLDevicePool.cpp:169
virtual uint64_t throttle_reasons(int gpu_idx) const override
Get the current NVML device clock throttle reasons.
Definition: NVMLDevicePool.cpp:208
virtual uint64_t performance_state(int gpu_idx) const override
Get the current performance state of an NVML device.
Definition: NVMLDevicePool.cpp:247
virtual uint64_t frequency_status_mem(int gpu_idx) const override
Get the NVML device memory subsystem frequency in MHz.
Definition: NVMLDevicePool.cpp:195
virtual uint64_t utilization_mem(int gpu_idx) const override
Get the NVML device memory Utilization metric.
Definition: NVMLDevicePool.cpp:286
virtual uint64_t energy(int gpu_idx) const override
Get the total energy consumed counter value for an NVML device in millijoules.
Definition: NVMLDevicePool.cpp:234
virtual void reset(void) override
Definition: NVMLDevicePool.cpp:40
virtual uint64_t power_limit(int gpu_idx) const override
Get the NVML device power limit in milliwatts.
Definition: NVMLDevicePool.cpp:182
virtual void power_control(int gpu_idx, int setting) const override
Set power limit for NVML device.
Definition: NVMLDevicePool.cpp:364
virtual uint64_t frequency_status_sm(int gpu_idx) const override
Get the NVML device streaming multiprocessor frequency in MHz.
Definition: NVMLDevicePool.cpp:120
virtual bool is_privileged_access(void) const override
Definition: NVMLDevicePool.cpp:374
virtual void frequency_control_sm(int gpu_idx, int min_freq, int max_freq) const override
Set min and max frequency for NVML device.
Definition: NVMLDevicePool.cpp:344
virtual uint64_t temperature(int gpu_idx) const override
Get the current NVML device temperature.
Definition: NVMLDevicePool.cpp:221
virtual uint64_t throughput_rx_pcie(int gpu_idx) const override
Get the pcie receive throughput over a 20ms period for an NVML device.
Definition: NVMLDevicePool.cpp:260
virtual ~NVMLDevicePoolImp()
Definition: NVMLDevicePool.cpp:65
virtual uint64_t throughput_tx_pcie(int gpu_idx) const override
Get the pcie transmit throughput over a 20ms period for an NVML device.
Definition: NVMLDevicePool.cpp:273
virtual void frequency_reset_control(int gpu_idx) const override
Reset min and max frequency for NVML device.
Definition: NVMLDevicePool.cpp:354
Definition: Agg.cpp:20