[SWDEV-512393] Added amdsmi_get_cpu_affinity_with_scope (#198)

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Signed-off-by: Deepak Mewar <deepak.mewar@amd.com>
このコミットが含まれているのは:
Mewar, Deepak
2025-05-20 11:36:09 +05:30
committed by GitHub
コミット b999f86611
15個のファイルの変更、524行の追加、39行の削除
+1
ファイルの表示
@@ -73,6 +73,7 @@ class AMDSmiGPUDevice: public AMDSmiProcessor {
// New methods for -e feature
std::string bdf_to_string() const; // -e feature
std::vector<uint64_t> get_bitmask_from_numa_node(int32_t node_id, uint32_t size) const;
private:
uint32_t gpu_id_;
+6
ファイルの表示
@@ -25,6 +25,7 @@
#include <vector>
#include <set>
#include <map>
#include "amd_smi/amdsmi.h"
#include "amd_smi/impl/amd_smi_socket.h"
#include "amd_smi/impl/amd_smi_processor.h"
@@ -60,6 +61,11 @@ class AMDSmiSystem {
amdsmi_status_t get_cpu_model_name(uint32_t socket_id, std::string *model_name);
std::map<uint32_t, uint32_t> get_sys_cpu_cores_per_socket() ;
amdsmi_status_t get_sys_num_of_cpu_sockets(uint32_t *sock_num);
std::vector<uint32_t> get_cpu_sockets_from_numa_node(int32_t numa_node);
private:
AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {}
+16
ファイルの表示
@@ -23,10 +23,12 @@
#ifndef AMD_SMI_INCLUDE_AMD_SMI_UTILS_H_
#define AMD_SMI_INCLUDE_AMD_SMI_UTILS_H_
#include <dirent.h>
#include <limits>
#include <type_traits>
#include <string>
#include <utility>
#include <functional>
#include "amd_smi/amdsmi.h"
#include "amd_smi/impl/amd_smi_gpu_device.h"
@@ -176,4 +178,18 @@ constexpr T translate_umax_or_assign_value(U source_value, V target_value)
return result;
}
/**
* @brief Iterates all entires in a directory .
*
* @details Given a directory in const std::string & base_path, and a callback function
* entry_callback, this function will open the directory and iterate through all entires
* in that directory. For each entry it will call the entry_callback function with the
* path of that entry
*
* @param[in] base_path the path of the directory to iterate in
*
* @retval ::true if the iteration was successful
* ::false if the iteration failed
*/
bool iterate_directory(const std::string &base_path, std::function<void(const std::string &)> entry_callback);
#endif // AMD_SMI_INCLUDE_AMD_SMI_UTILS_H_