[SWDEV-495169] Update ROCm SMI CLI and Error handling (#3)
Issues include:
Update ROCm SMI displaying None or Not Supported to N/A
Update ROCm SMI displaying err msg to instead log err
Signed-off-by: Juan Castillo juan.castillo@amd.com
Change-Id: I1a2ce6e4f329666b5666664a7d7b4475d6c1cbc7
[ROCm/rocm_smi_lib commit: 55ee3cc442]
This commit is contained in:
committed by
GitHub
parent
84400150b4
commit
bc13dfe3c8
@@ -1981,22 +1981,28 @@ def showAllConcise(deviceList):
|
|||||||
+ getComputePartition(device, silent)
|
+ getComputePartition(device, silent)
|
||||||
+ ", " + getPartitionId(device, silent))
|
+ ", " + getPartitionId(device, silent))
|
||||||
sclk = showCurrentClocks([device], 'sclk', concise=silent)
|
sclk = showCurrentClocks([device], 'sclk', concise=silent)
|
||||||
|
if not sclk:
|
||||||
|
sclk = 'N/A'
|
||||||
mclk = showCurrentClocks([device], 'mclk', concise=silent)
|
mclk = showCurrentClocks([device], 'mclk', concise=silent)
|
||||||
|
if not mclk:
|
||||||
|
mclk = 'N/A'
|
||||||
(retCode, fanLevel, fanSpeed) = getFanSpeed(device, silent)
|
(retCode, fanLevel, fanSpeed) = getFanSpeed(device, silent)
|
||||||
fan = str(fanSpeed) + '%'
|
fan = str(fanSpeed) + '%'
|
||||||
if getPerfLevel(device, silent) != -1:
|
if getPerfLevel(device, silent) != -1:
|
||||||
perf = getPerfLevel(device, silent)
|
perf = getPerfLevel(device, silent)
|
||||||
else:
|
else:
|
||||||
perf = 'Unsupported'
|
perf = 'N/A'
|
||||||
if getMaxPower(device, silent) != -1:
|
if getMaxPower(device, silent) != -1:
|
||||||
pwrCap = str(getMaxPower(device, silent)) + 'W'
|
pwrCap = str(getMaxPower(device, silent)) + 'W'
|
||||||
else:
|
else:
|
||||||
pwrCap = 'Unsupported'
|
pwrCap = 'N/A'
|
||||||
if getGpuUse(device, silent) != -1:
|
if getGpuUse(device, silent) != -1:
|
||||||
gpu_busy = str(getGpuUse(device, silent)) + '%'
|
gpu_busy = str(getGpuUse(device, silent)) + '%'
|
||||||
else:
|
else:
|
||||||
gpu_busy = 'Unsupported'
|
gpu_busy = 'N/A'
|
||||||
allocated_mem_percent = getAllocatedMemoryPercent(device)
|
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
|
# Top Row - per device data
|
||||||
values['card%s' % (str(device))] = [device, getNodeId(device),
|
values['card%s' % (str(device))] = [device, getNodeId(device),
|
||||||
|
|||||||
@@ -368,8 +368,9 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!amd::smi::IsInteger(val_str)) {
|
if (!amd::smi::IsInteger(val_str)) {
|
||||||
std::cerr << "Expected integer value from monitor,"
|
std::ostringstream ss;
|
||||||
" but got \"" << val_str << "\"" << std::endl;
|
ss << "Expected integer value from monitor, but got \"" << val_str << "\"";
|
||||||
|
LOG_ERROR(ss);
|
||||||
return RSMI_STATUS_UNEXPECTED_DATA;
|
return RSMI_STATUS_UNEXPECTED_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,8 +398,9 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!amd::smi::IsInteger(val_str)) {
|
if (!amd::smi::IsInteger(val_str)) {
|
||||||
std::cerr << "Expected integer value from monitor,"
|
std::ostringstream ss;
|
||||||
" but got \"" << val_str << "\"" << std::endl;
|
ss << "Expected integer value from monitor, but got \"" << val_str << "\"";
|
||||||
|
LOG_ERROR(ss);
|
||||||
return RSMI_STATUS_UNEXPECTED_DATA;
|
return RSMI_STATUS_UNEXPECTED_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user