From 2ba625e569279f299e5494c93809c09e4e33ab79 Mon Sep 17 00:00:00 2001 From: Kent Russell Date: Thu, 22 Apr 2021 08:53:43 -0400 Subject: [PATCH] rocm_smi.py: Don't try to print absent clock files Instead of throwing "Unsupported clock" errors for ASICs that don't support a certain clock type (e.g. dcefclk on MI-series), just dump the warning to logging.debug and don't try to read the clock Signed-off-by: Kent Russell Change-Id: If3cb9a472b03aa535a76fc24bcd9f77122090634 [ROCm/rocm_smi_lib commit: b931380f02df3323e12c1eb162ef3190d6ff07e6] --- projects/rocm-smi-lib/python_smi_tools/rocm_smi.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py index ec50c3dc2d..05cfd82645 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -1332,6 +1332,9 @@ def showClocks(deviceList): for device in deviceList: for clk_type in sorted(rsmi_clk_names_dict): freq_list = [] + if not os.path.isfile(os.path.join('/sys/class/drm', 'card%d' % (device), 'device', 'pp_dpm_%s' % clk_type)): + logging.debug('No clock file for %s on card%d' % (clk_type, device)) + continue if rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], None) == 1: ret = rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], byref(freq)) if rsmi_ret_ok(ret, device, clk_type, True): @@ -1393,6 +1396,9 @@ def showCurrentClocks(deviceList, clk_defined=None, concise=False): else: # if clk is not defined, will display all current clk for clk_type in sorted(rsmi_clk_names_dict): + if not os.path.isfile(os.path.join('/sys/class/drm', 'card%d' % (device), 'device', 'pp_dpm_%s' % clk_type)): + logging.debug('No clock file for %s on card%d' % (clk_type, device)) + continue if rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], None) == 1: ret = rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], byref(freq)) if rsmi_ret_ok(ret, device, clk_type, True):