Signed-off-by: Maisam Arif <maisarif@amd.com> Change-Id: I2218bf664a8a155e6b3085378db0fb20f3be3f70
AMD SMI Python Library
Requirements
- python 3.6+ 64-bit
- driver must be loaded for amdsmi_init() to pass
Overview
Folder structure
| File Name | Note |
|---|---|
__init__.py |
Python package initialization file |
amdsmi_interface.py |
Amdsmi library python interface |
amdsmi_wrapper.py |
Python wrapper around amdsmi binary |
amdsmi_exception.py |
Amdsmi exceptions python file |
README.md |
Documentation |
Usage
amdsmi folder should be copied and placed next to importing script. It should be imported as:
from amdsmi import *
try:
amdsmi_init()
# amdsmi calls ...
except AmdSmiException as e:
print(e)
finally:
try:
amdsmi_shut_down()
except AmdSmiException as e:
print(e)
To initialize amdsmi lib, amdsmi_init() must be called before all other calls to amdsmi lib.
To close connection to driver, amdsmi_shut_down() must be the last call.
Exceptions
All exceptions are in amdsmi_exception.py file.
Exceptions that can be thrown are:
AmdSmiException: base amdsmi exception classAmdSmiLibraryException: derives baseAmdSmiExceptionclass and represents errors that can occur in amdsmi-lib. When this exception is thrown,err_codeanderr_infoare set.err_codeis an integer that corresponds to errors that can occur in amdsmi-lib anderr_infois a string that explains the error that occurred. Example:
try:
num_of_GPUs = len(amdsmi_get_processor_handles())
if num_of_GPUs == 0:
print("No GPUs on machine")
except AmdSmiException as e:
print("Error code: {}".format(e.err_code))
if e.err_code == amdsmi_wrapper.AMDSMI_STATUS_RETRY:
print("Error info: {}".format(e.err_info))
AmdSmiRetryException: DerivesAmdSmiLibraryExceptionclass and signals device is busy and call should be retried.AmdSmiTimeoutException: DerivesAmdSmiLibraryExceptionclass and represents that call had timed out.AmdSmiParameterException: Derives baseAmdSmiExceptionclass and represents errors related to invaild parameters passed to functions. When this exception is thrown, err_msg is set and it explains what is the actual and expected type of the parameters.AmdSmiBdfFormatException: Derives baseAmdSmiExceptionclass and represents invalid bdf format.
API
amdsmi_init
Description: Initialize amdsmi with AmdSmiInitFlags
Input parameters: AmdSmiInitFlags
Output: None
Exceptions that can be thrown by amdsmi_init function:
AmdSmiLibraryException
Initialize GPUs only example:
try:
# by default we initalize with AmdSmiInitFlags.INIT_AMD_GPUS
init_flag = amdsmi_init()
# continue with amdsmi
except AmdSmiException as e:
print("Init GPUs failed")
print(e)
Initialize CPUs only example:
try:
init_flag = amdsmi_init(AmdSmiInitFlags.INIT_AMD_CPUS)
# continue with amdsmi
except AmdSmiException as e:
print("Init CPUs failed")
print(e)
Initialize both GPUs and CPUs example:
try:
init_flag = amdsmi_init(AmdSmiInitFlags.INIT_AMD_APUS)
# continue with amdsmi
except AmdSmiException as e:
print("Init both GPUs & CPUs failed")
print(e)
amdsmi_shut_down
Description: Finalize and close connection to driver
Input parameters: None
Output: None
Exceptions that can be thrown by amdsmi_shut_down function:
AmdSmiLibraryException
Example:
try:
amdsmi_init()
amdsmi_shut_down()
except AmdSmiException as e:
print("Shut down failed")
print(e)
amdsmi_get_processor_type
Description: Checks the type of device with provided handle.
Input parameters: device handle as an instance of amdsmi_processor_handle
Output: Integer, type of gpu
Exceptions that can be thrown by amdsmi_get_processor_type function:
AmdSmiLibraryException
Example:
try:
type_of_GPU = amdsmi_get_processor_type(processor_handle)
if type_of_GPU == 1:
print("This is an AMD GPU")
except AmdSmiException as e:
print(e)
amdsmi_get_processor_handles
Description: Returns list of GPU device handle objects on current machine
Input parameters: None
Output: List of GPU device handle objects
Exceptions that can be thrown by amdsmi_get_processor_handles function:
AmdSmiLibraryException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
print(amdsmi_get_gpu_device_uuid(device))
except AmdSmiException as e:
print(e)
amdsmi_get_socket_handles
Note: CURRENTLY HARDCODED TO RETURN DUMMY DATA Description: Returns list of socket device handle objects on current machine
Input parameters: None
Output: List of socket device handle objects
Exceptions that can be thrown by amdsmi_get_socket_handles function:
AmdSmiLibraryException
Example:
try:
sockets = amdsmi_get_socket_handles()
print('Socket numbers: {}'.format(len(sockets)))
except AmdSmiException as e:
print(e)
amdsmi_get_socket_info
Note: CURRENTLY HARDCODED TO RETURN EMPTY VALUES Description: Return socket name
Input parameters:
socket_handle socket handle
Output: Socket name
Exceptions that can be thrown by amdsmi_get_socket_info function:
AmdSmiLibraryException
Example:
try:
socket_handles = amdsmi_get_socket_handles()
if len(socket_handles) == 0:
print("No sockets on machine")
else:
for socket in socket_handles:
print(amdsmi_get_socket_info(socket))
except AmdSmiException as e:
print(e)
amdsmi_get_processor_handle_from_bdf
Description: Returns device handle from the given BDF
Input parameters: bdf string in form of either <domain>:<bus>:<device>.<function> or <bus>:<device>.<function> in hexcode format.
Where:
<domain>is 4 hex digits long from 0000-FFFF interval<bus>is 2 hex digits long from 00-FF interval<device>is 2 hex digits long from 00-1F interval<function>is 1 hex digit long from 0-7 interval
Output: device handle object
Exceptions that can be thrown by amdsmi_get_processor_handle_from_bdf function:
AmdSmiLibraryExceptionAmdSmiBdfFormatException
Example:
try:
device = amdsmi_get_processor_handle_from_bdf("0000:23:00.0")
print(amdsmi_get_gpu_device_uuid(device))
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_device_bdf
Description: Returns BDF of the given device
Input parameters:
processor_handledev for which to query
Output: BDF string in form of <domain>:<bus>:<device>.<function> in hexcode format.
Where:
<domain>is 4 hex digits long from 0000-FFFF interval<bus>is 2 hex digits long from 00-FF interval<device>is 2 hex digits long from 00-1F interval<function>is 1 hex digit long from 0-7 interval
Exceptions that can be thrown by amdsmi_get_gpu_device_bdf function:
AmdSmiParameterExceptionAmdSmiLibraryException
Example:
try:
device = amdsmi_get_processor_handles()[0]
print("Device's bdf:", amdsmi_get_gpu_device_bdf(device))
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_device_uuid
Description: Returns the UUID of the device
Input parameters:
processor_handledev for which to query
Output: UUID string unique to the device
Exceptions that can be thrown by amdsmi_get_gpu_device_uuid function:
AmdSmiParameterExceptionAmdSmiLibraryException
Example:
try:
device = amdsmi_get_processor_handles()[0]
print("Device UUID: ", amdsmi_get_gpu_device_uuid(device))
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_driver_info
Description: Returns the info of the driver
Input parameters:
processor_handledev for which to query
Output: Dictionary with fields
| Field | Content |
|---|---|
driver_name |
driver name |
driver_version |
driver_version |
driver_date |
driver_date |
Exceptions that can be thrown by amdsmi_get_gpu_driver_info function:
AmdSmiParameterExceptionAmdSmiLibraryException
Example:
try:
device = amdsmi_get_processor_handles()[0]
print("Driver info: ", amdsmi_get_gpu_driver_info(device))
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_asic_info
Description: Returns asic information for the given GPU
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Content |
|---|---|
market_name |
market name |
vendor_id |
vendor id |
vendor_name |
vendor name |
device_id |
device id |
rev_id |
revision id |
asic_serial |
asic serial |
oam_id |
oam id |
Exceptions that can be thrown by amdsmi_get_gpu_asic_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
asic_info = amdsmi_get_gpu_asic_info(device)
print(asic_info['market_name'])
print(hex(asic_info['vendor_id']))
print(asic_info['vendor_name'])
print(hex(asic_info['device_id']))
print(hex(asic_info['rev_id']))
print(asic_info['asic_serial'])
print(asic_info['oam_id'])
except AmdSmiException as e:
print(e)
amdsmi_get_power_cap_info
Description: Returns dictionary of power capabilities as currently configured on the given GPU. It is not supported on virtual machine guest
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Description |
|---|---|
power_cap |
power capability |
dpm_cap |
dynamic power management capability |
default_power_cap |
default power capability |
min_power_cap |
min power capability |
max_power_cap |
max power capability |
Exceptions that can be thrown by amdsmi_get_power_cap_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
power_info = amdsmi_get_power_cap_info(device)
print(power_info['power_cap'])
print(power_info['dpm_cap'])
print(power_info['default_power_cap'])
print(power_info['min_power_cap'])
print(power_info['max_power_cap'])
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_vram_info
Description: Returns dictionary of vram information for the given GPU.
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Description |
|---|---|
vram_type |
vram type |
vram_vendor |
vram vendor |
vram_size_mb |
vram size in mb |
Exceptions that can be thrown by amdsmi_get_gpu_vram_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
vram_info = amdsmi_get_gpu_vram_info(device)
print(vram_info['vram_type'])
print(vram_info['vram_vendor'])
print(vram_info['vram_size_mb'])
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_cache_info
Description: Returns a list of dictionaries containing cache information for the given GPU.
Input parameters:
processor_handledevice which to query
Output: List of Dictionaries containing cache information following the schema below: Schema:
{
cache_properties:
{
"type" : "array",
"items" : {"type" : "string"}
},
cache_size: {"type" : "number"},
cache_level: {"type" : "number"},
max_num_cu_shared: {"type" : "number"},
num_cache_instance: {"type" : "number"}
}
| Field | Description |
|---|---|
cache_properties |
list of up to 4 cache property type strings. Ex. data ("DATA_CACHE"), instruction ("INST_CACHE"), CPU ("CPU_CACHE"), or SIMD ("SIMD_CACHE"). |
cache_size |
size of cache in KB |
cache_level |
level of cache |
max_num_cu_shared |
max number of compute units shared |
num_cache_instance |
number of cache instances |
Exceptions that can be thrown by amdsmi_get_gpu_cache_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
cache_info = amdsmi_get_gpu_cache_info(device)
for cache_index, cache_values in cache_info.items():
print(cache_values['cache_properties'])
print(cache_values['cache_size'])
print(cache_values['cache_level'])
print(cache_values['max_num_cu_shared'])
print(cache_values['num_cache_instance'])
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_vbios_info
Description: Returns the static information for the VBIOS on the device.
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Description |
|---|---|
name |
vbios name |
build_date |
vbios build date |
part_number |
vbios part number |
version |
vbios version string |
Exceptions that can be thrown by amdsmi_get_gpu_vbios_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
vbios_info = amdsmi_get_gpu_vbios_info(device)
print(vbios_info['name'])
print(vbios_info['build_date'])
print(vbios_info['part_number'])
print(vbios_info['version'])
except AmdSmiException as e:
print(e)
amdsmi_get_fw_info
Description: Returns GPU firmware related information.
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Description |
|---|---|
fw_list |
List of dictionaries that contain information about a certain firmware block |
Exceptions that can be thrown by amdsmi_get_fw_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
firmware_list = amdsmi_get_fw_info(device)['fw_list']
for firmware_block in firmware_list:
print(firmware_block['fw_name'])
# String formated hex or decimal value ie: 21.00.00.AC or 130
print(firmware_block['fw_version'])
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_activity
Description: Returns the engine usage for the given GPU. It is not supported on virtual machine guest
Input parameters:
processor_handledevice which to query
Output: Dictionary of activites to their respective usage percentage or 'N/A' if not supported
| Field | Description |
|---|---|
gfx_activity |
graphics engine usage percentage (0 - 100) |
umc_activity |
memory engine usage percentage (0 - 100) |
mm_activity |
average multimedia engine usages in percentage (0 - 100) |
Exceptions that can be thrown by amdsmi_get_gpu_activity function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
engine_usage = amdsmi_get_gpu_activity(device)
print(engine_usage['gfx_activity'])
print(engine_usage['umc_activity'])
print(engine_usage['mm_activity'])
except AmdSmiException as e:
print(e)
amdsmi_get_power_info
Description: Returns the current power and voltage for the given GPU. It is not supported on virtual machine guest
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Description |
|---|---|
average_socket_power |
average socket power |
gfx_voltage |
voltage gfx |
power_limit |
power limit |
Exceptions that can be thrown by amdsmi_get_power_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
power_measure = amdsmi_get_power_info(device)
print(power_measure['average_socket_power'])
print(power_measure['gfx_voltage'])
print(power_measure['power_limit'])
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_vram_usage
Description: Returns total VRAM and VRAM in use
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Description |
|---|---|
vram_total |
VRAM total |
vram_used |
VRAM currently in use |
Exceptions that can be thrown by amdsmi_get_gpu_vram_usage function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
vram_usage = amdsmi_get_gpu_vram_usage(device)
print(vram_usage['vram_used'])
print(vram_usage['vram_total'])
except AmdSmiException as e:
print(e)
amdsmi_get_clock_info
Description: Returns the clock measure for the given GPU. It is not supported on virtual machine guest
Input parameters:
processor_handledevice which to queryclock_typeone ofAmdSmiClkTypeenum values:
| Field | Description |
|---|---|
SYS |
SYS clock type |
GFX |
GFX clock type |
DF |
DF clock type |
DCEF |
DCEF clock type |
SOC |
SOC clock type |
MEM |
MEM clock type |
PCIE |
PCIE clock type |
VCLK0 |
VCLK0 clock type |
VCLK1 |
VCLK1 clock type |
DCLK0 |
DCLK0 clock type |
DCLK1 |
DCLK1 clock type |
Output: Dictionary with fields
| Field | Description |
|---|---|
cur_clk |
Current clock for given clock type |
max_clk |
Maximum clock for given clock type |
min_clk |
Minimum clock for given clock type |
Exceptions that can be thrown by amdsmi_get_clock_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
clock_measure = amdsmi_get_clock_info(device, AmdSmiClkType.GFX)
print(clock_measure['cur_clk'])
print(clock_measure['min_clk'])
print(clock_measure['max_clk'])
except AmdSmiException as e:
print(e)
amdsmi_get_pcie_info
Description: Returns the pcie metric and static information for the given GPU. It is not supported on virtual machine guest
Input parameters:
processor_handledevice which to query
Output: Dictionary with 2 fields pcie_static and pcie_metric
| Fields | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pcie_static |
|
||||||||||||||||||
pcie_metric |
|
Exceptions that can be thrown by amdsmi_get_pcie_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
pcie_info = amdsmi_get_pcie_info(device)
print(pcie_info["pcie_static"])
print(pcie_info["pcie_metric"])
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_bad_page_info
Description: Returns bad page info for the given GPU. It is not supported on virtual machine guest
Input parameters:
processor_handledevice which to query
Output: List consisting of dictionaries with fields for each bad page found
| Field | Description |
|---|---|
value |
Value of page |
page_address |
Address of bad page |
page_size |
Size of bad page |
status |
Status of bad page |
Exceptions that can be thrown by amdsmi_get_gpu_bad_page_info function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
bad_page_info = amdsmi_get_gpu_bad_page_info(device)
if not len(bad_page_info):
print("No bad pages found")
continue
for bad_page in bad_page_info:
print(bad_page["value"])
print(bad_page["page_address"])
print(bad_page["page_size"])
print(bad_page["status"])
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_process_list
Description: Returns the list of processes running on the target GPU.
Input parameters:
processor_handledevice which to query
Output: List of amdsmi_proc_info_t process objects running on the target GPU; can be empty
Exceptions that can be thrown by amdsmi_get_gpu_process_list function:
AmdSmiLibraryExceptionAmdSmiRetryExceptionAmdSmiParameterException
Example:
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
processes = amdsmi_get_gpu_process_list(device)
if len(processes) == 0:
print("No processes running on this GPU")
else:
for process in processes:
print(amdsmi_get_gpu_process_info(device, process))
except AmdSmiException as e:
print(e)
amdsmi_get_gpu_process_info
Description: Returns info about process given the target GPU and the corresponding amdsmi_proc_info_t object
Input parameters:
processor_handledevice which to query
Output: Dictionary with fields
| Field | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
Name of process | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pid |
Process ID | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mem |
Process memory usage | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
engine_usage |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
memory_usage |
</table
Exceptions that can be thrown by
Example: amdsmi_get_gpu_total_ecc_countDescription: Returns the ECC error count for the given GPU. It is not supported on virtual machine guest Input parameters:
Output: Dictionary with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_board_infoDescription: Returns board info for the given GPU Input parameters:
Output: Dictionary with fields correctable and uncorrectable
Exceptions that can be thrown by
Example: amdsmi_get_gpu_ras_feature_infoDescription: Returns RAS version and schema information It is not supported on virtual machine guest Input parameters:
Output: List containing dictionaries with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_ras_block_features_enabledDescription: Returns status of each RAS block for the given GPU. It is not supported on virtual machine guest Input parameters:
Output: List containing dictionaries with fields for each RAS block
Exceptions that can be thrown by
Example: AmdSmiEventReader classDescription: Providing methods for event monitoring. This is context manager class.
Can be used with Methods: ConstructorDescription: Allocates a new event reader notifier to monitor different types of events for the given GPU Input parameters:
readDescription: Reads events on the given device. When event is caught, device handle, message and event type are returned. Reading events stops when timestamp passes without event reading. Input parameters:
stopDescription: Any resources used by event notification for the the given device will be freed with this function. This can be used explicitly or
automatically using Input parameters: Example with manual cleanup of AmdSmiEventReader: Example with automatic cleanup using amdsmi_set_gpu_pci_bandwidthDescription: Control the set of allowed PCIe bandwidths that can be used It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_set_power_capDescription: Set the power cap value. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_set_gpu_power_profileDescription: Set the power profile. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_set_gpu_clk_rangeDescription: This function sets the clock range information. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_get_gpu_bdf_idDescription: Get the unique PCI device identifier associated for a device Input parameters:
Output: device bdf The format of bdfid will be as follows: BDFID = ((DOMAIN & 0xffffffff) << 32) | ((BUS & 0xff) << 8) | ((DEVICE & 0x1f) <<3 ) | (FUNCTION & 0x7)
Exceptions that can be thrown by
Example: amdsmi_get_gpu_pci_bandwidthDescription: Get the list of possible PCIe bandwidths that are available. It is not supported on virtual machine guest Input parameters:
Output: Dictionary with the possible T/s values and associated number of lanes
transfer_rate dictionary
Exceptions that can be thrown by
Example: amdsmi_get_gpu_pci_throughputDescription: Get PCIe traffic information. It is not supported on virtual machine guest Input parameters:
Output: Dictionary with the fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_pci_replay_counterDescription: Get PCIe replay counter Input parameters:
Output: counter value The sum of the NAK's received and generated by the GPU Exceptions that can be thrown by
Example: amdsmi_get_gpu_topo_numa_affinityDescription: Get the NUMA node associated with a device Input parameters:
Output: NUMA node value Exceptions that can be thrown by
Example: amdsmi_get_energy_countDescription: Get the energy accumulator counter of the device. It is not supported on virtual machine guest Input parameters:
Output: Dictionary with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_memory_totalDescription: Get the total amount of memory that exists Input parameters:
Output: total amount of memory Exceptions that can be thrown by
Example: amdsmi_set_gpu_od_clk_infoDescription: This function sets the clock frequency information It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_get_gpu_memory_usageDescription: Get the current memory usage Input parameters:
Output: the amount of memory currently being used Exceptions that can be thrown by
Example: amdsmi_set_gpu_od_volt_infoDescription: This function sets 1 of the 3 voltage curve points. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_get_gpu_fan_rpmsDescription: Get the fan speed in RPMs of the device with the specified device handle and 0-based sensor index. It is not supported on virtual machine guest Input parameters:
Output: Fan speed in rpms as integer Exceptions that can be thrown by
Example: amdsmi_get_gpu_fan_speedDescription: Get the fan speed for the specified device as a value relative to AMDSMI_MAX_FAN_SPEED. It is not supported on virtual machine guest Input parameters:
Output: Fan speed in relative to MAX Exceptions that can be thrown by
Example: amdsmi_get_gpu_fan_speed_maxDescription: Get the max fan speed of the device with provided device handle. It is not supported on virtual machine guest Input parameters:
Output: Max fan speed as integer Exceptions that can be thrown by
Example: amdsmi_is_gpu_power_management_enabledDescription: Returns is power management enabled Input parameters:
Output: Bool true if power management enabled else false Exceptions that can be thrown by
Example: amdsmi_get_temp_metricDescription: Get the temperature metric value for the specified metric, from the specified temperature sensor on the specified device. It is not supported on virtual machine guest Input parameters:
Output: Temperature as integer in millidegrees Celcius Exceptions that can be thrown by
Example: amdsmi_get_gpu_volt_metricDescription: Get the voltage metric value for the specified metric, from the specified voltage sensor on the specified device. It is not supported on virtual machine guest Input parameters:
Output: Voltage as integer in millivolts Exceptions that can be thrown by
Example: amdsmi_get_utilization_countDescription: Get coarse grain utilization counter of the specified device Input parameters:
Output: List containing dictionaries with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_perf_levelDescription: Get the performance level of the device with provided device handle. It is not supported on virtual machine guest Input parameters:
Output: Performance level as enum value of dev_perf_level_t Exceptions that can be thrown by
Example: amdsmi_set_gpu_perf_determinism_modeDescription: Enter performance determinism mode with provided device handle. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_get_gpu_overdrive_levelDescription: Get the overdrive percent associated with the device with provided device handle. It is not supported on virtual machine guest Input parameters:
Output: Overdrive percentage as integer Exceptions that can be thrown by
Example: amdsmi_get_clk_freqDescription: Get the list of possible system clock speeds of device for a specified clock type. It is not supported on virtual machine guest Input parameters:
Output: Dictionary with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_od_volt_infoDescription: This function retrieves the voltage/frequency curve information It is not supported on virtual machine guest Input parameters:
Output: Dictionary with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_metrics_infoDescription: This function retrieves the gpu metrics information. It is not supported on virtual machine guest Input parameters:
Output: Dictionary with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_od_volt_curve_regionsDescription: This function will retrieve the current valid regions in the frequency/voltage space. It is not supported on virtual machine guest Input parameters:
Output: List containing a dictionary with fields for each freq volt region
Exceptions that can be thrown by
Example: amdsmi_get_gpu_power_profile_presetsDescription: Get the list of available preset power profiles and an indication of which profile is currently active. It is not supported on virtual machine guest Input parameters:
Output: Dictionary with fields
Exceptions that can be thrown by
Example: amdsmi_gpu_counter_group_supportedDescription: Tell if an event group is supported by a given device. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_gpu_create_counterDescription: Creates a performance counter object Input parameters:
Output: An event handle of the newly created performance counter object Exceptions that can be thrown by
Example: amdsmi_gpu_destroy_counterDescription: Destroys a performance counter object Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_gpu_control_counterDescription: Issue performance counter control commands. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_gpu_read_counterDescription: Read the current value of a performance counter Input parameters:
Output: Dictionary with fields
Exceptions that can be thrown by
Example: amdsmi_get_gpu_available_countersDescription: Get the number of currently available counters. It is not supported on virtual machine guest Input parameters:
Output: Number of available counters for the given device of the inputted event group Exceptions that can be thrown by
Example: amdsmi_set_gpu_perf_levelDescription: Set a desired performance level for given device. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_reset_gpuDescription: Reset the gpu associated with the device with provided device handle It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_set_gpu_fan_speedDescription: Set the fan speed for the specified device with the provided speed, in RPMs. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_reset_gpu_fanDescription: Reset the fan to automatic driver control. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_set_clk_freqDescription: Control the set of allowed frequencies that can be used for the specified clock. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_set_xgmi_plpdDescription: Set the xgmi per-link power down policy parameter for the processor Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_get_xgmi_plpdDescription: Get the xgmi per-link power down policy parameter for the processor Input parameters:
Output: Dict containing information about xgmi per-link power down policy
Exceptions that can be thrown by
Example: amdsmi_set_gpu_overdrive_levelDescription: deprecated Set the overdrive percent associated with the device with provided device handle with the provided value. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_get_gpu_ecc_countDescription: Retrieve the error counts for a GPU block. It is not supported on virtual machine guest Input parameters:
Output: Dict containing information about error counts
Exceptions that can be thrown by
Example: amdsmi_get_gpu_ecc_enabledDescription: Retrieve the enabled ECC bit-mask. It is not supported on virtual machine guest Input parameters:
Output: Enabled ECC bit-mask Exceptions that can be thrown by
Example: amdsmi_get_gpu_ecc_statusDescription: Retrieve the ECC status for a GPU block. It is not supported on virtual machine guest Input parameters:
Output: ECC status for a requested GPU block Exceptions that can be thrown by
Example: amdsmi_status_code_to_stringDescription: Get a description of a provided AMDSMI error status Input parameters:
Output: String description of the provided error code Exceptions that can be thrown by
Example: amdsmi_get_gpu_compute_process_infoDescription: Get process information about processes currently using GPU Input parameters: None Output: List of python dicts each containing a process information
Exceptions that can be thrown by
Example: amdsmi_get_gpu_compute_process_info_by_pidDescription: Get process information about processes currently using GPU Input parameters:
Output: Dict containing a process information
Exceptions that can be thrown by
Example: amdsmi_get_gpu_compute_process_gpusDescription: Get the device indices currently being used by a process Input parameters:
Output: List of indices of devices currently being used by the process Exceptions that can be thrown by
Example: amdsmi_gpu_xgmi_error_statusDescription: Retrieve the XGMI error status for a device. It is not supported on virtual machine guest Input parameters:
Output: XGMI error status for a requested device Exceptions that can be thrown by
Example: amdsmi_reset_gpu_xgmi_errorDescription: Reset the XGMI error status for a device. It is not supported on virtual machine guest Input parameters:
Output: None Exceptions that can be thrown by
Example: amdsmi_get_gpu_vendor_nameDescription: Returns the device vendor name Input parameters:
Output: device vendor name Exceptions that can be thrown by
Example: amdsmi_get_gpu_idDescription: Get the device id associated with the device with provided device handler Input parameters:
Output: device id Exceptions that can be thrown by
Example: amdsmi_get_gpu_vram_vendorDescription: Get the vram vendor string of a gpu device. Input parameters:
Output: vram vendor Exceptions that can be thrown by
Example: amdsmi_get_gpu_subsystem_idDescription: Get the subsystem device id associated with the device with provided device handle. Input parameters:
Output: subsystem device id Exceptions that can be thrown by
Example: amdsmi_get_gpu_subsystem_nameDescription: Get the name string for the device subsytem Input parameters:
Output: device subsytem Exceptions that can be thrown by
Example: amdsmi_get_lib_versionDescription: Get the build version information for the currently running build of AMDSMI. Output: amdsmi build version Exceptions that can be thrown by
Example: amdsmi_topo_get_numa_node_numberDescription: Retrieve the NUMA CPU node number for a device Input parameters:
Output: node number of NUMA CPU for the device Exceptions that can be thrown by
Example: amdsmi_topo_get_link_weightDescription: Retrieve the weight for a connection between 2 GPUs. Input parameters:
Output: the weight for a connection between 2 GPUs Exceptions that can be thrown by
Example: amdsmi_get_minmax_bandwidth_between_processorsDescription: Retreive minimal and maximal io link bandwidth between 2 GPUs. Input parameters:
Output: Dictionary with fields:
Exceptions that can be thrown by
Example: amdsmi_topo_get_link_typeDescription: Retrieve the hops and the connection type between 2 GPUs Input parameters:
Output: Dictionary with fields:
Exceptions that can be thrown by
Example: amdsmi_is_P2P_accessibleDescription: Return P2P availability status between 2 GPUs Input parameters:
Output: P2P availability status between 2 GPUs Exceptions that can be thrown by
Example: amdsmi_get_gpu_compute_partitionDescription: Get the compute partition from the given GPU Input parameters:
Output: String of the partition type Exceptions that can be thrown by
Example: amdsmi_set_gpu_compute_partitionDescription: Set the compute partition to the given GPU Input parameters:
Output: String of the partition type Exceptions that can be thrown by
Example: amdsmi_reset_gpu_compute_partitionDescription: Reset the compute partitioning on the given GPU Input parameters:
Output: String of the partition type Exceptions that can be thrown by
Example: amdsmi_get_gpu_memory_partitionDescription: Get the memory partition from the given GPU Input parameters:
Output: String of the partition type Exceptions that can be thrown by
Example: amdsmi_set_gpu_memory_partitionDescription: Set the memory partition to the given GPU Input parameters:
Output: String of the partition type Exceptions that can be thrown by
Example: amdsmi_reset_gpu_memory_partitionDescription: Reset the memory partitioning on the given GPU Input parameters:
Output: String of the partition type Exceptions that can be thrown by
Example: amdsmi_get_xgmi_infoDescription: Returns XGMI information for the GPU. Input parameters:
Output: Dictionary with fields:
Exceptions that can be thrown by
Example: CPU APIsamdsmi_get_processor_infoNote: CURRENTLY HARDCODED TO RETURN EMPTY VALUES Description: Return processor name Input parameters:
Output: Processor name Exceptions that can be thrown by
Example: amdsmi_get_cpu_hsmp_proto_verDescription: Get the hsmp protocol version. Output: amdsmi hsmp protocol version Exceptions that can be thrown by
Example: amdsmi_get_cpu_smu_fw_versionDescription: Get the SMU Firmware version. Output: amdsmi SMU Firmware version Exceptions that can be thrown by
Example: amdsmi_get_cpu_prochot_statusDescription: Get the CPU's prochot status. Output: amdsmi cpu prochot status Exceptions that can be thrown by
Example: amdsmi_get_cpu_fclk_mclkDescription: Get the Data fabric clock and Memory clock in MHz. Output: amdsmi data fabric clock and memory clock Exceptions that can be thrown by
Example: amdsmi_get_cpu_cclk_limitDescription: Get the core clock in MHz. Output: amdsmi core clock Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_current_active_freq_limitDescription: Get current active frequency limit of the socket. Output: amdsmi frequency value in MHz and frequency source name Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_freq_rangeDescription: Get socket frequency range Output: amdsmi maximum frequency and minimum frequency Exceptions that can be thrown by
Example: amdsmi_get_cpu_core_current_freq_limitDescription: Get socket frequency limit of the core Output: amdsmi frequency Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_powerDescription: Get the socket power. Output: amdsmi socket power Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_power_capDescription: Get the socket power cap. Output: amdsmi socket power cap Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_power_cap_maxDescription: Get the socket power cap max. Output: amdsmi socket power cap max Exceptions that can be thrown by
Example: amdsmi_get_cpu_pwr_svi_telemetry_all_railsDescription: Get the SVI based power telemetry for all rails. Output: amdsmi svi based power value Exceptions that can be thrown by
Example: amdsmi_set_cpu_socket_power_capDescription: Set the power cap value for a given socket. Input: amdsmi socket power cap value Exceptions that can be thrown by
Example: amdsmi_set_cpu_pwr_efficiency_modeDescription: Set the power efficiency profile policy. Input: mode(0, 1, or 2) Exceptions that can be thrown by
Example: amdsmi_get_cpu_core_boostlimitDescription: Get boost limit of the cpu core Output: amdsmi frequency Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_c0_residencyDescription: Get the cpu socket C0 residency. Output: amdsmi C0 residency value Exceptions that can be thrown by
Example: amdsmi_set_cpu_core_boostlimitDescription: Set the cpu core boost limit. Output: amdsmi boostlimit value Exceptions that can be thrown by
Example: amdsmi_set_cpu_socket_boostlimitDescription: Set the cpu socket boost limit. Input: amdsmi boostlimit value Exceptions that can be thrown by
Example: amdsmi_get_cpu_ddr_bwDescription: Get the CPU DDR Bandwidth. Output: amdsmi ddr bandwidth data Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_temperatureDescription: Get the socket temperature. Output: amdsmi temperature value Exceptions that can be thrown by
Example: amdsmi_get_cpu_dimm_temp_range_and_refresh_rateDescription: Get DIMM temperature range and refresh rate. Output: amdsmi dimm metric data Exceptions that can be thrown by
Example: amdsmi_get_cpu_dimm_power_consumptionDescription: amdsmi_get_cpu_dimm_power_consumption. Output: amdsmi dimm power consumption value Exceptions that can be thrown by
Example: amdsmi_get_cpu_dimm_thermal_sensorDescription: Get DIMM thermal sensor value. Output: amdsmi dimm temperature data Exceptions that can be thrown by
Example: amdsmi_set_cpu_xgmi_widthDescription: Set xgmi width. Input: amdsmi xgmi width Exceptions that can be thrown by
Example: amdsmi_set_cpu_gmi3_link_width_rangeDescription: Set gmi3 link width range. Input: minimum & maximum link width to be set. Exceptions that can be thrown by
Example: amdsmi_cpu_apb_enableDescription: Enable APB. Input: amdsmi processor handle Exceptions that can be thrown by
Example: amdsmi_cpu_apb_disableDescription: Disable APB. Input: pstate value Exceptions that can be thrown by
Example: amdsmi_set_cpu_socket_lclk_dpm_levelDescription: Set NBIO lclk dpm level value. Input: nbio id, min value, max value Exceptions that can be thrown by
Example: amdsmi_get_cpu_socket_lclk_dpm_levelDescription: Get NBIO LCLK dpm level. Output: nbio id Exceptions that can be thrown by
Example: amdsmi_set_cpu_pcie_link_rateDescription: Set pcie link rate. Input: rate control value Exceptions that can be thrown by
Example: amdsmi_set_cpu_df_pstate_rangeDescription: Set df pstate range. Input: max pstate, min pstate Exceptions that can be thrown by
Example: amdsmi_get_cpu_current_io_bandwidthDescription: Get current input output bandwidth. Output: link id and bw type to which io bandwidth to be obtained Exceptions that can be thrown by
Example: amdsmi_get_cpu_current_xgmi_bwDescription: Get current xgmi bandwidth. Output: amdsmi link id and bw type to which xgmi bandwidth to be obtained Exceptions that can be thrown by
Example: amdsmi_get_hsmp_metrics_table_versionDescription: Get HSMP metrics table version. Output: amdsmi HSMP metrics table version Exceptions that can be thrown by
Example: amdsmi_get_hsmp_metrics_tableDescription: Get HSMP metrics table Output: HSMP metric table data Exceptions that can be thrown by
Example: amdsmi_first_online_core_on_cpu_socketDescription: Get first online core on cpu socket. Output: first online core on cpu socket Exceptions that can be thrown by
Example: amdsmi_get_cpu_familyDescription: Get cpu family. Output: cpu family Exceptions that can be thrown by
Example: amdsmi_get_cpu_modelDescription: Get cpu model. Output: cpu model Exceptions that can be thrown by
Example: |