geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
DrmGpuTopo.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 DRMGPUTOPO_HPP_INCLUDE
7 #define DRMGPUTOPO_HPP_INCLUDE
8 
9 #include <vector>
10 #include <set>
11 #include <string>
12 
13 #include "GPUTopo.hpp"
14 
15 namespace geopm
16 {
17  class DrmGpuTopo : public GPUTopo
18  {
19  public:
20  DrmGpuTopo() = delete;
21  DrmGpuTopo(const std::string &drm_directory);
22  virtual ~DrmGpuTopo() = default;
23  int num_gpu(void) const override;
24  int num_gpu(int domain) const override;
25  std::set<int> cpu_affinity_ideal(int gpu_idx) const override;
26  std::set<int> cpu_affinity_ideal(int domain, int gpu_idx) const override;
27  std::string gt_path(int gpu_chip_idx) const;
28  std::string card_path(int gpu_idx) const;
29  std::string driver_name() const;
30  private:
31  // Name of the driver that this DrmGpuTopo maps
32  std::string m_driver_name;
33  // Map of (gpu index) -> (drm card path)
34  std::vector<std::string> m_card_paths;
35  // Map of (gpu_chip index) -> (drm gt path)
36  std::vector<std::string> m_gt_paths;
37  // Map of (gpu index) -> (set of local cpu indices)
38  std::vector<std::set<int> > m_cpu_affinity_by_gpu;
39  // Map of (gpu_chip index) -> (gpu index)
40  std::vector<int> m_gpu_by_gpu_chip;
41  };
42 }
43 #endif
Definition: DrmGpuTopo.hpp:18
std::set< int > cpu_affinity_ideal(int gpu_idx) const override
CPU Affinitization set for a particular GPU.
Definition: DrmGpuTopo.cpp:192
std::string card_path(int gpu_idx) const
Definition: DrmGpuTopo.cpp:234
std::string driver_name() const
Definition: DrmGpuTopo.cpp:244
std::string gt_path(int gpu_chip_idx) const
Definition: DrmGpuTopo.cpp:224
int num_gpu(void) const override
Number of GPUs on the platform.
Definition: DrmGpuTopo.cpp:170
virtual ~DrmGpuTopo()=default
Definition: GPUTopo.hpp:16
Definition: Agg.cpp:20