Adjusted CU % logic to be more robust

This commit is contained in:
gabrpham_amdeng
2025-06-18 19:37:01 -05:00
committed by Arif, Maisam
parent fd751ba918
commit 9729aba695
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -6602,11 +6602,11 @@ class AMDSMICommands():
market_name = asic_info['market_name'] market_name = asic_info['market_name']
oam_id = asic_info['oam_id'] oam_id = asic_info['oam_id']
# get num_cu now for use later # get num_cu now for use later
max_cu = float(asic_info['num_compute_units']) total_num_cu = float(asic_info['num_compute_units'])
except amdsmi_exception.AmdSmiLibraryException as e: except amdsmi_exception.AmdSmiLibraryException as e:
market_name = "N/A" market_name = "N/A"
oam_id = "N/A" oam_id = "N/A"
max_cu = "N/A" total_num_cu = "N/A"
gpu_info_dict.update({"market_name": market_name}) gpu_info_dict.update({"market_name": market_name})
gpu_info_dict.update({"oam_id": oam_id}) gpu_info_dict.update({"oam_id": oam_id})
@@ -6705,7 +6705,7 @@ class AMDSMICommands():
proc_info_dict['vram'] = self.helpers.convert_bytes_to_readable(proc['memory_usage']['vram_mem']) proc_info_dict['vram'] = self.helpers.convert_bytes_to_readable(proc['memory_usage']['vram_mem'])
proc_info_dict['mem_usage'] = self.helpers.convert_bytes_to_readable(proc['mem']) proc_info_dict['mem_usage'] = self.helpers.convert_bytes_to_readable(proc['mem'])
num_cu = float(proc['cu_occupancy']) num_cu = float(proc['cu_occupancy'])
proc_info_dict['cu_occupancy'] = {"current_cu": num_cu, "max_cu": max_cu} proc_info_dict['cu_occupancy'] = {"current_cu": num_cu, "total_num_cu": total_num_cu}
all_process_list.append(proc_info_dict) all_process_list.append(proc_info_dict)
except amdsmi_exception.AmdSmiLibraryException as e: except amdsmi_exception.AmdSmiLibraryException as e:
logging.debug("Failed to get process list for gpu %s | %s", gpu_id, e.get_error_info()) logging.debug("Failed to get process list for gpu %s | %s", gpu_id, e.get_error_info())
+2 -2
View File
@@ -1082,8 +1082,8 @@ class AMDSMILogger():
gtt_mem = str(process['gtt']).rjust(8) gtt_mem = str(process['gtt']).rjust(8)
vram_mem = str(process['vram']).rjust(8) vram_mem = str(process['vram']).rjust(8)
mem_usage = str(process['mem_usage']).rjust(9) mem_usage = str(process['mem_usage']).rjust(9)
if process['cu_occupancy']['max_cu'] != "N/A": if process['cu_occupancy']['total_num_cu'] != "N/A" and process['cu_occupancy']['current_cu'] != "N/A":
cu_occupancy = (str(round(process['cu_occupancy']['current_cu'] / process['cu_occupancy']['max_cu'] * 100, 1)) + " %").rjust(7) cu_occupancy = (str(round(process['cu_occupancy']['current_cu'] / process['cu_occupancy']['total_num_cu'] * 100, 1)) + " %").rjust(7)
else: else:
cu_occupancy = "N/A" cu_occupancy = "N/A"
print("| {0:4.4s} {1:9.9s} {2:19.19s} {3:8.8s} {4:8.8s} {5:9.9s} {6:7.7s} |".format( print("| {0:4.4s} {1:9.9s} {2:19.19s} {3:8.8s} {4:8.8s} {5:9.9s} {6:7.7s} |".format(