Skip to content

Commit

Permalink
Disable clock and voltage range reading/displaying when pp_od_clk_vol…
Browse files Browse the repository at this point in the history
…tage reading is not possible
  • Loading branch information
Ricks-Lab committed Jun 1, 2022
1 parent 68a2a77 commit 02a0174
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
24 changes: 15 additions & 9 deletions GPUmodules/GPUmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,18 +709,20 @@ def param_is_active(self, parameter_name: str) -> bool:
if parameter_name in self.read_skip: return False
return True

def disable_param_read(self, parameter_name: str) -> None:
def disable_param_read(self, parameter_name: Union[Tuple[str, ...], str, None]) -> None:
"""
Disable further reading of the specified parameter.
:param parameter_name:
:param parameter_name: A single parameter name to be disabled.
:return:
"""
if self.param_is_active(parameter_name):
message = 'Warning: Can not read parameter: {}, ' \
'disabling for this GPU: {}'.format(parameter_name, self.prm.card_num)
env.GUT_CONST.process_message(message, log_flag=True)
self.read_disabled.append(parameter_name)
if isinstance(parameter_name, str): parameter_name = (parameter_name, )
for target_param in parameter_name:
if self.param_is_active(target_param):
message = 'Warning: Can not read parameter: {}, ' \
'disabling for this GPU: {}'.format(target_param, self.prm.card_num)
env.GUT_CONST.process_message(message, log_flag=True)
self.read_disabled.append(target_param)

def get_params_value(self, name: str, num_as_int: bool = False) -> Union[int, float, str, list, None, datetime]:
"""
Expand Down Expand Up @@ -2177,7 +2179,8 @@ def set_gpu_list(self, clinfo_flag: bool = False) -> bool:
pp_od_file_details = file_ptr.read()
except OSError as except_err:
pp_od_file_details = '{} not readable'.format(pp_od_clk_voltage_file)
self[gpu_uuid].disable_param_read('pp_od_clk_voltage')
self[gpu_uuid].disable_param_read(('pp_od_clk_voltage', 'sclk_f_range',
'mclk_f_range', 'vddc_range'))
message = 'Error: system support issue for {}: [{}]'.format(pcie_id, except_err)
LOGGER.debug(message)
print(message)
Expand All @@ -2186,7 +2189,8 @@ def set_gpu_list(self, clinfo_flag: bool = False) -> bool:
else:
LOGGER.debug('%s exists, opened, and read.', pp_od_clk_voltage_file)
if not pp_od_file_details:
self[gpu_uuid].disable_param_read('pp_od_clk_voltage')
self[gpu_uuid].disable_param_read(('pp_od_clk_voltage', 'sclk_f_range',
'mclk_f_range', 'vddc_range'))
LOGGER.debug('%s exists, but empty on read.', pp_od_clk_voltage_file)
gpu_type = GpuItem.GPU_Type.Unsupported
readable = True
Expand Down Expand Up @@ -2214,6 +2218,8 @@ def set_gpu_list(self, clinfo_flag: bool = False) -> bool:
gpu_type = GpuItem.GPU_Type.Legacy

if not os.path.isfile(pp_od_clk_voltage_file):
self[gpu_uuid].disable_param_read(('pp_od_clk_voltage', 'sclk_f_range',
'mclk_f_range', 'vddc_range'))
LOGGER.debug('%s file does not exist', pp_od_clk_voltage_file)

# Set GPU parameters
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ parameters to be written to the GPU. The default behavior is to only write chan
* Fixed placement of read pstate data in *gpu-ls* for complete P-state details in the output.
* Improved implementation of Vddc Range for CurvePts type AMD GPU.
* Optimized by GPU type skip lists.
* Disable clock and voltage range reading/displaying when pp_od_clk_voltage reading is not possible.

## Development Plans

Expand Down

0 comments on commit 02a0174

Please sign in to comment.