geopm 3.1.1.dev456+g3ba31824
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
PlatformTopoImp.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
7#ifndef PLATFORMTOPOIMP_HPP_INCLUDE
8#define PLATFORMTOPOIMP_HPP_INCLUDE
9
11#include <vector>
12#include <map>
13#include <memory>
14
15namespace geopm
16{
17 class GPUTopo;
18 class ServiceProxy;
19
21 {
22 public:
24 PlatformTopoImp(const std::string &test_cache_file_name,
25 std::shared_ptr<ServiceProxy> service_proxy);
26 virtual ~PlatformTopoImp() = default;
27 int num_domain(int domain_type) const override;
28 int domain_idx(int domain_type,
29 int cpu_idx) const override;
30 bool is_nested_domain(int inner_domain, int outer_domain) const override;
31 std::set<int> domain_nested(int inner_domain, int outer_domain, int outer_idx) const override;
32 static void create_cache();
33 static void create_cache(const std::string &cache_file_name);
34 static void create_cache(const std::string &cache_file_name, const GPUTopo &gtopo);
35 private:
36 static const std::string M_CACHE_FILE_NAME;
37 static const std::string M_SERVICE_CACHE_FILE_NAME;
40 std::set<int> domain_cpus(int domain_type,
41 int domain_idx) const;
42
43 void lscpu(std::map<std::string, std::string> &lscpu_map);
44 void parse_lscpu(const std::map<std::string, std::string> &lscpu_map,
45 int &num_package,
46 int &core_per_package,
47 int &thread_per_core);
48 std::vector<std::set<int> > parse_lscpu_numa(const std::map<std::string, std::string> &lscpu_map);
49 std::vector<std::set<int> > parse_lscpu_gpu(const std::map<std::string, std::string> &lscpu_map, int domain_type);
50 std::string read_lscpu(void);
51 static bool check_file(const std::string &file_name);
52 static std::string gpu_short_name(int domain_type);
53 static std::unique_ptr<ServiceProxy> try_service_proxy(void);
54 const std::string M_TEST_CACHE_FILE_NAME;
55 int m_num_package;
56 int m_core_per_package;
57 int m_thread_per_core;
58 std::vector<std::set<int> > m_numa_map;
59 std::map<int, std::vector<std::set<int> > > m_gpu_info;
60 std::shared_ptr<ServiceProxy> m_service_proxy;
61 };
62}
63#endif
Definition GPUTopo.hpp:16
Definition PlatformTopo.hpp:28
Definition PlatformTopoImp.hpp:21
bool is_nested_domain(int inner_domain, int outer_domain) const override
Check if one domain type is contained in another.
Definition PlatformTopo.cpp:309
virtual ~PlatformTopoImp()=default
int num_domain(int domain_type) const override
Number of domains on the platform of a particular geopm_domain_e type.
Definition PlatformTopo.cpp:126
std::set< int > domain_nested(int inner_domain, int outer_domain, int outer_idx) const override
Get the set of smaller domains contained in a larger one. If the inner domain is not the same as or c...
Definition PlatformTopo.cpp:359
static void create_cache()
Definition PlatformTopo.cpp:425
PlatformTopoImp()
Definition PlatformTopo.cpp:87
int domain_idx(int domain_type, int cpu_idx) const override
Get the domain index for a particular domain type that contains the given Linux logical CPU index.
Definition PlatformTopo.cpp:238
Definition Agg.cpp:20