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 309bec4ecc..a1eb198e09 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -509,7 +509,6 @@ def printLog(device, metricName, value): logstr = 'GPU[%s]\t\t: %s' % (device, metricName) if device is None: logstr = logstr[13:] - logging.debug(logstr) # Force thread safe printing print(logstr + '\n', end='') @@ -2026,7 +2025,7 @@ def showProfile(deviceList): status = rsmi_power_profile_status_t() for device in deviceList: ret = rocmsmi.rsmi_dev_power_profile_presets_get(device, 0, byref(status)) - if rsmi_ret_ok(ret, device, 'profiles'): + if rsmi_ret_ok(ret, device, 'profiles', silent=False): binaryMaskString = str(format(status.available_profiles, '07b'))[::-1] bitMaskPosition = 0 profileNumber = 0 @@ -2058,7 +2057,7 @@ def showRange(deviceList, rangeType): odvf = rsmi_od_volt_freq_data_t() for device in deviceList: ret = rocmsmi.rsmi_dev_od_volt_info_get(device, byref(odvf)) - if rsmi_ret_ok(ret, device, 'od volt'): + if rsmi_ret_ok(ret, device, 'od volt', silent=False): if rangeType == 'sclk': printLog(device, 'Valid sclk range: %sMhz - %sMhz' % ( int(odvf.curr_sclk_range.lower_bound / 1000000), int(odvf.curr_sclk_range.upper_bound / 1000000)), None) @@ -2080,8 +2079,6 @@ def showRange(deviceList, rangeType): None) else: printLog(device, 'Unable to display %s range' % (rangeType), None) - else: - printLog(device, 'Unable to display %s range' % (rangeType), None) printLogSpacer() @@ -2294,13 +2291,11 @@ def showVoltageCurve(deviceList): odvf = rsmi_od_volt_freq_data_t() for device in deviceList: ret = rocmsmi.rsmi_dev_od_volt_info_get(device, byref(odvf)) - if rsmi_ret_ok(ret, device, 'od volt'): + if rsmi_ret_ok(ret, device, 'od volt', silent=False): for position in range(3): printLog(device, 'Voltage point %d: %sMhz %smV' % ( position, int(list(odvf.curve.vc_points)[position].frequency / 1000000), int(list(odvf.curve.vc_points)[position].voltage)), None) - else: - printLog(device, 'Voltage Curve is not supported', None) printLogSpacer() @@ -2790,10 +2785,10 @@ def rsmi_ret_ok(my_ret, device=None, metric=None, silent=False): returnString += ' %s: ' % (metric) returnString += '%s\t' % (err_str.value.decode()) if not PRINT_JSON: - if silent: - logging.info('%s', returnString) - else: - logging.error('%s', returnString) + logging.debug('%s', returnString) + if not silent: + if my_ret in rsmi_status_verbose_err_out: + printLog(device, rsmi_status_verbose_err_out[my_ret], None) RETCODE = my_ret return False return True diff --git a/projects/rocm-smi-lib/python_smi_tools/rsmiBindings.py b/projects/rocm-smi-lib/python_smi_tools/rsmiBindings.py index 090b85c3d8..7da7c2bc8c 100644 --- a/projects/rocm-smi-lib/python_smi_tools/rsmiBindings.py +++ b/projects/rocm-smi-lib/python_smi_tools/rsmiBindings.py @@ -69,6 +69,27 @@ class rsmi_status_t(c_int): RSMI_STATUS_UNKNOWN_ERROR = 0xFFFFFFFF +#Dictionary of rsmi ret codes and it's verbose output +rsmi_status_verbose_err_out = { + rsmi_status_t.RSMI_STATUS_SUCCESS: 'Operation was successful', + rsmi_status_t.RSMI_STATUS_INVALID_ARGS: 'Invalid arguments provided', + rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED: 'Not supported on the given system', + rsmi_status_t.RSMI_STATUS_FILE_ERROR: 'Problem accessing a file', + rsmi_status_t.RSMI_STATUS_PERMISSION: 'Permission denied', + rsmi_status_t.RSMI_STATUS_OUT_OF_RESOURCES: 'Unable to acquire memory or other resource', + rsmi_status_t.RSMI_STATUS_INTERNAL_EXCEPTION: 'An internal exception was caught', + rsmi_status_t.RSMI_STATUS_INPUT_OUT_OF_BOUNDS: 'Provided input is out of allowable or safe range', + rsmi_status_t.RSMI_INITIALIZATION_ERROR: 'Error occured during rsmi initialization', + rsmi_status_t.RSMI_STATUS_NOT_YET_IMPLEMENTED: 'Requested function is not implemented on this setup', + rsmi_status_t.RSMI_STATUS_NOT_FOUND: 'Item searched for but not found', + rsmi_status_t.RSMI_STATUS_INSUFFICIENT_SIZE: 'Insufficient resources available', + rsmi_status_t.RSMI_STATUS_INTERRUPT: 'Interrupt occured during execution', + rsmi_status_t.RSMI_STATUS_UNEXPECTED_SIZE: 'Unexpected amount of data read', + rsmi_status_t.RSMI_STATUS_NO_DATA: 'No data found for the given input', + rsmi_status_t.RSMI_STATUS_UNKNOWN_ERROR: 'Unknown error occured' +} + + class rsmi_init_flags_t(c_int): RSMI_INIT_FLAG_ALL_GPUS = 0x1