Changed power parameter in amdsmi_get_energy_count() to energy_accumulator

Issue linked here: https://github.com/ROCm/amdsmi/issues/38

Signed-off-by: gabrpham <Gabriel.Pham@amd.com>
Change-Id: I622236eb3f0144aefeb6c82d2713b4822bfeeb11
这个提交包含在:
gabrpham
2024-08-29 17:13:21 -05:00
提交者 Maisam Arif
父节点 3c954e78fc
当前提交 95ca2b83a1
修改 8 个文件,包含 36 行新增29 行删除
+7 -5
查看文件
@@ -1534,7 +1534,8 @@ except AmdSmiException as e:
### amdsmi_get_energy_count
Description: Get the energy accumulator counter of the device.
Description: Get the energy accumulator counter information of the device.
energy_accumulator * counter_resolution = total_energy_consumption in micro-Joules
It is not supported on virtual machine guest
Input parameters:
@@ -1545,7 +1546,8 @@ Output: Dictionary with fields
Field | Content
---|---
`power` | power
`power` | counter for energy accumulation since last restart/gpu rest (Deprecating in 6.4)
`energy_accumulator` | counter for energy accumulation since last restart/gpu rest
`counter_resolution` | counter resolution
`timestamp` | timestamp
@@ -1564,8 +1566,8 @@ try:
print("No GPUs on machine")
else:
for device in devices:
power = amdsmi_get_energy_count(device)
print(power)
energy_dict = amdsmi_get_energy_count(device)
print(energy_dict)
except AmdSmiException as e:
print(e)
```
@@ -1608,7 +1610,7 @@ except AmdSmiException as e:
### amdsmi_set_gpu_od_clk_info
Description: This function sets the clock frequency information
Description: This function sets the clock frequency information.
It is not supported on virtual machine guest
Input parameters:
+4 -3
查看文件
@@ -3105,17 +3105,18 @@ def amdsmi_get_energy_count(processor_handle: amdsmi_wrapper.amdsmi_processor_ha
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
)
power = ctypes.c_uint64()
energy_accumulator= ctypes.c_uint64()
counter_resolution = ctypes.c_float()
timestamp = ctypes.c_uint64()
_check_res(
amdsmi_wrapper.amdsmi_get_energy_count(processor_handle, ctypes.byref(
power), ctypes.byref(counter_resolution), ctypes.byref(timestamp))
energy_accumulator), ctypes.byref(counter_resolution), ctypes.byref(timestamp))
)
return {
'power': power.value,
'power': energy_accumulator.value, # deprecating in 6.4
'energy_accumulator': energy_accumulator.value,
'counter_resolution': counter_resolution.value,
'timestamp': timestamp.value,
}