Adjusted power limits
Signed-off-by: Maisam Arif <maisarif@amd.com> Change-Id: I8586c4a6c9d0a6a05003013c702f88cc42d05114
This commit is contained in:
@@ -288,12 +288,16 @@ class AMDSMICommands():
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
if args.limit:
|
||||
# Power limits
|
||||
try:
|
||||
power_limit_error = False
|
||||
power_limit = amdsmi_interface.amdsmi_get_power_info(args.gpu)['power_limit']
|
||||
power_info = amdsmi_interface.amdsmi_get_power_cap_info(args.gpu)
|
||||
max_power_limit = power_info['max_power_cap']
|
||||
current_power_limit = power_info['power_cap']
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
power_limit_error = True
|
||||
power_limit = e.get_error_info()
|
||||
max_power_limit = e.get_error_info()
|
||||
current_power_limit = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
|
||||
@@ -334,7 +338,8 @@ class AMDSMICommands():
|
||||
if self.logger.is_human_readable_format():
|
||||
unit = 'W'
|
||||
if not power_limit_error:
|
||||
power_limit = f"{power_limit} {unit}"
|
||||
max_power_limit = f"{max_power_limit} {unit}"
|
||||
current_power_limit = f"{current_power_limit} {unit}"
|
||||
|
||||
unit = '\N{DEGREE SIGN}C'
|
||||
if not temp_edge_limit_error:
|
||||
@@ -345,10 +350,9 @@ class AMDSMICommands():
|
||||
temp_vram_limit = f"{temp_vram_limit} {unit}"
|
||||
|
||||
limit_info = {}
|
||||
limit_info['power'] = power_limit
|
||||
limit_info['edge_temperature'] = temp_edge_limit
|
||||
limit_info['hotspot_temperature'] = temp_hotspot_limit
|
||||
limit_info['vram_temperature'] = temp_vram_limit
|
||||
# Power limits
|
||||
limit_info['max_power'] = max_power_limit
|
||||
limit_info['current_power'] = current_power_limit
|
||||
|
||||
static_dict['limit'] = limit_info
|
||||
if args.driver:
|
||||
|
||||
@@ -1101,9 +1101,16 @@ amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle,
|
||||
if ((status == AMDSMI_STATUS_SUCCESS) && !set_ret_success)
|
||||
set_ret_success = true;
|
||||
|
||||
// Dividing by 1000000 to get measurement in Watts
|
||||
(info->default_power_cap) /= 1000000;
|
||||
|
||||
status = rsmi_wrapper(rsmi_dev_power_cap_range_get, processor_handle, sensor_ind,
|
||||
&(info->max_power_cap), &(info->min_power_cap));
|
||||
|
||||
// Dividing by 1000000 to get measurement in Watts
|
||||
(info->max_power_cap) /= 1000000;
|
||||
(info->min_power_cap) /= 1000000;
|
||||
|
||||
if ((status == AMDSMI_STATUS_SUCCESS) && !set_ret_success)
|
||||
set_ret_success = true;
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ amdsmi_status_t smi_amdgpu_get_power_cap(amd::smi::AMDSmiGPUDevice* device, int
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fullpath += "/power1_cap_max";
|
||||
fullpath += "/power1_cap";
|
||||
std::ifstream file(fullpath.c_str(), std::ifstream::in);
|
||||
if (!file.is_open()) {
|
||||
return AMDSMI_STATUS_API_FAILED;
|
||||
|
||||
Reference in New Issue
Block a user