From 61ac3f8ca9f1be64bf06c9606125fa61088472db Mon Sep 17 00:00:00 2001 From: "Galantsev, Dmitrii" Date: Mon, 12 Jun 2023 19:02:46 -0500 Subject: [PATCH] --showtempgraph - Show N/A when no temp found If temp in hwmon was missing - rocm-smi crashed. e.g. /sys/class/drm/card1/device/hwmon/hwmon5/temp1_input This change displays "N/A" for temp instead of crashing. Change-Id: I02f84a466bd3acfbd9b65e7e4ca0f18e76606c3b Signed-off-by: Galantsev, Dmitrii [ROCm/rocm_smi_lib commit: 713f85721bec063e04b1c17a0f04dc2794c1b38a] --- projects/rocm-smi-lib/python_smi_tools/rocm_smi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 dcfc47ebc7..b0f530cc41 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -2563,8 +2563,12 @@ def printTempGraph(deviceList, delay): if terminalWidth < originalTerminalWidth: print('Terminal size cannot be decreased.\n\r') return + if type(temp) == str: + tempString = temp + else: + tempString = str(int(temp)) # Two spare Spaces - tempString = (str(int(temp)) + '°C').ljust(5) + tempString = (tempString + '°C').ljust(5) printStrings.append('\033[2;30;47mGPU[%d] Temp %s|%s%s\x1b[0m%s' % (device, tempString, color, paddingSpace[1:], remainderSpace)) originalTerminalWidth = terminalWidth time.sleep((delay / 1000))