From 55bc2e2072fd2ff50e60a75670075441b6ae32e5 Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Fri, 24 Feb 2023 08:38:18 -0600 Subject: [PATCH] Memory usage division by zero The showAllConcise with division by zero error. Change-Id: I469f1b9f268842cd51662be6f9036f555a8949b2 --- python_smi_tools/rocm_smi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_smi_tools/rocm_smi.py b/python_smi_tools/rocm_smi.py index cae7e0cef0..743ed16107 100755 --- a/python_smi_tools/rocm_smi.py +++ b/python_smi_tools/rocm_smi.py @@ -1539,7 +1539,7 @@ def showAllConcise(deviceList): else: gpu_busy = 'Unsupported' memInfo = getMemInfo(device, 'vram') - if memInfo[0] == None or memInfo[1] == None: + if memInfo[0] == None or memInfo[1] == None or float(memInfo[1]) == 0: mem_use = 'N/A' else: mem_use_pct = '% 3.0f%%' % (100 * (float(memInfo[0]) / float(memInfo[1])))