From c78ec4667142345835e691d82a74aa5c33ac2d72 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Wed, 14 Jun 2023 10:52:46 -0500 Subject: [PATCH 1/3] SWDEV-394316 - Handle not applicable vbios Change-Id: I3390078a63c9a5eff67024b84a3be1369c4b1460 Signed-off-by: Maisam Arif --- python_smi_tools/rocm_smi.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python_smi_tools/rocm_smi.py b/python_smi_tools/rocm_smi.py index f8755c1954..e374bd3e20 100755 --- a/python_smi_tools/rocm_smi.py +++ b/python_smi_tools/rocm_smi.py @@ -410,7 +410,9 @@ def getVbiosVersion(device): """ vbios = create_string_buffer(256) ret = rocmsmi.rsmi_dev_vbios_version_get(device, vbios, 256) - if rsmi_ret_ok(ret, device): + if ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED: + return "Unsupported" + elif rsmi_ret_ok(ret, device): return vbios.value.decode() @@ -2288,8 +2290,12 @@ def showProductName(deviceList): # if rsmi_ret_ok(ret, device) and sku.value.decode(): # device_sku = sku.value.decode() # Retrieve the device SKU as a substring from VBIOS + device_sku = "" ret = rocmsmi.rsmi_dev_vbios_version_get(device, vbios, 256) - if rsmi_ret_ok(ret, device, 'get_vbios_version') and vbios.value.decode(): + if ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED: + device_sku = "Unsupported" + printLog(device, 'Card SKU', '\t\t' + device_sku) + elif rsmi_ret_ok(ret, device, 'get_vbios_version') and vbios.value.decode(): # Device SKU is just the characters in between the two '-' in vbios_version if vbios.value.decode().count('-') == 2 and len(str(vbios.value.decode().split('-')[1])) > 1: device_sku = vbios.value.decode().split('-')[1] From 80d650b95a1db443d76c7fb644861f99110ca996 Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Wed, 26 Jul 2023 15:28:18 -0500 Subject: [PATCH 2/3] Handle csv output when the command is not based on the device Fix the error only one csv line can be printed out when output is not based on device. Change-Id: Idacc5d98acc223e932fb3d46c888bfa04778b73c --- python_smi_tools/rocm_smi.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/python_smi_tools/rocm_smi.py b/python_smi_tools/rocm_smi.py index e374bd3e20..95f7e2510f 100755 --- a/python_smi_tools/rocm_smi.py +++ b/python_smi_tools/rocm_smi.py @@ -112,19 +112,10 @@ def formatCsv(deviceList): if outputType == 'system': jsonobj = json.loads(jsondata) keylist = header - for record in jsonobj: - my_string += str(record) - for key in keylist: - if key == 'system': - tempstr = str(jsonobj[record]) - tempstr = tempstr[tempstr.find('\'')+1:] - tempstr = tempstr[:tempstr.find('\'')] - # Force output device type to 'system' - my_string += ',%s\nsystem,%s' % (tempstr, jsonobj[record][tempstr]) - my_string += '\n' - # Force output device type to 'system' - if my_string.startswith('system'): - my_string = 'device' + my_string[6:] + for record in jsonobj['system']: + my_string += "\"%s\", \"%s\"\n" % (record, jsonobj['system'][record]) + # add header + my_string = "name, value\n" + my_string return my_string headerkeys = [] # Separate device-specific information from system-level information From aeb6c61f54b7167cc4034360ac2cf29b3c07b49d Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Thu, 27 Jul 2023 15:18:28 -0500 Subject: [PATCH 3/3] Change reset power error message to logging Since the reset will continue if the reset power and current power is the same, error may confuse the user. Change-Id: I35b9ef17afd47b5af5bd2b8882a44f63991fe509 --- 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 95f7e2510f..27302cc50a 100755 --- a/python_smi_tools/rocm_smi.py +++ b/python_smi_tools/rocm_smi.py @@ -1357,7 +1357,7 @@ def setPowerOverDrive(deviceList, value, autoRespond): RETCODE = 1 continue if new_power_cap.value == current_power_cap.value: - printErrLog(device,'Max power was already at: {}W'.format(new_power_cap.value / 1000000)) + printLog(device,'Max power was already at: {}W'.format(new_power_cap.value / 1000000)) if current_power_cap.value < default_power_cap.value: current_power_cap.value = default_power_cap.value