diff --git a/projects/amdsmi/include/rocm_smi/rocm_smi_common.h b/projects/amdsmi/include/rocm_smi/rocm_smi_common.h index 98a2df5c62..dad39ad13f 100755 --- a/projects/amdsmi/include/rocm_smi/rocm_smi_common.h +++ b/projects/amdsmi/include/rocm_smi/rocm_smi_common.h @@ -133,8 +133,16 @@ std::endl;\ } +#define DEBUG_LOG(WR_STR, VR) \ + amd::smi::RocmSMI& smi = amd::smi::RocmSMI::getInstance(); \ + if (smi.getEnv().debug_output_bitfield & RSMI_DEBUG_VAL) { \ + if ((WR_STR) != nullptr) \ + std::cout << (WR_STR) << " " << (VR) << std::endl;\ + } + // Add different debug filters here, as powers of 2; e.g, 1, 2, 4, 8, ... -#define RSMI_DEBUG_SYSFS_FILE_PATHS 1 +#define RSMI_DEBUG_SYSFS_FILE_PATHS 1<<0 +#define RSMI_DEBUG_VAL 1<<1 struct rsmi_func_id_iter_handle { uintptr_t func_id_iter; diff --git a/projects/amdsmi/include/rocm_smi/rocm_smi_main.h b/projects/amdsmi/include/rocm_smi/rocm_smi_main.h index b8141b4568..126bbd7436 100755 --- a/projects/amdsmi/include/rocm_smi/rocm_smi_main.h +++ b/projects/amdsmi/include/rocm_smi/rocm_smi_main.h @@ -112,6 +112,7 @@ class RocmSMI { int get_io_link_weight(uint32_t node_from, uint32_t node_to, uint64_t *weight); int get_node_index(uint32_t dv_ind, uint32_t *node_ind); + const RocmSMI_env_vars& getEnv(void); private: std::vector> devices_; diff --git a/projects/amdsmi/src/rocm_smi_main.cc b/projects/amdsmi/src/rocm_smi_main.cc index 2d51333c91..40541d9280 100755 --- a/projects/amdsmi/src/rocm_smi_main.cc +++ b/projects/amdsmi/src/rocm_smi_main.cc @@ -376,6 +376,10 @@ void RocmSMI::GetEnvVariables(void) { #endif } +const RocmSMI_env_vars& RocmSMI::getEnv(void) { + return env_vars_; +} + std::shared_ptr RocmSMI::FindMonitor(std::string monitor_path) { std::string tmp;