geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
DCGMDevicePoolImp.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 DCGMDEVICEPOOLIMP_HPP_INCLUDE
7 #define DCGMDEVICEPOOLIMP_HPP_INCLUDE
8 
9 #include <vector>
10 
11 #include "dcgm_agent.h"
12 #include "dcgm_structs.h"
13 
14 #include "DCGMDevicePool.hpp"
15 
16 namespace geopm
17 {
19  {
20  public:
22  virtual ~DCGMDevicePoolImp();
23 
24  virtual int num_device() const override;
25  virtual double sample(int gpu_idx, int field_id) const override;
26  virtual void update(int gpu_idx) override;
27  virtual void update_rate(int field_update_rate) override;
28  virtual void max_storage_time(int max_storage_time) override;
29  virtual void max_samples(int max_samples) override;
30  virtual void polling_enable(void) override;
31  virtual void polling_disable(void) override;
32 
33  private:
34  virtual void check_result(const dcgmReturn_t result, const std::string error, const int line);
35 
36  long long m_update_freq;
37  double m_max_keep_age;
38  int m_max_keep_sample;
39  int m_dcgm_dev_count;
40  bool m_dcgm_polling;
41 
42  dcgmHandle_t m_dcgm_handle;
43  dcgmFieldGrp_t m_field_group_id;
44 
45  unsigned short m_dcgm_field_ids[M_NUM_FIELD_ID];
46 
47  // GPU indexed vector of vector of field values
48  std::vector<std::vector<dcgmFieldValue_v1>> m_dcgm_field_values;
49  };
50 }
51 #endif
Definition: DCGMDevicePool.hpp:17
@ M_NUM_FIELD_ID
Number of valid field ids.
Definition: DCGMDevicePool.hpp:35
Definition: DCGMDevicePoolImp.hpp:19
virtual void update(int gpu_idx) override
Query DCGM for the latest value for an GPU. Note that this is the last value DCGM cached....
Definition: DCGMDevicePool.cpp:110
virtual int num_device() const override
Number of GPUs that support DCGM on the platform.
Definition: DCGMDevicePool.cpp:95
virtual void polling_disable(void) override
Disable DCGM data polling through calling unwatchfields.
Definition: DCGMDevicePool.cpp:162
virtual void max_samples(int max_samples) override
Set maximum samples to store for for DCGM devices. This is the maximum number of DCGM samples that wi...
Definition: DCGMDevicePool.cpp:135
DCGMDevicePoolImp()
Definition: DCGMDevicePool.cpp:24
virtual void polling_enable(void) override
Enable DCGM data polling through setting the watch fields.
Definition: DCGMDevicePool.cpp:141
virtual void max_storage_time(int max_storage_time) override
Set maximum storage time for for DCGM devices. This is the maximum time a DCGM sample will be kept.
Definition: DCGMDevicePool.cpp:129
virtual double sample(int gpu_idx, int field_id) const override
Get the value for the provided geopm_field_id.
Definition: DCGMDevicePool.cpp:100
virtual ~DCGMDevicePoolImp()
Definition: DCGMDevicePool.cpp:79
virtual void update_rate(int field_update_rate) override
Set field update rate for DCGM devices. This is the rate.
Definition: DCGMDevicePool.cpp:123
Definition: Agg.cpp:20