Remove duplicate temperature function
The amdsmi_dev_get_temp_metric() will cover both function: amdsmi_get_temperature_measure() using AMDSMI_TEMP_CURRENT and amdsmi_get_temperature_limit() using AMDSMI_TEMP_CRITICAL Remove those two function. It also merge the amdsmi_get_power_limit() into amdsmi_get_power_measure() Change-Id: I40d4afeb2ec0ac7b64832729f36adfaae120c990
This commit is contained in:
@@ -571,49 +571,6 @@ try:
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
## amdsmi_get_temperature_measure
|
||||
Description: Returns the measurements of temperatures for the given GPU
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `device_handle` device which to query
|
||||
* `temperature_type` one of `AmdSmiTemperatureType` enum values:
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`EDGE` | edge temperature type
|
||||
`JUNCTION` | junction temperature type
|
||||
`VRAM` | vram temperature type
|
||||
`HBM_0` | HBM_0 temperature type
|
||||
`HBM_1` | HBM_1 temperature type
|
||||
`HBM_2` | HBM_2 temperature type
|
||||
`HBM_3` | HBM_3 temperature type
|
||||
`PLX` | PLX temperature type
|
||||
|
||||
Output: Dictionary with fields
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`cur_temp`| temperature value for the given temperature type
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_temperature_measure` function:
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
```python
|
||||
try:
|
||||
devices = amdsmi_get_device_handles()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
temperature_measure = amdsmi_get_temperature_measure(device, AmdSmiTemperatureType.EDGE)
|
||||
print(temperature_measure['cur_temp'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
## amdsmi_get_clock_measure
|
||||
Description: Returns the clock measure for the given GPU
|
||||
|
||||
@@ -665,81 +622,6 @@ try:
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
## amdsmi_get_power_limit
|
||||
Description: Returns the power limit for the given GPU
|
||||
|
||||
Input parameters:
|
||||
* `device_handle` device which to query
|
||||
|
||||
Output: Dictionary with fields
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`limit`| power limit
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_power_limit` function:
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
```python
|
||||
try:
|
||||
devices = amdsmi_get_device_handles()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
power_limit = amdsmi_get_power_limit(device)
|
||||
print(power_limit['limit'])
|
||||
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
## amdsmi_get_temperature_limit
|
||||
Description: Returns the temperature limits for the given GPU
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `device_handle` device which to query
|
||||
* `temperature_type` one of `AmdSmiTemperatureType` enum values:
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`EDGE` | edge temperature type
|
||||
`JUNCTION` | junction temperature type
|
||||
`VRAM` | vram temperature type
|
||||
`HBM_0` | HBM_0 temperature type
|
||||
`HBM_1` | HBM_1 temperature type
|
||||
`HBM_2` | HBM_2 temperature type
|
||||
`HBM_3` | HBM_3 temperature type
|
||||
`PLX` | PLX temperature type
|
||||
|
||||
Output: Dictionary with fields
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`limit`| temperature limit for the given thermal domain
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_temperature_limit` function:
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
```python
|
||||
try:
|
||||
devices = amdsmi_get_device_handles()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
temperature_limit = amdsmi_get_temperature_limit(device, AmdSmiTemperatureType.EDGE)
|
||||
print(temperature_limit['limit'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
## amdsmi_get_pcie_link_status
|
||||
Description: Returns the pcie link status for the given GPU
|
||||
|
||||
@@ -50,12 +50,9 @@ from .amdsmi_interface import amdsmi_get_gpu_activity
|
||||
from .amdsmi_interface import amdsmi_get_vram_usage
|
||||
from .amdsmi_interface import amdsmi_get_power_measure
|
||||
from .amdsmi_interface import amdsmi_get_clock_measure
|
||||
from .amdsmi_interface import amdsmi_get_temperature_measure
|
||||
|
||||
from .amdsmi_interface import amdsmi_get_pcie_link_status
|
||||
from .amdsmi_interface import amdsmi_get_pcie_link_caps
|
||||
from .amdsmi_interface import amdsmi_get_power_limit
|
||||
from .amdsmi_interface import amdsmi_get_temperature_limit
|
||||
from .amdsmi_interface import amdsmi_get_bad_page_info
|
||||
|
||||
# # Power Management
|
||||
|
||||
@@ -734,69 +734,6 @@ def amdsmi_get_clock_measure(
|
||||
}
|
||||
|
||||
|
||||
def amdsmi_get_temperature_measure(
|
||||
device_handle: amdsmi_wrapper.amdsmi_device_handle,
|
||||
temperature_type: amdsmi_wrapper.amdsmi_temperature_type_t,
|
||||
) -> Dict[str, Any]:
|
||||
if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle):
|
||||
raise AmdSmiParameterException(
|
||||
device_handle, amdsmi_wrapper.amdsmi_device_handle
|
||||
)
|
||||
if not isinstance(temperature_type, AmdSmiTemperatureType):
|
||||
raise AmdSmiParameterException(temperature_type, AmdSmiTemperatureType)
|
||||
|
||||
temperature_measure = amdsmi_wrapper.amdsmi_temperature_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_temperature_measure(
|
||||
device_handle,
|
||||
amdsmi_wrapper.amdsmi_temperature_type_t(temperature_type),
|
||||
ctypes.byref(temperature_measure),
|
||||
)
|
||||
)
|
||||
|
||||
return {"cur_temp": temperature_measure.cur_temp}
|
||||
|
||||
|
||||
def amdsmi_get_power_limit(
|
||||
device_handle: amdsmi_wrapper.amdsmi_device_handle,
|
||||
) -> Dict[str, Any]:
|
||||
if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle):
|
||||
raise AmdSmiParameterException(
|
||||
device_handle, amdsmi_wrapper.amdsmi_device_handle
|
||||
)
|
||||
|
||||
power_limit = amdsmi_wrapper.amdsmi_power_limit_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_power_limit(
|
||||
device_handle, ctypes.byref(power_limit))
|
||||
)
|
||||
|
||||
return {"limit": power_limit.limit}
|
||||
|
||||
|
||||
def amdsmi_get_temperature_limit(
|
||||
device_handle: amdsmi_wrapper.amdsmi_device_handle,
|
||||
temperature_type: amdsmi_wrapper.amdsmi_temperature_type_t,
|
||||
) -> Dict[str, Any]:
|
||||
if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle):
|
||||
raise AmdSmiParameterException(
|
||||
device_handle, amdsmi_wrapper.amdsmi_device_handle
|
||||
)
|
||||
if not isinstance(temperature_type, AmdSmiTemperatureType):
|
||||
raise AmdSmiParameterException(temperature_type, AmdSmiTemperatureType)
|
||||
|
||||
temperature_limit = amdsmi_wrapper.amdsmi_temperature_limit_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_temperature_limit(
|
||||
device_handle,
|
||||
amdsmi_wrapper.amdsmi_temperature_type_t(temperature_type),
|
||||
ctypes.byref(temperature_limit),
|
||||
)
|
||||
)
|
||||
|
||||
return {"limit": temperature_limit.limit}
|
||||
|
||||
|
||||
def amdsmi_get_bad_page_info(
|
||||
device_handle: amdsmi_wrapper.amdsmi_device_handle,
|
||||
) -> Union[list, str]:
|
||||
|
||||
@@ -653,33 +653,6 @@ amdsmi_board_info_t = struct_amdsmi_board_info
|
||||
class struct_amdsmi_temperature(Structure):
|
||||
pass
|
||||
|
||||
struct_amdsmi_temperature._pack_ = 1 # source:False
|
||||
struct_amdsmi_temperature._fields_ = [
|
||||
('cur_temp', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 7),
|
||||
]
|
||||
|
||||
amdsmi_temperature_t = struct_amdsmi_temperature
|
||||
class struct_amdsmi_temperature_limit(Structure):
|
||||
pass
|
||||
|
||||
struct_amdsmi_temperature_limit._pack_ = 1 # source:False
|
||||
struct_amdsmi_temperature_limit._fields_ = [
|
||||
('limit', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 7),
|
||||
]
|
||||
|
||||
amdsmi_temperature_limit_t = struct_amdsmi_temperature_limit
|
||||
class struct_amdsmi_power_limit(Structure):
|
||||
pass
|
||||
|
||||
struct_amdsmi_power_limit._pack_ = 1 # source:False
|
||||
struct_amdsmi_power_limit._fields_ = [
|
||||
('limit', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 7),
|
||||
]
|
||||
|
||||
amdsmi_power_limit_t = struct_amdsmi_power_limit
|
||||
class struct_amdsmi_power_measure(Structure):
|
||||
pass
|
||||
|
||||
@@ -691,7 +664,8 @@ struct_amdsmi_power_measure._fields_ = [
|
||||
('voltage_gfx', ctypes.c_uint32),
|
||||
('voltage_soc', ctypes.c_uint32),
|
||||
('voltage_mem', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 10),
|
||||
('power_limit', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 9),
|
||||
('PADDING_1', ctypes.c_ubyte * 4),
|
||||
]
|
||||
|
||||
@@ -1733,15 +1707,6 @@ amdsmi_get_power_measure.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct
|
||||
amdsmi_get_clock_measure = _libraries['libamd_smi.so'].amdsmi_get_clock_measure
|
||||
amdsmi_get_clock_measure.restype = amdsmi_status_t
|
||||
amdsmi_get_clock_measure.argtypes = [amdsmi_device_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_amdsmi_clk_measure)]
|
||||
amdsmi_get_temperature_measure = _libraries['libamd_smi.so'].amdsmi_get_temperature_measure
|
||||
amdsmi_get_temperature_measure.restype = amdsmi_status_t
|
||||
amdsmi_get_temperature_measure.argtypes = [amdsmi_device_handle, amdsmi_temperature_type_t, ctypes.POINTER(struct_amdsmi_temperature)]
|
||||
amdsmi_get_temperature_limit = _libraries['libamd_smi.so'].amdsmi_get_temperature_limit
|
||||
amdsmi_get_temperature_limit.restype = amdsmi_status_t
|
||||
amdsmi_get_temperature_limit.argtypes = [amdsmi_device_handle, amdsmi_temperature_type_t, ctypes.POINTER(struct_amdsmi_temperature_limit)]
|
||||
amdsmi_get_power_limit = _libraries['libamd_smi.so'].amdsmi_get_power_limit
|
||||
amdsmi_get_power_limit.restype = amdsmi_status_t
|
||||
amdsmi_get_power_limit.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_amdsmi_power_limit)]
|
||||
amdsmi_get_vram_usage = _libraries['libamd_smi.so'].amdsmi_get_vram_usage
|
||||
amdsmi_get_vram_usage.restype = amdsmi_status_t
|
||||
amdsmi_get_vram_usage.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_amdsmi_vram_info)]
|
||||
@@ -1949,12 +1914,11 @@ __all__ = \
|
||||
'amdsmi_get_fw_info', 'amdsmi_get_gpu_activity',
|
||||
'amdsmi_get_minmax_bandwidth', 'amdsmi_get_pcie_link_caps',
|
||||
'amdsmi_get_pcie_link_status', 'amdsmi_get_power_cap_info',
|
||||
'amdsmi_get_power_limit', 'amdsmi_get_power_measure',
|
||||
'amdsmi_get_power_measure',
|
||||
'amdsmi_get_process_info', 'amdsmi_get_process_list',
|
||||
'amdsmi_get_ras_block_features_enabled',
|
||||
'amdsmi_get_socket_handles', 'amdsmi_get_socket_info',
|
||||
'amdsmi_get_target_frequency_range',
|
||||
'amdsmi_get_temperature_limit', 'amdsmi_get_temperature_measure',
|
||||
'amdsmi_get_utilization_count', 'amdsmi_get_vbios_info',
|
||||
'amdsmi_get_version', 'amdsmi_get_version_str',
|
||||
'amdsmi_get_vram_usage', 'amdsmi_get_xgmi_info',
|
||||
@@ -1972,7 +1936,7 @@ __all__ = \
|
||||
'amdsmi_od_volt_curve_t', 'amdsmi_od_volt_freq_data',
|
||||
'amdsmi_od_volt_freq_data_t', 'amdsmi_pcie_bandwidth',
|
||||
'amdsmi_pcie_bandwidth_t', 'amdsmi_pcie_info_t',
|
||||
'amdsmi_power_cap_info_t', 'amdsmi_power_limit_t',
|
||||
'amdsmi_power_cap_info_t',
|
||||
'amdsmi_power_measure_t', 'amdsmi_power_profile_preset_masks',
|
||||
'amdsmi_power_profile_preset_masks__enumvalues',
|
||||
'amdsmi_power_profile_preset_masks_t',
|
||||
@@ -1986,11 +1950,10 @@ __all__ = \
|
||||
'amdsmi_set_perf_determinism_mode', 'amdsmi_shut_down',
|
||||
'amdsmi_socket_handle', 'amdsmi_status_string', 'amdsmi_status_t',
|
||||
'amdsmi_stop_event_notification', 'amdsmi_sw_component_t',
|
||||
'amdsmi_sw_component_t__enumvalues', 'amdsmi_temperature_limit_t',
|
||||
'amdsmi_temperature_metric',
|
||||
'amdsmi_temperature_metric__enumvalues',
|
||||
'amdsmi_temperature_metric_t',
|
||||
'amdsmi_temperature_metric_t__enumvalues', 'amdsmi_temperature_t',
|
||||
'amdsmi_temperature_metric_t__enumvalues',
|
||||
'amdsmi_temperature_type', 'amdsmi_temperature_type_t',
|
||||
'amdsmi_temperature_type_t__enumvalues',
|
||||
'amdsmi_topo_get_link_type', 'amdsmi_topo_get_link_weight',
|
||||
@@ -2025,7 +1988,7 @@ __all__ = \
|
||||
'struct_amdsmi_power_limit', 'struct_amdsmi_power_measure',
|
||||
'struct_amdsmi_process_info', 'struct_amdsmi_process_info_0',
|
||||
'struct_amdsmi_process_info_1', 'struct_amdsmi_temperature',
|
||||
'struct_amdsmi_temperature_limit', 'struct_amdsmi_vbios_info',
|
||||
'struct_amdsmi_vbios_info',
|
||||
'struct_amdsmi_vram_info', 'struct_amdsmi_xgmi_info',
|
||||
'struct_c__SA_amdsmi_counter_value_t',
|
||||
'struct_c__SA_amdsmi_error_count_t',
|
||||
|
||||
مرجع در شماره جدید
Block a user