From 90e148b4993a3772cba400bcdd519be048494a5f Mon Sep 17 00:00:00 2001 From: "Castillo, Juan" Date: Tue, 7 Jan 2025 17:35:39 -0600 Subject: [PATCH] [SWDEV-495169] Update err output to log_err (#24) Update status type for EPERM and ENOENT based on feedback from ticket. Update error output to LOG_ERR. --------- Signed-off-by: Juan Castillo [ROCm/amdsmi commit: 60492e754f3ff57da34595d46ff1e6e87ca92492] --- .../rocm_smi/python_smi_tools/rocm_smi.py | 17 +++++++++++++---- projects/amdsmi/rocm_smi/src/rocm_smi.cc | 10 ++++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py b/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py index 04d4056021..6cc6d4126e 100755 --- a/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py +++ b/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py @@ -1982,22 +1982,31 @@ def showAllConcise(deviceList): + getComputePartition(device, silent) + ", " + getPartitionId(device, silent)) sclk = showCurrentClocks([device], 'sclk', concise=silent) + if not sclk: + sclk = 'N/A' mclk = showCurrentClocks([device], 'mclk', concise=silent) + if not mclk: + mclk = 'N/A' (retCode, fanLevel, fanSpeed) = getFanSpeed(device, silent) - fan = str(fanSpeed) + '%' + if retCode == rsmi_status_t.RSMI_STATUS_SUCCESS: + fan = str(fanSpeed) + '%' + else: + fan = 'N/A' if getPerfLevel(device, silent) != -1: perf = getPerfLevel(device, silent) else: - perf = 'Unsupported' + perf = 'N/A' if getMaxPower(device, silent) != -1: pwrCap = str(getMaxPower(device, silent)) + 'W' else: - pwrCap = 'Unsupported' + pwrCap = 'N/A' if getGpuUse(device, silent) != -1: gpu_busy = str(getGpuUse(device, silent)) + '%' else: - gpu_busy = 'Unsupported' + gpu_busy = 'N/A' allocated_mem_percent = getAllocatedMemoryPercent(device) + if allocated_mem_percent['ret'] != rsmi_status_t.RSMI_STATUS_SUCCESS: + allocated_mem_percent['combined'] = 'N/A' # Top Row - per device data values['card%s' % (str(device))] = [device, getNodeId(device), diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi.cc b/projects/amdsmi/rocm_smi/src/rocm_smi.cc index c5361be002..ab7d439130 100644 --- a/projects/amdsmi/rocm_smi/src/rocm_smi.cc +++ b/projects/amdsmi/rocm_smi/src/rocm_smi.cc @@ -325,8 +325,9 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type, } if (!amd::smi::IsInteger(val_str)) { - std::cerr << "Expected integer value from monitor," - " but got \"" << val_str << "\"" << std::endl; + std::ostringstream ss; + ss << "Expected integer value from monitor, but got \"" << val_str << "\""; + LOG_ERROR(ss); return RSMI_STATUS_UNEXPECTED_DATA; } @@ -354,8 +355,9 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type, } if (!amd::smi::IsInteger(val_str)) { - std::cerr << "Expected integer value from monitor," - " but got \"" << val_str << "\"" << std::endl; + std::ostringstream ss; + ss << "Expected integer value from monitor, but got \"" << val_str << "\""; + LOG_ERROR(ss); return RSMI_STATUS_UNEXPECTED_DATA; }