diff --git a/include/rocm_smi/rocm_smi.h b/include/rocm_smi/rocm_smi.h index 9c353980af..1c19e4a3ee 100755 --- a/include/rocm_smi/rocm_smi.h +++ b/include/rocm_smi/rocm_smi.h @@ -446,7 +446,7 @@ rsmi_status_t rsmi_dev_gpu_clk_freq_set(uint32_t dv_ind, * @param[in] dv_ind a device index * * @param[inout] name a pointer to a caller provided char buffer to which the - * speed will be written + * name will be written * * @param[in] len the length of the caller provided buffer @p name. * @@ -588,7 +588,7 @@ rsmi_status_t rsmi_dev_fan_speed_set(uint32_t dv_ind, uint32_t sensor_ind, * * @details Given a device index @p dv_ind and a pointer to a uint64_t * @p power, this function will write the current average power consumption to - * the uint64_t in milliwatts pointed to by @p power. This function requires + * the uint64_t in microwatts pointed to by @p power. This function requires * root privilege. * * @param[in] dv_ind a device index diff --git a/include/rocm_smi/rocm_smi_monitor.h b/include/rocm_smi/rocm_smi_monitor.h index 68ca4921e2..217c600091 100755 --- a/include/rocm_smi/rocm_smi_monitor.h +++ b/include/rocm_smi/rocm_smi_monitor.h @@ -63,6 +63,7 @@ enum MonitorTypes { kMonPowerCap, kMonPowerCapMax, kMonPowerCapMin, + kMonPowerAve, kMonTempMax, kMonTempMin, kMonTempMaxHyst, diff --git a/include/rocm_smi/rocm_smi_power_mon.h b/include/rocm_smi/rocm_smi_power_mon.h index fff1bbb819..71e4c0865e 100755 --- a/include/rocm_smi/rocm_smi_power_mon.h +++ b/include/rocm_smi/rocm_smi_power_mon.h @@ -55,7 +55,6 @@ namespace smi { enum PowerMonTypes { kPowerMaxGPUPower, - kPowerAveGPUPower, }; diff --git a/src/rocm_smi.cc b/src/rocm_smi.cc index 6678b2644f..f772c13753 100755 --- a/src/rocm_smi.cc +++ b/src/rocm_smi.cc @@ -851,11 +851,10 @@ rsmi_dev_power_ave_get(uint32_t dv_ind, uint32_t sensor_ind, uint64_t *power) { if (power == nullptr) { return RSMI_STATUS_INVALID_ARGS; } - (void)sensor_ind; // Not used yet - // ++sensor_ind; // power sysfs files have 1-based indices + ++sensor_ind; // power sysfs files have 1-based indices rsmi_status_t ret; - ret = get_power_mon_value(amd::smi::kPowerAveGPUPower, dv_ind, power); + ret = get_dev_mon_value(amd::smi::kMonPowerAve, dv_ind, sensor_ind, power); return ret; CATCH diff --git a/src/rocm_smi_monitor.cc b/src/rocm_smi_monitor.cc index 81dc0f097f..ed64e29de6 100755 --- a/src/rocm_smi_monitor.cc +++ b/src/rocm_smi_monitor.cc @@ -74,7 +74,7 @@ static const char *kMonNameFName = "name"; static const char *kMonPowerCapName = "power#_cap"; static const char *kMonPowerCapMaxName = "power#_cap_max"; static const char *kMonPowerCapMinName = "power#_cap_min"; - +static const char *kMonPowerAveName = "power#_average"; static const char *kMonTempMaxName = "temp#_max"; static const char *kMonTempMinName = "temp#_min"; static const char *kMonTempMaxHystName = "temp#_max_hyst"; @@ -99,6 +99,7 @@ static const std::map kMonitorNameMap = { {kMonPowerCap, kMonPowerCapName}, {kMonPowerCapMax, kMonPowerCapMaxName}, {kMonPowerCapMin, kMonPowerCapMinName}, + {kMonPowerAve, kMonPowerAveName}, {kMonTempMax, kMonTempMaxName}, {kMonTempMin, kMonTempMinName}, {kMonTempMaxHyst, kMonTempMaxHystName}, diff --git a/src/rocm_smi_power_mon.cc b/src/rocm_smi_power_mon.cc index 27dec0d7a9..cab97d8188 100755 --- a/src/rocm_smi_power_mon.cc +++ b/src/rocm_smi_power_mon.cc @@ -66,7 +66,6 @@ static const char *kPowerMonPMName = "amdgpu_pm_info"; // Using this map in case we add other files from dri directory to parse. static const std::map kMonitorNameMap = { {kPowerMaxGPUPower, kPowerMonPMName}, - {kPowerAveGPUPower, kPowerMonPMName}, }; PowerMon::PowerMon(std::string path, RocmSMI_env_vars const *e) : @@ -87,10 +86,6 @@ static int parse_power_str(std::string s, PowerMonTypes type, uint64_t *val) { search_str = "(max GPU)"; break; - case kPowerAveGPUPower: - search_str = "(average GPU)"; - break; - default: assert(!"Invalid search Power type requested"); return EINVAL; @@ -118,7 +113,6 @@ static int parse_power_str(std::string s, PowerMonTypes type, uint64_t *val) { switch (type) { case kPowerMaxGPUPower: - case kPowerAveGPUPower: l_ss >> num_units; l_ss >> sz; assert(sz == "W"); // We only expect Watts at this time diff --git a/tests/rocm_smi_test/functional/rsmi_sanity.cc b/tests/rocm_smi_test/functional/rsmi_sanity.cc index d5c88de4ce..0ca4aadda2 100755 --- a/tests/rocm_smi_test/functional/rsmi_sanity.cc +++ b/tests/rocm_smi_test/functional/rsmi_sanity.cc @@ -641,8 +641,8 @@ void TestSanity::Run(void) { std::cout << "\t**Power Cap Range: " << val2_ui64 << " to " << val_ui64 << " uW" << std::endl; } -#if 0 // Same as above (disable for now) - err = rsmi_dev_power_ave_get(i, &val_ui64); + + err = rsmi_dev_power_ave_get(i, 0, &val_ui64); IF_VERB(STANDARD) { std::cout << "\t**Averge Power Usage: "; CHK_RSMI_PERM_ERR(err) @@ -651,7 +651,6 @@ void TestSanity::Run(void) { } std::cout << "\t=======" << std::endl; } -#endif } IF_VERB(STANDARD) { std::cout << "***** Testing write api's" << std::endl; diff --git a/tests/rocm_smi_test/functional/rsmi_sanity.h b/tests/rocm_smi_test/functional/rsmi_sanity.h index 7cf3f0f81b..b6ab2addcb 100755 --- a/tests/rocm_smi_test/functional/rsmi_sanity.h +++ b/tests/rocm_smi_test/functional/rsmi_sanity.h @@ -42,8 +42,8 @@ * DEALINGS WITH THE SOFTWARE. * */ -#ifndef ROCM_SMI_LIB_TESTS_ROCM_SMI_TEST_FUNCTIONAL_RSMI_SANITY_H_ -#define ROCM_SMI_LIB_TESTS_ROCM_SMI_TEST_FUNCTIONAL_RSMI_SANITY_H_ +#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_RSMI_SANITY_H_ +#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_RSMI_SANITY_H_ #include "rocm_smi_test/test_base.h" @@ -70,4 +70,4 @@ class TestSanity : public TestBase { virtual void DisplayTestInfo(void); }; -#endif // ROCM_SMI_LIB_TESTS_ROCM_SMI_TEST_FUNCTIONAL_RSMI_SANITY_H_ +#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_RSMI_SANITY_H_