Merge pull request #819 from kalkafox/rsmi-pwr-usage-fix

fix pwr_usage not being defined correctly during rsmi collection
This commit is contained in:
Jakob P. Liljenberg 2024-04-28 22:45:42 +02:00 committed by GitHub
commit 924c3f3a72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1507,7 +1507,10 @@ namespace Gpu {
if (result != RSMI_STATUS_SUCCESS) {
Logger::warning("ROCm SMI: Failed to get GPU power usage");
if constexpr(is_init) gpus_slice[i].supported_functions.pwr_usage = false;
} else gpus_slice[i].gpu_percent.at("gpu-pwr-totals").push_back(clamp((long long)round((double)gpus_slice[i].pwr_usage * 100.0 / (double)gpus_slice[i].pwr_max_usage), 0ll, 100ll));
} else {
gpus_slice[i].pwr_usage = (long long)power / 1000;
gpus_slice[i].gpu_percent.at("gpu-pwr-totals").push_back(clamp((long long)round((double)gpus_slice[i].pwr_usage * 100.0 / (double)gpus_slice[i].pwr_max_usage), 0ll, 100ll));
}
if constexpr(is_init) gpus_slice[i].supported_functions.pwr_state = false;
}