2023-06-01 17:14:35 -06:00
# AMD SMI Python Library
## Requirements
2023-10-25 18:52:46 -05:00
* python 3.6+ 64-bit
2022-11-09 16:17:43 +01:00
* driver must be loaded for amdsmi_init() to pass
2022-10-11 16:06:32 +02:00
2023-06-01 17:14:35 -06:00
## Overview
## Folder structure
2022-10-11 16:06:32 +02:00
File Name | Note
---|---
`__init__.py` | Python package initialization file
2022-11-09 16:17:43 +01:00
`amdsmi_interface.py` | Amdsmi library python interface
`amdsmi_wrapper.py` | Python wrapper around amdsmi binary
`amdsmi_exception.py` | Amdsmi exceptions python file
2022-10-11 16:06:32 +02:00
`README.md` | Documentation
2023-06-01 17:14:35 -06:00
## Usage
2022-10-11 16:06:32 +02:00
`amdsmi` folder should be copied and placed next to importing script. It should be imported as:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
from amdsmi import *
try :
2022-11-09 16:17:43 +01:00
amdsmi_init ( )
2022-10-11 16:06:32 +02:00
# amdsmi calls ...
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
finally :
try :
2022-11-09 16:17:43 +01:00
amdsmi_shut_down ( )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2022-11-09 16:17:43 +01:00
To initialize amdsmi lib, amdsmi_init() must be called before all other calls to amdsmi lib.
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
To close connection to driver, amdsmi_shut_down() must be the last call.
2022-10-11 16:06:32 +02:00
2023-06-01 17:14:35 -06:00
## Exceptions
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
All exceptions are in `amdsmi_exception.py` file.
2022-10-11 16:06:32 +02:00
Exceptions that can be thrown are:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiException` : base amdsmi exception class
* `AmdSmiLibraryException` : derives base `AmdSmiException` class and represents errors that can occur in amdsmi-lib.
2022-10-11 16:06:32 +02:00
When this exception is thrown, `err_code` and `err_info` are set. `err_code` is an integer that corresponds to errors that can occur
2022-11-09 16:17:43 +01:00
in amdsmi-lib and `err_info` is a string that explains the error that occurred.
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
num_of_GPUs = len ( amdsmi_get_processor_handles ( ) )
2022-10-11 16:06:32 +02:00
if num_of_GPUs == 0 :
print ( " No GPUs on machine " )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( " Error code: {} " . format ( e . err_code ) )
2023-09-24 16:12:30 -05:00
if e . err_code == amdsmi_wrapper . AMDSMI_STATUS_RETRY :
2022-10-11 16:06:32 +02:00
print ( " Error info: {} " . format ( e . err_info ) )
```
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiRetryException` : Derives `AmdSmiLibraryException` class and signals device is busy and call should be retried.
* `AmdSmiTimeoutException` : Derives `AmdSmiLibraryException` class and represents that call had timed out.
* `AmdSmiParameterException` : Derives base `AmdSmiException` class 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 base `AmdSmiException` class and represents invalid bdf format.
2022-10-11 16:06:32 +02:00
2023-06-01 17:14:35 -06:00
## API
### amdsmi_init
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Description: Initialize amdsmi lib and connect to driver
2022-10-11 16:06:32 +02:00
Input parameters: `None`
Output: `None`
2022-11-09 16:17:43 +01:00
Exceptions that can be thrown by `amdsmi_init` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2022-11-09 16:17:43 +01:00
amdsmi_init ( )
2022-10-11 16:06:32 +02:00
# continue with amdsmi
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( " Init failed " )
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_shut_down
2022-10-11 16:06:32 +02:00
Description: Finalize and close connection to driver
Input parameters: `None`
Output: `None`
2022-11-09 16:17:43 +01:00
Exceptions that can be thrown by `amdsmi_shut_down` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2022-11-09 16:17:43 +01:00
amdsmi_init ( )
amdsmi_shut_down ( )
except AmdSmiException as e :
print ( " Shut down failed " )
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_processor_type
2022-11-09 16:17:43 +01:00
Description: Checks the type of device with provided handle.
2022-10-11 16:06:32 +02:00
2023-02-25 05:26:14 -05:00
Input parameters: device handle as an instance of `amdsmi_processor_handle`
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Output: Integer, type of gpu
2022-10-11 16:06:32 +02:00
2023-02-25 05:30:19 -05:00
Exceptions that can be thrown by `amdsmi_get_processor_type` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:30:19 -05:00
type_of_GPU = amdsmi_get_processor_type ( processor_handle )
2022-11-09 16:17:43 +01:00
if type_of_GPU == 1 :
print ( " This is an AMD GPU " )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_processor_handles
2022-10-11 16:06:32 +02:00
Description: Returns list of GPU device handle objects on current machine
Input parameters: `None`
Output: List of GPU device handle objects
2023-02-25 05:28:40 -05:00
Exceptions that can be thrown by `amdsmi_get_processor_handles` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 06:52:56 -05:00
print ( amdsmi_get_gpu_device_uuid ( device ) )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_socket_handles
2022-11-14 12:49:13 +01:00
**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:
2023-06-01 17:14:35 -06:00
2022-11-14 12:49:13 +01:00
* `AmdSmiLibraryException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-14 12:49:13 +01:00
``` python
try :
sockets = amdsmi_get_socket_handles ( )
print ( ' Socket numbers: {} ' . format ( len ( sockets ) ) )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_socket_info
2022-11-14 12:49:13 +01:00
**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:
2023-06-01 17:14:35 -06:00
2022-11-14 12:49:13 +01:00
* `AmdSmiLibraryException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-14 12:49:13 +01:00
``` python
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 )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_processor_handle_from_bdf
2022-11-14 12:49:13 +01:00
2022-10-11 16:06:32 +02:00
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:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
* `<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
2023-02-25 05:28:40 -05:00
Exceptions that can be thrown by `amdsmi_get_processor_handle_from_bdf` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiBdfFormatException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
device = amdsmi_get_processor_handle_from_bdf ( " 0000:23:00.0 " )
2023-02-25 06:52:56 -05:00
print ( amdsmi_get_gpu_device_uuid ( device ) )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_device_bdf
2022-10-11 16:06:32 +02:00
Description: Returns BDF of the given device
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` dev for which to query
2022-10-11 16:06:32 +02:00
Output: BDF string in form of `<domain>:<bus>:<device>.<function>` in hexcode format.
Where:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
* `<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
2023-02-25 06:38:47 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_device_bdf` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiParameterException`
* `AmdSmiLibraryException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
device = amdsmi_get_processor_handles ( ) [ 0 ]
2023-02-25 06:38:47 -05:00
print ( " Device ' s bdf: " , amdsmi_get_gpu_device_bdf ( device ) )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_device_uuid
2022-10-11 16:06:32 +02:00
Description: Returns the UUID of the device
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` dev for which to query
2022-10-11 16:06:32 +02:00
Output: UUID string unique to the device
2023-02-25 06:52:56 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_device_uuid` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiParameterException`
* `AmdSmiLibraryException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
device = amdsmi_get_processor_handles ( ) [ 0 ]
2023-02-25 06:52:56 -05:00
print ( " Device UUID: " , amdsmi_get_gpu_device_uuid ( device ) )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-07-21 08:26:59 -05:00
### amdsmi_get_gpu_driver_info
2023-06-01 17:14:35 -06:00
2023-07-21 08:26:59 -05:00
Description: Returns the info of the driver
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` dev for which to query
2022-10-11 16:06:32 +02:00
2023-09-29 13:46:46 -05:00
Output: Dictionary with fields
Field | Content
---|---
`driver_name` | driver name
`driver_version` | driver_version
`driver_date` | driver_date
2022-10-11 16:06:32 +02:00
2023-07-21 08:26:59 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_driver_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiParameterException`
* `AmdSmiLibraryException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
device = amdsmi_get_processor_handles ( ) [ 0 ]
2023-07-21 08:26:59 -05:00
print ( " Driver info: " , amdsmi_get_gpu_driver_info ( device ) )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_asic_info
2022-10-11 16:06:32 +02:00
Description: Returns asic information for the given GPU
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Content
---|---
`market_name` | market name
`vendor_id` | vendor id
2023-09-22 03:52:09 -05:00
`vendor_name` | vendor name
2022-10-11 16:06:32 +02:00
`device_id` | device id
`rev_id` | revision id
2022-11-09 16:17:43 +01:00
`asic_serial` | asic serial
2023-11-22 12:16:38 -06:00
`oam_id` | oam id
2022-10-11 16:06:32 +02:00
2023-02-25 07:22:16 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_asic_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:22:16 -05:00
asic_info = amdsmi_get_gpu_asic_info ( device )
2022-10-11 16:06:32 +02:00
print ( asic_info [ ' market_name ' ] )
print ( hex ( asic_info [ ' vendor_id ' ] ) )
2023-10-11 13:28:27 -05:00
print ( asic_info [ ' vendor_name ' ] )
2022-10-11 16:06:32 +02:00
print ( hex ( asic_info [ ' device_id ' ] ) )
print ( hex ( asic_info [ ' rev_id ' ] ) )
2022-11-09 16:17:43 +01:00
print ( asic_info [ ' asic_serial ' ] )
2023-11-22 12:16:38 -06:00
print ( asic_info [ ' oam_id ' ] )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_power_cap_info
2022-10-11 16:06:32 +02:00
Description: Returns dictionary of power capabilities as currently configured
2023-06-20 14:41:19 +02:00
on the given GPU. It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
`power_cap` | power capability
2023-03-28 15:32:17 -05:00
`dpm_cap` | dynamic power management capability
2023-06-01 14:46:21 +02:00
`default_power_cap` | default power capability
2023-03-28 15:32:17 -05:00
`min_power_cap` | min power capability
`max_power_cap` | max power capability
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Exceptions that can be thrown by `amdsmi_get_power_cap_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2022-11-09 16:17:43 +01:00
power_info = amdsmi_get_power_cap_info ( device )
2022-10-11 16:06:32 +02:00
print ( power_info [ ' power_cap ' ] )
2023-03-28 15:32:17 -05:00
print ( power_info [ ' dpm_cap ' ] )
2023-06-01 14:46:21 +02:00
print ( power_info [ ' default_power_cap ' ] )
2023-03-28 15:32:17 -05:00
print ( power_info [ ' min_power_cap ' ] )
print ( power_info [ ' max_power_cap ' ] )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-10-10 20:42:52 -05:00
### amdsmi_get_gpu_vram_info
Description: Returns dictionary of vram information for the given GPU.
Input parameters:
* `processor_handle` device 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:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
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 dictionary of cache information for the given GPU.
Input parameters:
* `processor_handle` device which to query
Output: Dictionary of Dictionaries containing cache information
Field | Description
---|---
2024-01-17 16:28:39 -06:00
`cache_index` | cache index - up to 10 caches will be available
`cache_flags` | list of up to 4 cache property type strings. Ex. data ("DATA_CACHE"), instruction ("INST_CACHE"), CPU ("CPU_CACHE"), or SIMD ("SIMD_CACHE").
2023-10-10 20:42:52 -05:00
`cache_size` | size of cache in KB
`cache_level` | level of cache
2024-01-17 16:28:39 -06:00
`max_num_cu_shared` | max number of compute units shared
`num_cache_instance` | number of cache instances
2023-10-10 20:42:52 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_cache_info` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
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_index )
print ( cache_values [ ' cache_size ' ] )
print ( cache_values [ ' cache_level ' ] )
2023-11-02 05:38:44 -05:00
print ( cache_values [ ' data_cache ' ] )
print ( cache_values [ ' instruction_cache ' ] )
print ( cache_values [ ' cpu_cache ' ] )
print ( cache_values [ ' simd_cache ' ] )
2023-10-10 20:42:52 -05:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_vbios_info
2022-10-11 16:06:32 +02:00
Description: Returns the static information for the VBIOS on the device.
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`name` | vbios name
`build_date` | vbios build date
`part_number` | vbios part number
2023-05-17 15:45:18 +02:00
`version` | vbios version string
2022-10-11 16:06:32 +02:00
2023-02-25 07:45:11 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_vbios_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:45:11 -05:00
vbios_info = amdsmi_get_gpu_vbios_info ( device )
2022-11-09 16:17:43 +01:00
print ( vbios_info [ ' name ' ] )
print ( vbios_info [ ' build_date ' ] )
print ( vbios_info [ ' part_number ' ] )
2023-05-17 15:45:18 +02:00
print ( vbios_info [ ' version ' ] )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_fw_info
2022-11-09 16:17:43 +01:00
Description: Returns GPU firmware related information.
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Output: Dictionary with fields
2022-10-11 16:06:32 +02:00
Field | Description
---|---
2022-12-28 16:11:10 +01:00
`fw_list` | List of dictionaries that contain information about a certain firmware block
2022-11-09 16:17:43 +01:00
Exceptions that can be thrown by `amdsmi_get_fw_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2022-12-28 16:11:10 +01:00
firmware_list = amdsmi_get_fw_info ( device ) [ ' fw_list ' ]
for firmware_block in firmware_list :
print ( firmware_block [ ' fw_name ' ] )
2023-11-02 02:18:40 -05:00
# String formated hex or decimal value ie: 21.00.00.AC or 130
print ( firmware_block [ ' fw_version ' ] )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_activity
2023-06-20 14:41:19 +02:00
Description: Returns the engine usage for the given GPU.
It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`gfx_activity` | graphics engine usage percentage (0 - 100)
`umc_activity` | memory engine usage percentage (0 - 100)
2023-05-17 15:45:18 +02:00
`mm_activity` | average multimedia engine usages in percentage (0 - 100)
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Exceptions that can be thrown by `amdsmi_get_gpu_activity` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2022-11-09 16:17:43 +01:00
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 :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_power_info
2023-06-20 14:41:19 +02:00
Description: Returns the current power and voltage for the given GPU.
It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`average_socket_power` | average socket power
2023-05-16 12:31:52 +02:00
`gfx_voltage` | voltage gfx
2023-01-20 10:54:01 +01:00
`power_limit` | power limit
2022-10-11 16:06:32 +02:00
2023-05-16 12:31:52 +02:00
Exceptions that can be thrown by `amdsmi_get_power_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-05-16 12:31:52 +02:00
power_measure = amdsmi_get_power_info ( device )
2022-11-09 16:17:43 +01:00
print ( power_measure [ ' average_socket_power ' ] )
2023-05-16 12:31:52 +02:00
print ( power_measure [ ' gfx_voltage ' ] )
2023-01-20 10:54:01 +01:00
print ( power_measure [ ' power_limit ' ] )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_vram_usage
2022-11-09 16:17:43 +01:00
Description: Returns total VRAM and VRAM in use
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`vram_total` | VRAM total
2023-02-24 14:43:20 +01:00
`vram_used` | VRAM currently in use
2022-10-11 16:06:32 +02:00
2023-02-25 07:47:11 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_vram_usage` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:47:11 -05:00
vram_usage = amdsmi_get_gpu_vram_usage ( device )
2022-11-09 16:17:43 +01:00
print ( vram_usage [ ' vram_used ' ] )
print ( vram_usage [ ' vram_total ' ] )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_clock_info
2023-06-20 14:41:19 +02:00
Description: Returns the clock measure for the given GPU.
It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-12-28 12:55:15 +01:00
* `clock_type` one of `AmdSmiClkType` enum values:
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
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
2022-10-11 16:06:32 +02:00
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`cur_clk` | Current clock for given clock type
`max_clk` | Maximum clock for given clock type
2023-06-01 14:46:21 +02:00
`min_clk` | Minimum clock for given clock type
2022-11-09 16:17:43 +01:00
2023-05-16 12:31:52 +02:00
Exceptions that can be thrown by `amdsmi_get_clock_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 16:17:43 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-05-16 12:31:52 +02:00
clock_measure = amdsmi_get_clock_info ( device , AmdSmiClkType . GFX )
2022-11-09 16:17:43 +01:00
print ( clock_measure [ ' cur_clk ' ] )
print ( clock_measure [ ' min_clk ' ] )
print ( clock_measure [ ' max_clk ' ] )
except AmdSmiException as e :
print ( e )
```
2022-10-11 16:06:32 +02:00
2023-06-01 17:14:35 -06:00
### amdsmi_get_pcie_link_status
2023-06-20 14:41:19 +02:00
Description: Returns the pcie link status for the given GPU.
It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2022-11-09 16:17:43 +01:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`pcie_lanes` | pcie lanes in use
`pcie_speed` | current pcie speed
2023-08-01 06:20:12 -05:00
`pcie_interface_version` | current pcie generation
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Exceptions that can be thrown by `amdsmi_get_pcie_link_status` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2022-11-09 16:17:43 +01:00
pcie_link_status = amdsmi_get_pcie_link_status ( device )
print ( pcie_link_status [ " pcie_lanes " ] )
print ( pcie_link_status [ " pcie_speed " ] )
2023-08-01 06:20:12 -05:00
print ( pcie_link_status [ " pcie_interface_version " ] )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_pcie_link_caps
2022-11-09 16:17:43 +01:00
Description: Returns the max pcie link capabilities for the given GPU
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`pcie_lanes` | Number of PCIe lanes
`pcie_speed` | PCIe speed in MT/s
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Exceptions that can be thrown by `amdsmi_get_pcie_link_caps` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2022-11-09 16:17:43 +01:00
pcie_caps = amdsmi_get_pcie_link_caps ( device )
print ( pcie_caps [ ' pcie_lanes ' ] )
print ( pcie_caps [ ' pcie_speed ' ] )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_bad_page_info
2023-06-20 14:41:19 +02:00
Description: Returns bad page info for the given GPU.
It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Output: List consisting of dictionaries with fields for each bad page found
2022-10-11 16:06:32 +02:00
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`value` | Value of page
`page_address` | Address of bad page
`page_size` | Size of bad page
`status` | Status of bad page
2022-10-11 16:06:32 +02:00
2023-02-27 01:18:07 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_bad_page_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 01:18:07 -05:00
bad_page_info = amdsmi_get_gpu_bad_page_info ( device )
2022-11-09 16:17:43 +01:00
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 :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_process_list
2022-11-09 16:17:43 +01:00
Description: Returns the list of processes for the given GPU
2022-10-11 16:06:32 +02:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Output: List of process handles found
2022-10-11 16:06:32 +02:00
2023-02-27 01:33:11 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_process_list` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 01:33:11 -05:00
processes = amdsmi_get_gpu_process_list ( device )
2022-11-09 16:17:43 +01:00
print ( processes )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_process_info
2022-11-09 16:17:43 +01:00
Description: Returns the info for the given process
2022-10-11 16:06:32 +02:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-09 16:17:43 +01:00
* `process_handle` process which to query
2022-10-11 16:06:32 +02:00
Output: Dictionary with fields
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`name` | Name of process
`pid` | Process ID
`mem` | Process memory usage
2023-05-17 15:45:18 +02:00
`engine_usage` | <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gfx` </td><td>GFX engine usage in ns</td></tr><tr><td>`enc` </td><td>Encode engine usage in ns</td></tr></tbody></table>
2022-10-11 16:06:32 +02:00
`memory_usage` | <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gtt_mem` </td><td>GTT memory usage</td></tr><tr><td>`cpu_mem` </td><td>CPU memory usage</td></tr><tr><td>`vram_mem` </td><td>VRAM memory usage</td></tr> </tbody></table>
2023-02-27 01:34:28 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_process_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 01:33:11 -05:00
processes = amdsmi_get_gpu_process_list ( device )
2022-11-09 16:17:43 +01:00
for process in processes :
2023-02-27 01:34:28 -05:00
print ( amdsmi_get_gpu_process_info ( device , process ) )
2022-11-09 16:17:43 +01:00
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_total_ecc_count
2023-06-20 14:41:19 +02:00
Description: Returns the ECC error count for the given GPU.
It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Output: Dictionary with fields
2022-10-11 16:06:32 +02:00
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`correctable_count` | Correctable ECC error count
`uncorrectable_count` | Uncorrectable ECC error count
2022-10-11 16:06:32 +02:00
2023-05-31 10:30:59 +02:00
Exceptions that can be thrown by `amdsmi_get_gpu_total_ecc_count` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-05-31 10:30:59 +02:00
ecc_error_count = amdsmi_get_gpu_total_ecc_count ( device )
2022-11-09 16:17:43 +01:00
print ( ecc_error_count [ " correctable_count " ] )
print ( ecc_error_count [ " uncorrectable_count " ] )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_board_info
2022-11-09 16:17:43 +01:00
Description: Returns board info for the given GPU
2022-10-11 16:06:32 +02:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Output: Dictionary with fields correctable and uncorrectable
2022-10-11 16:06:32 +02:00
Field | Description
---|---
2023-10-25 17:13:03 -05:00
`model_number` | Board serial number
2022-11-09 16:17:43 +01:00
`product_serial` | Product serial
2023-10-25 17:13:03 -05:00
`fru_id` | FRU ID
`manufacturer_name` | Manufacturer name
2022-11-09 16:17:43 +01:00
`product_name` | Product name
2022-10-11 16:06:32 +02:00
2023-02-25 07:26:18 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_board_info` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
device = amdsmi_get_processor_handle_from_bdf ( " 0000:23.00.0 " )
2023-02-25 07:26:18 -05:00
board_info = amdsmi_get_gpu_board_info ( device )
2023-10-25 17:13:03 -05:00
print ( board_info [ " model_number " ] )
2022-11-09 16:17:43 +01:00
print ( board_info [ " product_serial " ] )
2023-10-25 17:13:03 -05:00
print ( board_info [ " fru_id " ] )
print ( board_info [ " manufacturer_name " ] )
2022-11-09 16:17:43 +01:00
print ( board_info [ " product_name " ] )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-10-10 14:20:11 -05:00
### amdsmi_get_gpu_ras_feature_info
Description: Returns RAS version and schema information
It is not supported on virtual machine guest
Input parameters:
* `processor_handle` device which to query
Output: List containing dictionaries with fields
Field | Description
---|---
`eeprom_version` | eeprom version
`parity_schema` | parity schema
`single_bit_schema` | single bit schema
`double_bit_schema` | double bit schema
`poison_schema` | poison schema
Exceptions that can be thrown by `amdsmi_get_gpu_ras_feature_info` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
ras_info = amdsmi_get_gpu_ras_feature_info ( device )
print ( ras_info )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_ras_block_features_enabled
2023-06-20 14:41:19 +02:00
Description: Returns status of each RAS block for the given GPU.
It is not supported on virtual machine guest
2022-10-11 16:06:32 +02:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-10-11 16:06:32 +02:00
2022-11-09 16:17:43 +01:00
Output: List containing dictionaries with fields for each RAS block
2022-10-11 16:06:32 +02:00
Field | Description
---|---
2022-11-09 16:17:43 +01:00
`block` | RAS block
`status` | RAS block status
2022-10-11 16:06:32 +02:00
2023-02-27 01:14:03 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_ras_block_features_enabled` function:
2023-06-01 17:14:35 -06:00
2022-11-09 16:17:43 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
2022-10-11 16:06:32 +02:00
Example:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 01:14:03 -05:00
ras_block_features = amdsmi_get_gpu_ras_block_features_enabled ( device )
2022-11-09 16:17:43 +01:00
print ( ras_block_features )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
```
2023-06-01 17:14:35 -06:00
### AmdSmiEventReader class
2022-10-11 16:06:32 +02:00
2022-11-09 15:38:30 +01:00
Description: Providing methods for event monitoring. This is context manager class.
Can be used with `with` statement for automatic cleanup.
2022-10-11 16:06:32 +02:00
Methods:
2023-06-01 17:14:35 -06:00
### Constructor
2022-10-11 16:06:32 +02:00
2022-11-09 15:38:30 +01:00
Description: Allocates a new event reader notifier to monitor different types of events for the given GPU
2022-10-11 16:06:32 +02:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device handle corresponding to the device on which to listen for events
2022-11-09 15:38:30 +01:00
* `event_types` list of event types from AmdSmiEvtNotificationType enum. Specifying which events to collect for the given device.
Event Type | Description
---|------
`VMFAULT` | VM page fault
`THERMAL_THROTTLE` | thermal throttle
`GPU_PRE_RESET` | gpu pre reset
`GPU_POST_RESET` | gpu post reset
2022-10-11 16:06:32 +02:00
2023-06-01 17:14:35 -06:00
### read
2022-10-11 16:06:32 +02:00
2022-11-09 15:38:30 +01:00
Description: 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.
2022-10-11 16:06:32 +02:00
Input parameters:
2022-11-09 15:38:30 +01:00
* `timestamp` number of milliseconds to wait for an event to occur. If event does not happen monitoring is finished
* `num_elem` number of events. This is optional parameter. Default value is 10.
2022-10-11 16:06:32 +02:00
2023-06-01 17:14:35 -06:00
### stop
2022-11-09 15:38:30 +01:00
Description: 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 `with` statement, like in the examples below. This should be called either manually or automatically for every created AmdSmiEventReader object.
Input parameters: `None`
Example with manual cleanup of AmdSmiEventReader:
2023-06-01 17:14:35 -06:00
2022-10-11 16:06:32 +02:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-10-11 16:06:32 +02:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
2022-11-09 15:38:30 +01:00
event = AmdSmiEventReader ( device [ 0 ] , AmdSmiEvtNotificationType . GPU_PRE_RESET , AmdSmiEvtNotificationType . GPU_POST_RESET )
event . read ( 10000 )
except AmdSmiException as e :
2022-10-11 16:06:32 +02:00
print ( e )
2022-11-09 15:38:30 +01:00
finally :
event . stop ( )
2022-10-11 16:06:32 +02:00
```
2022-11-09 15:38:30 +01:00
Example with automatic cleanup using `with` statement:
2023-06-01 17:14:35 -06:00
2022-11-09 15:38:30 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 15:38:30 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
with AmdSmiEventReader ( device [ 0 ] , AmdSmiEvtNotificationType . GPU_PRE_RESET , AmdSmiEvtNotificationType . GPU_POST_RESET ) as event :
event . read ( 10000 )
except AmdSmiException as e :
print ( e )
2022-11-09 15:21:42 +01:00
2022-11-09 15:38:30 +01:00
```
2022-11-09 15:21:42 +01:00
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_pci_bandwidth
2022-11-09 15:21:42 +01:00
Description: Control the set of allowed PCIe bandwidths that can be used
2023-06-20 14:41:19 +02:00
It is not supported on virtual machine guest
2022-11-09 15:21:42 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 15:21:42 +01:00
* `bw_bitmask` A bitmask indicating the indices of the bandwidths that are
to be enabled (1) and disabled (0)
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_pci_bandwidth` function:
2022-11-09 15:21:42 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 15:21:42 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 15:21:42 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:43:32 -05:00
amdsmi_set_gpu_pci_bandwidth ( device , 0 )
2022-11-09 15:21:42 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_power_cap
2023-06-20 14:41:19 +02:00
Description: Set the power cap value. It is not supported on virtual machine
guest
2022-11-09 15:21:42 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 15:21:42 +01:00
* `sensor_ind` a 0-based sensor index. Normally, this will be 0. If a
device has more than one sensor, it could be greater than 0
* `cap` int that indicates the desired power cap, in microwatts
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_power_cap` function:
2022-11-09 15:21:42 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 15:21:42 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 15:21:42 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
power_cap = 250 * 1000000
2023-02-25 08:02:08 -05:00
amdsmi_set_power_cap ( device , 0 , power_cap )
2022-11-09 15:21:42 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_power_profile
2023-06-20 14:41:19 +02:00
Description: Set the power profile. It is not supported on virtual machine guest
2022-11-09 15:21:42 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 15:21:42 +01:00
* `reserved` Not currently used, set to 0
* `profile` a amdsmi_power_profile_preset_masks_t that hold the mask of
the desired new power profile
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_power_profile` function:
2022-11-09 15:21:42 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 15:21:42 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 15:21:42 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
profile = . . .
2023-02-25 08:04:42 -05:00
amdsmi_set_gpu_power_profile ( device , 0 , profile )
2022-11-09 15:21:42 +01:00
except AmdSmiException as e :
print ( e )
```
2022-11-10 16:18:27 +01:00
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_clk_range
2022-11-10 16:18:27 +01:00
2023-06-20 14:41:19 +02:00
Description: This function sets the clock range information.
It is not supported on virtual machine guest
2022-11-09 15:21:42 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 15:21:42 +01:00
* `min_clk_value` minimum clock value for desired clock range
* `max_clk_value` maximum clock value for desired clock range
* `clk_type` AMDSMI_CLK_TYPE_SYS | AMDSMI_CLK_TYPE_MEM range type
Output: None
2023-02-26 20:57:22 -05:00
Exceptions that can be thrown by `amdsmi_set_gpu_clk_range` function:
2023-06-01 17:14:35 -06:00
2022-11-09 15:21:42 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 15:21:42 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 15:21:42 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-26 20:57:22 -05:00
amdsmi_set_gpu_clk_range ( device , 0 , 1000 , AmdSmiClkType . AMDSMI_CLK_TYPE_SYS )
2022-11-09 15:21:42 +01:00
except AmdSmiException as e :
print ( e )
```
2022-11-10 16:18:27 +01:00
2023-06-02 01:19:26 -05:00
### amdsmi_get_gpu_bdf_id
2022-11-10 16:18:27 +01:00
Description: Get the unique PCI device identifier associated for a device
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
Output: device bdf
The format of bdfid will be as follows:
BDFID = ((DOMAIN & 0xffffffff) << 32) | ((BUS & 0xff) << 8) |
((DEVICE & 0x1f) <<3 ) | (FUNCTION & 0x7)
| Name | Field |
---------- | ------- |
| Domain | [64:32] |
| Reserved | [31:16] |
| Bus | [15: 8] |
| Device | [ 7: 3] |
| Function | [ 2: 0] |
2023-06-02 01:19:26 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_bdf_id` function:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-06-02 01:19:26 -05:00
bdfid = amdsmi_get_gpu_bdf_id ( device )
2022-11-10 16:18:27 +01:00
print ( bdfid )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_pci_bandwidth
2022-11-10 16:18:27 +01:00
Description: Get the list of possible PCIe bandwidths that are available.
2023-06-20 14:41:19 +02:00
It is not supported on virtual machine guest
2022-11-10 16:18:27 +01:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
Output: Dictionary with the possible T/s values and associated number of lanes
Field | Content
---|---
`transfer_rate` | transfer_rate dictionary
`lanes` | lanes
transfer_rate dictionary
Field | Content
---|---
`num_supported` | num_supported
`current` | current
`frequency` | list of frequency
2023-02-25 07:24:40 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_pci_bandwidth` function:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:24:40 -05:00
bandwidth = amdsmi_get_gpu_pci_bandwidth ( device )
2022-11-10 16:18:27 +01:00
print ( bandwidth )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_pci_throughput
2023-06-20 14:41:19 +02:00
Description: Get PCIe traffic information. It is not supported on virtual machine guest
2022-11-10 16:18:27 +01:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
Output: Dictionary with the fields
Field | Content
---|---
`sent` | number of bytes sent in 1 second
`received` | the number of bytes received
`max_pkt_sz` | maximum packet size
2023-02-25 07:39:10 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_pci_throughput` function:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:39:10 -05:00
pci = amdsmi_get_gpu_pci_throughput ( device )
2022-11-10 16:18:27 +01:00
print ( pci )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_pci_replay_counter
2022-11-10 16:18:27 +01:00
Description: Get PCIe replay counter
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
Output: counter value
The sum of the NAK's received and generated by the GPU
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_pci_replay_counter` function:
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:41:03 -05:00
counter = amdsmi_get_gpu_pci_replay_counter ( device )
2022-11-10 16:18:27 +01:00
print ( counter )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_topo_numa_affinity
2022-11-10 16:18:27 +01:00
Description: Get the NUMA node associated with a device
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
Output: NUMA node value
2023-02-25 07:36:54 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_topo_numa_affinity` function:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:36:54 -05:00
numa_node = amdsmi_get_gpu_topo_numa_affinity ( device )
2022-11-10 16:18:27 +01:00
print ( numa_node )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_energy_count
2022-11-10 16:18:27 +01:00
Description: Get the energy accumulator counter of the device.
2023-06-20 14:41:19 +02:00
It is not supported on virtual machine guest
2022-11-10 16:18:27 +01:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
Output: Dictionary with fields
Field | Content
---|---
`power` | power
`counter_resolution` | counter resolution
`timestamp` | timestamp
2023-02-25 07:59:27 -05:00
Exceptions that can be thrown by `amdsmi_get_energy_count` function:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:59:27 -05:00
power = amdsmi_get_energy_count ( device )
2022-11-10 16:18:27 +01:00
print ( power )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_memory_total
2022-11-10 16:18:27 +01:00
Description: Get the total amount of memory that exists
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
* `mem_type` enum AmdSmiMemoryType
Output: total amount of memory
2023-02-25 08:06:58 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_memory_total` function:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:06:58 -05:00
memory = amdsmi_get_gpu_memory_total ( device )
2022-11-10 16:18:27 +01:00
print ( memory )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_od_clk_info
2022-11-10 16:18:27 +01:00
2022-11-09 15:21:42 +01:00
Description: This function sets the clock frequency information
2023-06-20 14:41:19 +02:00
It is not supported on virtual machine guest
2022-11-09 15:21:42 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 15:21:42 +01:00
* `level` AMDSMI_FREQ_IND_MIN|AMDSMI_FREQ_IND_MAX to set the minimum (0)
or maximum (1) speed
* `clk_value` value to apply to the clock range
* `clk_type` AMDSMI_CLK_TYPE_SYS | AMDSMI_CLK_TYPE_MEM range type
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_od_clk_info` function:
2022-11-09 15:21:42 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 15:21:42 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 15:21:42 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 04:08:29 -05:00
amdsmi_set_gpu_od_clk_info (
2022-11-09 15:21:42 +01:00
device ,
AmdSmiFreqInd . AMDSMI_FREQ_IND_MAX ,
1000 ,
2022-12-28 12:55:15 +01:00
AmdSmiClkType . AMDSMI_CLK_TYPE_SYS
2022-11-09 15:21:42 +01:00
)
except AmdSmiException as e :
print ( e )
```
2022-11-10 16:18:27 +01:00
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_memory_usage
2022-11-10 16:18:27 +01:00
Description: Get the current memory usage
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 16:18:27 +01:00
* `mem_type` enum AmdSmiMemoryType
2023-03-28 15:32:17 -05:00
Output: the amount of memory currently being used
2022-11-10 16:18:27 +01:00
2023-02-25 08:08:29 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_memory_usage` function:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 16:18:27 +01:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 16:18:27 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:08:29 -05:00
memory = amdsmi_get_gpu_memory_usage ( device )
2022-11-10 16:18:27 +01:00
print ( memory )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_od_volt_info
2022-11-10 16:18:27 +01:00
2023-06-20 14:41:19 +02:00
Description: This function sets 1 of the 3 voltage curve points.
It is not supported on virtual machine guest
2022-11-09 15:21:42 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 15:21:42 +01:00
* `vpoint` voltage point [0|1|2] on the voltage curve
* `clk_value` clock value component of voltage curve point
* `volt_value` voltage value component of voltage curve point
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_od_volt_info` function:
2022-11-09 15:21:42 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 15:21:42 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 15:21:42 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 04:10:34 -05:00
amdsmi_set_gpu_od_volt_info ( device , 1 , 1000 , 980 )
2022-11-09 15:21:42 +01:00
except AmdSmiException as e :
print ( e )
```
2022-11-10 16:18:27 +01:00
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_fan_rpms
2022-11-10 16:18:27 +01:00
2022-11-09 17:32:55 +01:00
Description: Get the fan speed in RPMs of the device with the specified device
2023-06-20 14:41:19 +02:00
handle and 0-based sensor index. It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `sensor_idx` a 0-based sensor index. Normally, this will be 0. If a device has
more than one sensor, it could be greater than 0.
Output: Fan speed in rpms as integer
2023-02-25 08:13:46 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_fan_rpms` function:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:13:46 -05:00
fan_rpm = amdsmi_get_gpu_fan_rpms ( device , 0 )
2022-11-09 17:32:55 +01:00
print ( fan_rpm )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_fan_speed
2022-11-09 17:32:55 +01:00
Description: Get the fan speed for the specified device as a value relative to
2023-06-20 14:41:19 +02:00
AMDSMI_MAX_FAN_SPEED. It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `sensor_idx` a 0-based sensor index. Normally, this will be 0. If a device has
more than one sensor, it could be greater than 0.
Output: Fan speed in relative to MAX
2023-02-25 08:15:36 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_fan_speed` function:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:15:36 -05:00
fan_speed = amdsmi_get_gpu_fan_speed ( device , 0 )
2022-11-09 17:32:55 +01:00
print ( fan_speed )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_fan_speed_max
2023-06-20 14:41:19 +02:00
Description: Get the max fan speed of the device with provided device handle.
It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `sensor_idx` a 0-based sensor index. Normally, this will be 0. If a device has
more than one sensor, it could be greater than 0.
Output: Max fan speed as integer
2023-02-25 08:15:36 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_fan_speed_max` function:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:15:36 -05:00
max_fan_speed = amdsmi_get_gpu_fan_speed_max ( device , 0 )
2022-11-09 17:32:55 +01:00
print ( max_fan_speed )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
2023-11-22 03:32:15 -06:00
### amdsmi_is_gpu_power_management_enabled
2023-11-02 17:56:10 -05:00
2023-09-20 14:02:45 -05:00
Description: Returns is power management enabled
Input parameters:
2023-11-02 17:56:10 -05:00
2023-09-20 14:02:45 -05:00
* `processor_handle` GPU device which to query
Output: Bool true if power management enabled else false
Exceptions that can be thrown by `amdsmi_is_gpu_power_management_enabled` function:
2023-11-02 17:56:10 -05:00
2023-09-20 14:02:45 -05:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-11-02 17:56:10 -05:00
2023-09-20 14:02:45 -05:00
``` python
try :
2023-09-24 02:03:51 -05:00
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
2023-09-20 14:02:45 -05:00
print ( " No GPUs on machine " )
else :
2023-09-24 02:03:51 -05:00
for processor in devices :
2023-09-20 14:02:45 -05:00
is_power_management_enabled = amdsmi_is_gpu_power_management_enabled ( processor )
print ( is_power_management_enabled )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_temp_metric
2022-11-09 17:32:55 +01:00
Description: Get the temperature metric value for the specified metric, from the
2023-06-20 14:41:19 +02:00
specified temperature sensor on the specified device. It is not supported on virtual
machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `sensor_type` part of device from which temperature should be obtained
* `metric` enum indicated which temperature value should be retrieved
Output: Temperature as integer in millidegrees Celcius
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_temp_metric` function:
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:23:10 -05:00
temp_metric = amdsmi_get_temp_metric ( device , AmdSmiTemperatureType . EDGE ,
2022-11-09 17:32:55 +01:00
AmdSmiTemperatureMetric . CURRENT )
print ( temp_metric )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_volt_metric
2022-11-09 17:32:55 +01:00
Description: Get the voltage metric value for the specified metric, from the
2023-06-20 14:41:19 +02:00
specified voltage sensor on the specified device. It is not supported on virtual
machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `sensor_type` part of device from which voltage should be obtained
* `metric` enum indicated which voltage value should be retrieved
Output: Voltage as integer in millivolts
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_volt_metric` function:
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:25:12 -05:00
voltage = amdsmi_get_gpu_volt_metric ( device , AmdSmiVoltageType . VDDGFX ,
2022-11-09 17:32:55 +01:00
AmdSmiVoltageMetric . AVERAGE )
print ( voltage )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_utilization_count
2022-11-09 17:32:55 +01:00
Description: Get coarse grain utilization counter of the specified device
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `counter_types` variable number of counter types desired
Output: List containing dictionaries with fields
Field | Description
---|---
`timestamp` | The timestamp when the counter is retreived - Resolution: 1 ns
`Dictionary for each counter` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`type` </td><td>Type of utilization counter</td></tr><tr><td>`value` </td><td>Value gotten for utilization counter</td></tr></tbody></table>
2022-12-15 08:17:34 -06:00
Exceptions that can be thrown by `amdsmi_get_utilization_count` function:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2022-12-15 08:17:34 -06:00
utilization = amdsmi_get_utilization_count (
2022-11-10 10:11:59 +01:00
device ,
2022-11-09 17:32:55 +01:00
AmdSmiUtilizationCounterType . COARSE_GRAIN_GFX_ACTIVITY
)
print ( utilization )
2022-12-15 08:17:34 -06:00
utilization = amdsmi_get_utilization_count (
2022-11-10 10:11:59 +01:00
device ,
2022-11-09 17:32:55 +01:00
AmdSmiUtilizationCounterType . COARSE_GRAIN_GFX_ACTIVITY ,
AmdSmiUtilizationCounterType . COARSE_GRAIN_MEM_ACTIVITY
)
print ( utilization )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_perf_level
2023-06-20 14:41:19 +02:00
Description: Get the performance level of the device with provided device handle.
It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
Output: Performance level as enum value of dev_perf_level_t
2023-02-25 08:41:13 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_perf_level` function:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:41:13 -05:00
perf_level = amdsmi_get_gpu_perf_level ( dev )
2022-11-09 17:32:55 +01:00
print ( perf_level )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_perf_determinism_mode
2023-06-20 14:41:19 +02:00
Description: Enter performance determinism mode with provided device handle.
It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `clkvalue` softmax value for GFXCLK in MHz
Output: None
2023-02-25 08:43:44 -05:00
Exceptions that can be thrown by `amdsmi_set_gpu_perf_determinism_mode` function:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:43:44 -05:00
amdsmi_set_gpu_perf_determinism_mode ( device , 1333 )
2022-11-09 17:32:55 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_overdrive_level
2022-11-09 17:32:55 +01:00
Description: Get the overdrive percent associated with the device with provided
2023-06-20 14:41:19 +02:00
device handle. It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
Output: Overdrive percentage as integer
2023-02-27 04:05:11 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_overdrive_level` function:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 04:05:11 -05:00
od_level = amdsmi_get_gpu_overdrive_level ( dev )
2022-11-09 17:32:55 +01:00
print ( od_level )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_clk_freq
2022-11-09 17:32:55 +01:00
Description: Get the list of possible system clock speeds of device for a
2023-06-20 14:41:19 +02:00
specified clock type. It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `clk_type` the type of clock for which the frequency is desired
Output: Dictionary with fields
Field | Description
---|---
`num_supported` | The number of supported frequencies
`current` | The current frequency index
`frequency` | List of frequencies, only the first num_supported frequencies are valid
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_clk_freq` function:
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-26 20:54:22 -05:00
amdsmi_get_clk_freq ( device , AmdSmiClkType . SYS )
2022-11-09 17:32:55 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_od_volt_info
2022-11-09 17:32:55 +01:00
Description: This function retrieves the voltage/frequency curve information
2023-06-20 14:41:19 +02:00
It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
Output: Dictionary with fields
Field | Description
---|---
`curr_sclk_range` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`lower_bound` </td><td>lower bound sclk range</td></tr><tr><td>`upper_bound` </td><td>upper bound sclk range</td></tr></tbody></table>
`curr_mclk_range` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`lower_bound` </td><td>lower bound mclk range</td></tr><tr><td>`upper_bound` </td><td>upper bound mclk range</td></tr></tbody></table>
`sclk_freq_limits` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`lower_bound` </td><td>lower bound sclk range limt</td></tr><tr><td>`upper_bound` </td><td>upper bound sclk range limit</td></tr></tbody></table>
`mclk_freq_limits` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`lower_bound` </td><td>lower bound mclk range limit</td></tr><tr><td>`upper_bound` </td><td>upper bound mclk range limit</td></tr></tbody></table>
`curve.vc_points` | The number of supported frequencies
`num_regions` | The current frequency index
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_od_volt_info` function:
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 04:06:56 -05:00
amdsmi_get_gpu_od_volt_info ( dev )
2022-11-09 17:32:55 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_metrics_info
2023-06-20 14:41:19 +02:00
Description: This function retrieves the gpu metrics information. It is not
supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
Output: Dictionary with fields
2023-12-06 03:25:38 -06:00
| Field | Description |Unit|
|-------|-------------|----|
`temperature_edge` | Edge temperature value | Celsius (C)
`temperature_hotspot` | Hotspot (aka junction) temperature value | Celsius (C)
`temperature_mem` | Memory temperature value | Celsius (C)
`temperature_vrgfx` | vrgfx temperature value | Celsius (C)
`temperature_vrsoc` | vrsoc temperature value | Celsius (C)
`temperature_vrmem` | vrmem temperature value | Celsius (C)
`average_gfx_activity` | Average gfx activity | %
2024-01-15 23:14:44 -06:00
`average_umc_activity` | Average umc (Universal Memory Controller) activity | %
`average_mm_activity` | Average mm (multimedia) engine activity | %
2023-12-06 03:25:38 -06:00
`average_socket_power` | Average socket power | W
`energy_accumulator` | Energy accumulated with a 15.3 uJ resolution over 1ns | uJ
`system_clock_counter` | System clock counter | ns
`average_gfxclk_frequency` | Average gfx clock frequency | MHz
`average_socclk_frequency` | Average soc clock frequency | MHz
`average_uclk_frequency` | Average uclk frequency | MHz
`average_vclk0_frequency` | Average vclk0 frequency | MHz
`average_dclk0_frequency` | Average dclk0 frequency | MHz
`average_vclk1_frequency` | Average vclk1 frequency | MHz
`average_dclk1_frequency` | Average dclk1 frequency | MHz
`current_gfxclk` | Current gfx clock | MHz
`current_socclk` | Current soc clock | MHz
`current_uclk` | Current uclk | MHz
`current_vclk0` | Current vclk0 | MHz
`current_dclk0` | Current dclk0 | MHz
`current_vclk1` | Current vclk1 | MHz
`current_dclk1` | Current dclk1 | MHz
`throttle_status` | Current throttle status | MHz
`current_fan_speed` | Current fan speed | RPM
`pcie_link_width` | PCIe link width (number of lanes) | lanes
`pcie_link_speed` | PCIe link speed in 0.1 GT/s (Giga Transfers per second) | GT/s
2022-11-09 17:32:55 +01:00
`padding` | padding
2023-12-06 03:25:38 -06:00
`gfx_activity_acc` | gfx activity accumulated | %
`mem_activity_acc` | Memory activity accumulated | %
`temperature_hbm` | list of hbm temperatures | Celsius (C)
`firmware_timestamp` | timestamp from PMFW (10ns resolution) | ns
`voltage_soc` | soc voltage | mV
`voltage_gfx` | gfx voltage | mV
`voltage_mem` | mem voltage | mV
`indep_throttle_status` | ASIC independent throttle status (see drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h for bit flags) |
`current_socket_power` | Current socket power (also known as instant socket power) | W
`vcn_activity` | List of VCN encode/decode engine utilization per AID | %
`gfxclk_lock_status` | Clock lock status. Each bit corresponds to clock instance. |
`xgmi_link_width` | XGMI bus width | lanes
`xgmi_link_speed` | XGMI bitrate | GB/s
`pcie_bandwidth_acc` | PCIe accumulated bandwidth | GB/s
`pcie_bandwidth_inst` | PCIe instantaneous bandwidth | GB/s
`pcie_l0_to_recov_count_acc` | PCIe L0 to recovery state transition accumulated count |
`pcie_replay_count_acc` | PCIe replay accumulated count |
`pcie_replay_rover_count_acc` | PCIe replay rollover accumulated count |
`xgmi_read_data_acc` | XGMI accumulated read data transfer size (KiloBytes) | KB
`xgmi_write_data_acc` | XGMI accumulated write data transfer size (KiloBytes) | KB
`current_gfxclks` | List of current gfx clock frequencies | MHz
`current_socclks` | List of current soc clock frequencies | MHz
`current_vclk0s` | List of current v0 clock frequencies | MHz
`current_dclk0s` | List of current d0 clock frequencies | MHz
`mem_bandwidth_acc` | Memory bandwidth usage accumulated | GB/s
`mem_max_bandwidth` | Maximum memory bandwidth usage accumulated | GB/s
`pcie_nak_sent_count_acc` | PCIe NAC sent count accumulated |
`pcie_nak_rcvd_count_acc` | PCIe NAC received count accumulated |
2024-01-15 23:14:44 -06:00
`jpeg_activity` | List of JPEG engine activity | %
2022-11-09 17:32:55 +01:00
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_info` function:
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 01:01:17 -05:00
amdsmi_get_gpu_metrics_info ( dev )
2022-11-09 17:32:55 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_od_volt_curve_regions
2022-11-09 17:32:55 +01:00
Description: This function will retrieve the current valid regions in the
2023-06-20 14:41:19 +02:00
frequency/voltage space. It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `num_regions` number of freq volt regions
Output: List containing a dictionary with fields for each freq volt region
Field | Description
---|---
`freq_range` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`lower_bound` </td><td>lower bound freq range</td></tr><tr><td>`upper_bound` </td><td>upper bound freq range</td></tr></tbody></table>
`volt_range` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`lower_bound` </td><td>lower bound volt range</td></tr><tr><td>`upper_bound` </td><td>upper bound volt range</td></tr></tbody></table>
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_od_volt_curve_regions` function:
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 04:12:11 -05:00
amdsmi_get_gpu_od_volt_curve_regions ( device , 3 )
2022-11-09 17:32:55 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_power_profile_presets
2022-11-09 17:32:55 +01:00
Description: Get the list of available preset power profiles and an indication of
2023-06-20 14:41:19 +02:00
which profile is currently active. It is not supported on virtual machine guest
2022-11-09 17:32:55 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-09 17:32:55 +01:00
* `sensor_idx` number of freq volt regions
Output: Dictionary with fields
Field | Description
---|---
`available_profiles` | Which profiles are supported by this system
`current` | Which power profile is currently active
`num_profiles` | How many power profiles are available
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_power_profile_presets` function:
2022-11-09 17:32:55 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-09 17:32:55 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-09 17:32:55 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 01:04:25 -05:00
amdsmi_get_gpu_power_profile_presets ( device , 0 )
2022-11-09 17:32:55 +01:00
except AmdSmiException as e :
print ( e )
```
2022-11-10 10:11:59 +01:00
2023-06-01 17:14:35 -06:00
### amdsmi_gpu_counter_group_supported
2023-06-20 14:41:19 +02:00
Description: Tell if an event group is supported by a given device.
It is not supported on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 10:11:59 +01:00
* `event_group` event group being checked for support
Output: None
2023-02-27 02:00:14 -05:00
Exceptions that can be thrown by `amdsmi_gpu_counter_group_supported` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 02:00:14 -05:00
amdsmi_gpu_counter_group_supported ( device , AmdSmiEventGroup . XGMI )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_gpu_create_counter
2022-11-10 10:11:59 +01:00
Description: Creates a performance counter object
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 10:11:59 +01:00
* `event_type` event group being checked for support
Output: An event handle of the newly created performance counter object
2023-02-27 02:01:35 -05:00
Exceptions that can be thrown by `amdsmi_gpu_create_counter` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 02:01:35 -05:00
event_handle = amdsmi_gpu_create_counter ( device , AmdSmiEventGroup . XGMI )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_gpu_destroy_counter
2022-11-10 10:11:59 +01:00
Description: Destroys a performance counter object
Input parameters:
* `event_handle` event handle of the performance counter object
Output: None
2023-02-27 02:03:20 -05:00
Exceptions that can be thrown by `amdsmi_gpu_destroy_counter` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 02:01:35 -05:00
event_handle = amdsmi_gpu_create_counter ( device , AmdSmiEventGroup . XGMI )
2023-02-27 02:03:20 -05:00
amdsmi_gpu_destroy_counter ( event_handle )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_gpu_control_counter
2023-06-20 14:41:19 +02:00
Description: Issue performance counter control commands. It is not supported
on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
* `event_handle` event handle of the performance counter object
* `counter_command` command being passed to counter as AmdSmiCounterCommand
Output: None
2023-02-27 02:04:54 -05:00
Exceptions that can be thrown by `amdsmi_gpu_control_counter` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 02:01:35 -05:00
event_handle = amdsmi_gpu_create_counter ( device , AmdSmiEventType . XGMI_1_REQUEST_TX )
2023-02-27 02:04:54 -05:00
amdsmi_gpu_control_counter ( event_handle , AmdSmiCounterCommand . CMD_START )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_gpu_read_counter
2022-11-10 10:11:59 +01:00
Description: Read the current value of a performance counter
Input parameters:
* `event_handle` event handle of the performance counter object
Output: Dictionary with fields
Field | Description
---|---
`value` | Counter value
`time_enabled` | Time that the counter was enabled in nanoseconds
`time_running` | Time that the counter was running in nanoseconds
2023-02-27 02:06:14 -05:00
Exceptions that can be thrown by `amdsmi_gpu_read_counter` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 02:01:35 -05:00
event_handle = amdsmi_gpu_create_counter ( device , AmdSmiEventType . XGMI_1_REQUEST_TX )
2023-02-27 02:06:14 -05:00
amdsmi_gpu_read_counter ( event_handle )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_available_counters
2023-06-20 14:41:19 +02:00
Description: Get the number of currently available counters. It is not supported
on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:11:59 +01:00
* `event_group` event group being checked as AmdSmiEventGroup
Output: Number of available counters for the given device of the inputted event group
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_available_counters` function:
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 02:08:28 -05:00
available_counters = amdsmi_get_gpu_available_counters ( device , AmdSmiEventGroup . XGMI )
2022-11-10 10:11:59 +01:00
print ( available_counters )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_perf_level
2023-06-20 14:41:19 +02:00
Description: Set a desired performance level for given device. It is not
supported on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:11:59 +01:00
* `perf_level` performance level being set as AmdSmiDevPerfLevel
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_perf_level` function:
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-26 20:59:06 -05:00
amdsmi_set_gpu_perf_level ( device , AmdSmiDevPerfLevel . STABLE_PEAK )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_reset_gpu
2022-11-10 10:11:59 +01:00
Description: Reset the gpu associated with the device with provided device handle
2023-06-20 14:41:19 +02:00
It is not supported on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:11:59 +01:00
Output: None
2023-02-27 00:56:31 -05:00
Exceptions that can be thrown by `amdsmi_reset_gpu` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 00:56:31 -05:00
amdsmi_reset_gpu ( device )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_fan_speed
2022-11-10 10:11:59 +01:00
Description: Set the fan speed for the specified device with the provided speed,
2023-06-20 14:41:19 +02:00
in RPMs. It is not supported on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:11:59 +01:00
* `sensor_idx` sensor index as integer
* `fan_speed` the speed to which the function will attempt to set the fan
Output: None
2023-02-25 08:29:08 -05:00
Exceptions that can be thrown by `amdsmi_set_gpu_fan_speed` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:29:08 -05:00
amdsmi_set_gpu_fan_speed ( device , 0 , 1333 )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_reset_gpu_fan
2023-06-20 14:41:19 +02:00
Description: Reset the fan to automatic driver control. It is not
supported on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:11:59 +01:00
* `sensor_idx` sensor index as integer
Output: None
2023-02-25 08:27:40 -05:00
Exceptions that can be thrown by `amdsmi_reset_gpu_fan` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 08:27:40 -05:00
amdsmi_reset_gpu_fan ( device , 0 )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_clk_freq
2022-11-10 10:11:59 +01:00
Description: Control the set of allowed frequencies that can be used for the
2023-06-20 14:41:19 +02:00
specified clock. It is not supported on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:11:59 +01:00
* `clk_type` the type of clock for which the set of frequencies will be modified
2022-12-28 12:55:15 +01:00
as AmdSmiClkType
2022-11-10 10:11:59 +01:00
* `freq_bitmask` bitmask indicating the indices of the frequencies that are to
be enabled (1) and disabled (0). Only the lowest ::amdsmi_frequencies_t.num_supported
bits of this mask are relevant.
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_clk_freq` function:
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
freq_bitmask = 0
2023-02-26 21:01:44 -05:00
amdsmi_set_clk_freq ( device , AmdSmiClkType . GFX , freq_bitmask )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_set_gpu_overdrive_level
2022-11-10 10:11:59 +01:00
Description: **deprecated ** Set the overdrive percent associated with the
2023-06-20 14:41:19 +02:00
device with provided device handle with the provided value. It is not
supported on virtual machine guest
2022-11-10 10:11:59 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:11:59 +01:00
* `overdrive_value` value to which the overdrive level should be set
Output: None
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_overdrive_level` function:
2022-11-10 10:11:59 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:11:59 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:11:59 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 04:14:05 -05:00
amdsmi_set_gpu_overdrive_level ( device , 0 )
2022-11-10 10:11:59 +01:00
except AmdSmiException as e :
print ( e )
2022-11-10 10:30:10 +01:00
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_ecc_count
2023-06-20 14:41:19 +02:00
Description: Retrieve the error counts for a GPU block. It is not supported
on virtual machine guest
2022-11-10 10:30:10 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:30:10 +01:00
* `block` The block for which error counts should be retrieved
Output: Dict containing information about error counts
Field | Description
---|---
`correctable_count` | Count of correctable errors
`uncorrectable_count` | Count of uncorrectable errors
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_ecc_count` function:
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:30:10 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 10:39:42 -05:00
ecc_count = amdsmi_get_gpu_ecc_count ( device , AmdSmiGpuBlock . UMC )
2022-11-10 10:30:10 +01:00
print ( ecc_count )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_ecc_enabled
2023-06-20 14:41:19 +02:00
Description: Retrieve the enabled ECC bit-mask. It is not supported on virtual
machine guest
2022-11-10 10:30:10 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:30:10 +01:00
Output: Enabled ECC bit-mask
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_ecc_enabled` function:
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:30:10 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 10:39:42 -05:00
enabled = amdsmi_get_gpu_ecc_enabled ( device )
2022-11-10 10:30:10 +01:00
print ( enabled )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_ecc_status
2023-06-20 14:41:19 +02:00
Description: Retrieve the ECC status for a GPU block. It is not supported
on virtual machine guest
2022-11-10 10:30:10 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:30:10 +01:00
* `block` The block for which ECC status should be retrieved
Output: ECC status for a requested GPU block
2023-06-01 17:14:35 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_ecc_status` function:
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:30:10 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 10:39:42 -05:00
status = amdsmi_get_gpu_ecc_status ( device , AmdSmiGpuBlock . UMC )
2022-11-10 10:30:10 +01:00
print ( status )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_status_code_to_string
2022-11-10 10:30:10 +01:00
Description: Get a description of a provided AMDSMI error status
Input parameters:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `status` The error status for which a description is desired
Output: String description of the provided error code
2023-05-31 10:30:59 +02:00
Exceptions that can be thrown by `amdsmi_status_code_to_string` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
2023-05-31 10:30:59 +02:00
status_str = amdsmi_status_code_to_string ( ctypes . c_uint32 ( 0 ) )
2022-11-10 10:30:10 +01:00
print ( status_str )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_compute_process_info
2022-11-10 10:30:10 +01:00
Description: Get process information about processes currently using GPU
Input parameters: None
Output: List of python dicts each containing a process information
Field | Description
---|---
`process_id` | Process ID
`pasid` | PASID
`vram_usage` | VRAM usage
`sdma_usage` | SDMA usage in microseconds
`cu_occupancy` | Compute Unit usage in percents
2023-02-27 01:35:46 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_info` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
2023-02-27 01:35:46 -05:00
procs = amdsmi_get_gpu_compute_process_info ( )
2022-11-10 10:30:10 +01:00
for proc in procs :
print ( proc )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_compute_process_info_by_pid
2022-11-10 10:30:10 +01:00
Description: Get process information about processes currently using GPU
Input parameters:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `pid` The process ID for which process information is being requested
Output: Dict containing a process information
Field | Description
---|---
`process_id` | Process ID
`pasid` | PASID
`vram_usage` | VRAM usage
`sdma_usage` | SDMA usage in microseconds
`cu_occupancy` | Compute Unit usage in percents
2023-02-27 01:35:46 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_info_by_pid` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
pid = 0 # << valid pid here
2023-02-27 01:35:46 -05:00
proc = amdsmi_get_gpu_compute_process_info_by_pid ( pid )
2022-11-10 10:30:10 +01:00
print ( proc )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_compute_process_gpus
2022-11-10 10:30:10 +01:00
Description: Get the device indices currently being used by a process
Input parameters:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `pid` The process id of the process for which the number of gpus currently being used is requested
Output: List of indices of devices currently being used by the process
2023-02-27 01:44:06 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_gpus` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
pid = 0 # << valid pid here
2023-02-27 01:44:06 -05:00
indices = amdsmi_get_gpu_compute_process_gpus ( pid )
2022-11-10 10:30:10 +01:00
print ( indices )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_gpu_xgmi_error_status
2023-06-20 14:41:19 +02:00
Description: Retrieve the XGMI error status for a device. It is not supported on
virtual machine guest
2022-11-10 10:30:10 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:30:10 +01:00
Output: XGMI error status for a requested device
2023-02-27 02:10:20 -05:00
Exceptions that can be thrown by `amdsmi_gpu_xgmi_error_status` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:30:10 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-27 02:10:20 -05:00
status = amdsmi_gpu_xgmi_error_status ( device )
2022-11-10 10:30:10 +01:00
print ( status )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_reset_gpu_xgmi_error
2023-06-20 14:41:19 +02:00
Description: Reset the XGMI error status for a device. It is not supported
on virtual machine guest
2022-11-10 10:30:10 +01:00
Input parameters:
2023-06-01 17:14:35 -06:00
2023-02-25 05:28:40 -05:00
* `processor_handle` handle for the given device
2022-11-10 10:30:10 +01:00
Output: None
2023-02-28 01:59:12 -05:00
Exceptions that can be thrown by `amdsmi_reset_gpu_xgmi_error` function:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 10:30:10 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 10:30:10 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-28 01:59:12 -05:00
amdsmi_reset_gpu_xgmi_error ( device )
2022-11-10 10:30:10 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_vendor_name
2022-11-10 15:29:32 +01:00
Description: Returns the device vendor name
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 15:29:32 +01:00
Output: device vendor name
2023-02-25 07:00:50 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_vendor_name` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:00:50 -05:00
vendor_name = amdsmi_get_gpu_vendor_name ( device )
2022-11-10 15:29:32 +01:00
print ( vendor_name )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_id
2022-11-10 15:29:32 +01:00
Description: Get the device id associated with the device with provided device handler
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 15:29:32 +01:00
Output: device id
2023-02-25 06:58:22 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_id` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 06:58:22 -05:00
dev_id = amdsmi_get_gpu_id ( device )
2022-11-10 15:29:32 +01:00
print ( dev_id )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_vram_vendor
2022-11-10 15:29:32 +01:00
Description: Get the vram vendor string of a gpu device.
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 15:29:32 +01:00
Output: vram vendor
2023-02-25 07:06:13 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_vram_vendor` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:06:13 -05:00
vram_vendor = amdsmi_get_gpu_vram_vendor ( device )
2022-11-10 15:29:32 +01:00
print ( vram_vendor )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_subsystem_id
2022-11-10 15:29:32 +01:00
Description: Get the subsystem device id associated with the device with provided device handle.
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 15:29:32 +01:00
Output: subsystem device id
2023-02-25 07:08:28 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_subsystem_id` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:08:28 -05:00
id = amdsmi_get_gpu_subsystem_id ( device )
2022-11-10 15:29:32 +01:00
print ( id )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_gpu_subsystem_name
2022-11-10 15:29:32 +01:00
Description: Get the name string for the device subsytem
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 15:29:32 +01:00
Output: device subsytem
2023-02-25 07:11:22 -05:00
Exceptions that can be thrown by `amdsmi_get_gpu_subsystem_name` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-02-25 07:11:22 -05:00
subsystem_nam = amdsmi_get_gpu_subsystem_name ( device )
2022-11-10 15:29:32 +01:00
print ( subsystem_nam )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_lib_version
2022-11-10 15:29:32 +01:00
Description: Get the build version information for the currently running build of AMDSMI.
Output: amdsmi build version
2023-05-31 10:30:59 +02:00
Exceptions that can be thrown by `amdsmi_get_lib_version` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-05-31 10:30:59 +02:00
version = amdsmi_get_lib_version ( )
2022-11-10 15:29:32 +01:00
print ( version )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_topo_get_numa_node_number
2022-11-10 15:29:32 +01:00
Description: Retrieve the NUMA CPU node number for a device
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device which to query
2022-11-10 15:29:32 +01:00
Output: node number of NUMA CPU for the device
Exceptions that can be thrown by `amdsmi_topo_get_numa_node_number` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
node_number = amdsmi_topo_get_numa_node_number ( )
print ( node_number )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_topo_get_link_weight
2022-11-10 15:29:32 +01:00
Description: Retrieve the weight for a connection between 2 GPUs.
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle_src` the source device handle
* `processor_handle_dest` the destination device handle
2022-11-10 15:29:32 +01:00
Output: the weight for a connection between 2 GPUs
Exceptions that can be thrown by `amdsmi_topo_get_link_weight` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
2023-02-25 05:28:40 -05:00
processor_handle_src = devices [ 0 ]
processor_handle_dest = devices [ 1 ]
weight = amdsmi_topo_get_link_weight ( processor_handle_src , processor_handle_dest )
2022-11-10 15:29:32 +01:00
print ( weight )
except AmdSmiException as e :
print ( e )
```
2023-09-13 16:16:33 -05:00
### amdsmi_get_minmax_bandwidth_between_processors
2022-11-10 15:29:32 +01:00
Description: Retreive minimal and maximal io link bandwidth between 2 GPUs.
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle_src` the source device handle
* `processor_handle_dest` the destination device handle
2022-11-10 15:29:32 +01:00
Output: Dictionary with fields:
Field | Description
---|---
`min_bandwidth` | minimal bandwidth for the connection
`max_bandwidth` | maximal bandwidth for the connection
2023-09-13 16:16:33 -05:00
Exceptions that can be thrown by `amdsmi_get_minmax_bandwidth_between_processors` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
2023-02-25 05:28:40 -05:00
processor_handle_src = devices [ 0 ]
processor_handle_dest = devices [ 1 ]
2023-09-13 16:16:33 -05:00
bandwidth = amdsmi_get_minmax_bandwidth_between_processors ( processor_handle_src , processor_handle_dest )
print ( bandwidth [ ' min_bandwidth ' ] )
print ( bandwidth [ ' max_bandwidth ' ] )
2022-11-10 15:29:32 +01:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_topo_get_link_type
2022-11-10 15:29:32 +01:00
Description: Retrieve the hops and the connection type between 2 GPUs
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle_src` the source device handle
* `processor_handle_dest` the destination device handle
2022-11-10 15:29:32 +01:00
Output: Dictionary with fields:
Field | Description
---|---
`hops` | number of hops
`type` | the connection type
Exceptions that can be thrown by `amdsmi_topo_get_link_type` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
2023-02-25 05:28:40 -05:00
processor_handle_src = devices [ 0 ]
processor_handle_dest = devices [ 1 ]
link_type = amdsmi_topo_get_link_type ( processor_handle_src , processor_handle_dest )
2022-11-10 15:29:32 +01:00
print ( link_type [ ' hops ' ] )
print ( link_type [ ' type ' ] )
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_is_P2P_accessible
2022-11-10 15:29:32 +01:00
Description: Return P2P availability status between 2 GPUs
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle_src` the source device handle
* `processor_handle_dest` the destination device handle
2022-11-10 15:29:32 +01:00
Output: P2P availability status between 2 GPUs
Exceptions that can be thrown by `amdsmi_is_P2P_accessible` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
2023-02-25 05:28:40 -05:00
processor_handle_src = devices [ 0 ]
processor_handle_dest = devices [ 1 ]
accessible = amdsmi_is_P2P_accessible ( processor_handle_src , processor_handle_dest )
2022-11-10 15:29:32 +01:00
print ( accessible )
except AmdSmiException as e :
print ( e )
```
2023-11-22 03:32:15 -06:00
### amdsmi_get_gpu_compute_partition
2023-10-13 01:41:14 -05:00
Description: Get the compute partition from the given GPU
Input parameters:
* `processor_handle` the device handle
Output: String of the partition type
2023-11-22 03:32:15 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_compute_partition` function:
2023-10-13 01:41:14 -05:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-11-22 03:32:15 -06:00
compute_partition_type = amdsmi_get_gpu_compute_partition ( device )
2023-10-13 01:41:14 -05:00
print ( compute_partition_type )
except AmdSmiException as e :
print ( e )
```
2023-11-22 03:32:15 -06:00
### amdsmi_set_gpu_compute_partition
2023-10-13 01:41:14 -05:00
Description: Set the compute partition to the given GPU
Input parameters:
* `processor_handle` the device handle
* `compute_partition` the type of compute_partition to set
Output: String of the partition type
2023-11-22 03:32:15 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_compute_partition` function:
2023-10-13 01:41:14 -05:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
compute_partition = AmdSmiComputePartitionType . SPX
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-11-22 03:32:15 -06:00
amdsmi_set_gpu_compute_partition ( device , compute_partition )
2023-10-13 01:41:14 -05:00
except AmdSmiException as e :
print ( e )
```
2023-11-22 03:32:15 -06:00
### amdsmi_reset_gpu_compute_partition
2023-10-13 01:41:14 -05:00
Description: Reset the compute partitioning on the given GPU
Input parameters:
* `processor_handle` the device handle
Output: String of the partition type
2023-11-22 03:32:15 -06:00
Exceptions that can be thrown by `amdsmi_reset_gpu_compute_partition` function:
2023-10-13 01:41:14 -05:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-11-22 03:32:15 -06:00
amdsmi_reset_gpu_compute_partition ( device )
2023-10-13 01:41:14 -05:00
except AmdSmiException as e :
print ( e )
```
2023-11-22 03:32:15 -06:00
### amdsmi_get_gpu_memory_partition
2023-10-13 01:41:14 -05:00
Description: Get the memory partition from the given GPU
Input parameters:
* `processor_handle` the device handle
Output: String of the partition type
2023-11-22 03:32:15 -06:00
Exceptions that can be thrown by `amdsmi_get_gpu_memory_partition` function:
2023-10-13 01:41:14 -05:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-11-22 03:32:15 -06:00
memory_partition_type = amdsmi_get_gpu_memory_partition ( device )
2023-10-13 01:41:14 -05:00
print ( memory_partition_type )
except AmdSmiException as e :
print ( e )
```
2023-11-22 03:32:15 -06:00
### amdsmi_set_gpu_memory_partition
2023-10-13 01:41:14 -05:00
Description: Set the memory partition to the given GPU
Input parameters:
* `processor_handle` the device handle
* `memory_partition` the type of memory_partition to set
Output: String of the partition type
2023-11-22 03:32:15 -06:00
Exceptions that can be thrown by `amdsmi_set_gpu_memory_partition` function:
2023-10-13 01:41:14 -05:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
memory_partition = AmdSmiMemoryPartitionType . NPS1
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-11-22 03:32:15 -06:00
amdsmi_set_gpu_memory_partition ( device , memory_partition )
2023-10-13 01:41:14 -05:00
except AmdSmiException as e :
print ( e )
```
2023-11-22 03:32:15 -06:00
### amdsmi_reset_gpu_memory_partition
2023-10-13 01:41:14 -05:00
Description: Reset the memory partitioning on the given GPU
Input parameters:
* `processor_handle` the device handle
Output: String of the partition type
2023-11-22 03:32:15 -06:00
Exceptions that can be thrown by `amdsmi_reset_gpu_memory_partition` function:
2023-10-13 01:41:14 -05:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
2023-11-22 03:32:15 -06:00
amdsmi_reset_gpu_memory_partition ( device )
2023-10-13 01:41:14 -05:00
except AmdSmiException as e :
print ( e )
```
2023-06-01 17:14:35 -06:00
### amdsmi_get_xgmi_info
2022-11-10 15:29:32 +01:00
Description: Returns XGMI information for the GPU.
Input parameters:
2023-02-25 05:28:40 -05:00
* `processor_handle` device handle
2022-11-10 15:29:32 +01:00
Output: Dictionary with fields:
Field | Description
---|---
`xgmi_lanes` | xgmi lanes
`xgmi_hive_id` | xgmi hive id
`xgmi_node_id` | xgmi node id
`index` | index
Exceptions that can be thrown by `amdsmi_get_xgmi_info` function:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
2023-06-01 17:14:35 -06:00
2022-11-10 15:29:32 +01:00
``` python
try :
2023-02-25 05:28:40 -05:00
devices = amdsmi_get_processor_handles ( )
2022-11-10 15:29:32 +01:00
if len ( devices ) == 0 :
print ( " No GPUs on machine " )
else :
for device in devices :
xgmi_info = amdsmi_get_xgmi_info ( device )
print ( xgmi_info [ ' xgmi_lanes ' ] )
print ( xgmi_info [ ' xgmi_hive_id ' ] )
print ( xgmi_info [ ' xgmi_node_id ' ] )
print ( xgmi_info [ ' index ' ] )
except AmdSmiException as e :
print ( e )
```
2023-10-30 06:30:11 -04:00
2023-11-22 03:32:15 -06:00
## GPU Metrics APIs
### amdsmi_get_gpu_metrics_temp_hotspot
Description: Get the hotspot temperature in degrees Celsius
Input parameters:
* `processor_handle` device which to query
Output: hotspot temperature in degrees Celsius
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_hotspot` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
hotspot_temp = amdsmi_get_gpu_metrics_temp_hotspot ( device )
print ( hotspot_temp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_temp_mem
Description: Get the memory temperature in degrees Celsius
Input parameters:
* `processor_handle` device which to query
Output: memory temperature in degrees Celsius
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_mem` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
mem_temp = amdsmi_get_gpu_metrics_temp_mem ( device )
print ( mem_temp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_temp_vrsoc
Description: Get the VRSOC temperature in degrees Celsius
Input parameters:
* `processor_handle` device which to query
Output: VRSOC temperature in degrees Celsius
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_vrsoc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
vrsoc_temp = amdsmi_get_gpu_metrics_temp_vrsoc ( device )
print ( vrsoc_temp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_socket_power
Description: Get the current socket power in Watts
Input parameters:
* `processor_handle` device which to query
Output: current socket power in Watts
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_socket_power` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_socket_power = amdsmi_get_gpu_metrics_curr_socket_power ( device )
print ( curr_socket_power )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_gfx_activity
Description: Get the average GFX activity in percent
Input parameters:
* `processor_handle` device which to query
Output: average GFX activity in percent
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_gfx_activity` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_gfx_activity = amdsmi_get_gpu_metrics_avg_gfx_activity ( device )
print ( avg_gfx_activity )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_umc_activity
Description: Get the average UMC activity in percent
Input parameters:
* `processor_handle` device which to query
Output: average UMC activity in percent
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_umc_activity` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_umc_activity = amdsmi_get_gpu_metrics_avg_umc_activity ( device )
print ( avg_umc_activity )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_energy_acc
Description: Get the average energy accumulator in millijoules (check unit)
Input parameters:
* `processor_handle` device which to query
Output: average energy accumulator in millijoules (check unit)
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_energy_acc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_energy_acc = amdsmi_get_gpu_metrics_avg_energy_acc ( device )
print ( avg_energy_acc )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_system_clock_counter
Description: Get the system clock counter
Input parameters:
* `processor_handle` device which to query
Output: system clock counter
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_system_clock_counter` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
system_clock_counter = amdsmi_get_gpu_metrics_system_clock_counter ( device )
print ( system_clock_counter )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_firmware_timestamp
Description: Get the firmware timestamp
Input parameters:
* `processor_handle` device which to query
Output: firmware timestamp
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_firmware_timestamp` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
firmware_timestamp = amdsmi_get_gpu_metrics_firmware_timestamp ( device )
print ( firmware_timestamp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_throttle_status
Description: Get the throttle status
Input parameters:
* `processor_handle` device which to query
Output: True if throttled, False if it's not throttled
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_throttle_status` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
throttle_status = amdsmi_get_gpu_metrics_throttle_status ( device )
print ( throttle_status )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_pcie_link_width
Description: Get the pcie link width
Input parameters:
* `processor_handle` device which to query
Output: pcie link width
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_link_width` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
pcie_link_width = amdsmi_get_gpu_metrics_pcie_link_width ( device )
print ( pcie_link_width )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_pcie_link_speed
Description: Get the pcie link speed
Input parameters:
* `processor_handle` device which to query
Output: pcie link speed
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_link_speed` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
pcie_link_speed = amdsmi_get_gpu_metrics_pcie_link_speed ( device )
print ( pcie_link_speed )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_xgmi_link_width
Description: Get the xgmi link width
Input parameters:
* `processor_handle` device which to query
Output: xgmi link width
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_link_width` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
xgmi_link_width = amdsmi_get_gpu_metrics_xgmi_link_width ( device )
print ( xgmi_link_width )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_xgmi_link_speed
Description: Get the xgmi link speed
Input parameters:
* `processor_handle` device which to query
Output: xgmi link speed
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_link_speed` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
xgmi_link_speed = amdsmi_get_gpu_metrics_xgmi_link_speed ( device )
print ( xgmi_link_speed )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_gfxclk_lock_status
Description: Get the lock status of the gfx clock
Input parameters:
* `processor_handle` device which to query
Output: True if gfx clock is locked, False if it's not locked, raise if not supported
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_gfxclk_lock_status` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
lock_status = amdsmi_get_gpu_metrics_gfxclk_lock_status ( device )
print ( lock_status )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_gfx_activity_acc
Description: Get accumulated gfx activity
Input parameters:
* `processor_handle` device which to query
Output: accumulated gfx activity
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_gfx_activity_acc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
gfx_activity_acc = amdsmi_get_gpu_metrics_gfx_activity_acc ( device )
print ( gfx_activity_acc )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_mem_activity_acc
Description: Get accumulated memory activity
Input parameters:
* `processor_handle` device which to query
Output: accumulated mem activity
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_mem_activity_acc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
mem_activity_acc = amdsmi_get_gpu_metrics_mem_activity_acc ( device )
print ( mem_activity_acc )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_pcie_bandwidth_acc
Description: Get accumulated pcie bandwidth activity
Input parameters:
* `processor_handle` device which to query
Output: accumulated pcie bandwidth activity
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_bandwidth_acc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
pcie_bandwidth_acc = amdsmi_get_gpu_metrics_pcie_bandwidth_acc ( device )
print ( pcie_bandwidth_acc )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_pcie_bandwidth_inst
Description: Get instantaneous pcie bandwidth activity
Input parameters:
* `processor_handle` device which to query
Output: instantaneous pcie bandwidth activity
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_bandwidth_inst` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
pcie_bandwidth_inst = amdsmi_get_gpu_metrics_pcie_bandwidth_inst ( device )
print ( pcie_bandwidth_inst )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_pcie_l0_recov_count
Description: Get count of pcie l0 recovery count errors
Input parameters:
* `processor_handle` device which to query
Output: number of l0 recovery count errors
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_l0_recov_count` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
pcie_l0_recov_count = amdsmi_get_gpu_metrics_pcie_l0_recov_count ( device )
print ( pcie_l0_recov_count )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_pcie_replay_count_acc
Description: Get accumulated pcie replay counts
Input parameters:
* `processor_handle` device which to query
Output: accumulated pcie replay counts
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_replay_count_acc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
pcie_replay_count_acc = amdsmi_get_gpu_metrics_pcie_replay_count_acc ( device )
print ( pcie_replay_count_acc )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc
Description: Get accumulated pcie replay rollover counts
Input parameters:
* `processor_handle` device which to query
Output: accumulated pcie replay rollover counts
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
pcie_replay_rover_count_acc = amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc ( device )
print ( pcie_replay_rover_count_acc )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_uclk
Description: Get the current u clock frequency
Input parameters:
* `processor_handle` device which to query
Output: Current u clock frequency
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_uclk` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_uclk = amdsmi_get_gpu_metrics_curr_uclk ( device )
print ( curr_uclk )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_temp_hbm
Description: Get the HBM temperatures in degrees Celsius
Input parameters:
* `processor_handle` device which to query
Output: list of HBM temperatures in degrees Celsius
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_hbm` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
hbm_temp = amdsmi_get_gpu_metrics_temp_hbm ( device )
print ( hbm_temp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_vcn_activity
Description: Get the activity for each vcn encoding engine
Input parameters:
* `processor_handle` device which to query
Output: list of vcn activities
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_vcn_activity` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
vcn_activity = amdsmi_get_gpu_metrics_vcn_activity ( device )
print ( vcn_activity )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_xgmi_read_data
Description: Get the accumulated read xgmi data for each xgmi link
Input parameters:
* `processor_handle` device which to query
Output: list of accumulated read xgmi data
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_read_data` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
xgmi_read_data = amdsmi_get_gpu_metrics_xgmi_read_data ( device )
print ( xgmi_read_data )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_xgmi_write_data
Description: Get the accumulated written xgmi data for each xgmi link
Input parameters:
* `processor_handle` device which to query
Output: list of accumulated written xgmi data
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_write_data` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
xgmi_write_data = amdsmi_get_gpu_metrics_xgmi_write_data ( device )
print ( xgmi_write_data )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_gfxclk
Description: Get the current gfx clock frequency
Input parameters:
* `processor_handle` device which to query
Output: Current gfx clock frequency
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_gfxclk` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_gfxclk = amdsmi_get_gpu_metrics_curr_gfxclk ( device )
print ( curr_gfxclk )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_socclk
Description: Get the current soc clock frequency
Input parameters:
* `processor_handle` device which to query
Output: Current soc clock frequency
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_socclk` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_socclk = amdsmi_get_gpu_metrics_curr_socclk ( device )
print ( curr_socclk )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_vclk0
Description: Get the current v0 clock frequency
Input parameters:
* `processor_handle` device which to query
Output: Current v0 clock frequency
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_vclk0` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_vclk0 = amdsmi_get_gpu_metrics_curr_vclk0 ( device )
print ( curr_vclk0 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_dclk0
Description: Get the current d0 clock frequency
Input parameters:
* `processor_handle` device which to query
Output: Current d0 clock frequency
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_dclk0` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_dclk0 = amdsmi_get_gpu_metrics_curr_dclk0 ( device )
print ( curr_dclk0 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_temp_edge
Description: Get the edge temperature in degrees Celsius
Input parameters:
* `processor_handle` device which to query
Output: edge temperature in degrees Celsius
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_edge` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
edge_temp = amdsmi_get_gpu_metrics_temp_edge ( device )
print ( edge_temp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_temp_vr_gfx
Description: Get the VR GFX temperature in degrees Celsius
Input parameters:
* `processor_handle` device which to query
Output: VR GFX temperature in degrees Celsius
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_vr_gfx` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
vr_gfx_temp = amdsmi_get_gpu_metrics_temp_vr_gfx ( device )
print ( vr_gfx_temp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_temp_vr_mem
Description: Get the VR MEM temperature in degrees Celsius
Input parameters:
* `processor_handle` device which to query
Output: VR MEM temperature in degrees Celsius
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_vr_mem` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
vr_mem_temp = amdsmi_get_gpu_metrics_temp_vr_mem ( device )
print ( vr_mem_temp )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_mm_activity
Description: Get the average MM activity in percent
Input parameters:
* `processor_handle` device which to query
Output: average MM activity in percent
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_mm_activity` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_mm_activity = amdsmi_get_gpu_metrics_avg_mm_activity ( device )
print ( avg_mm_activity )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_vclk1
Description: Get the current v1 clock frequency
Input parameters:
* `processor_handle` device which to query
Output: Current v1 clock frequency
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_vclk1` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_vclk1 = amdsmi_get_gpu_metrics_curr_vclk1 ( device )
print ( curr_vclk1 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_dclk1
Description: Get the current d1 clock frequency
Input parameters:
* `processor_handle` device which to query
Output: Current d1 clock frequency
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_dclk1` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_dclk1 = amdsmi_get_gpu_metrics_curr_dclk1 ( device )
print ( curr_dclk1 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_indep_throttle_status
Description: Get the independent throttle status
Input parameters:
* `processor_handle` device which to query
Output: True if throttled, False if it's not throttled
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_indep_throttle_status` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
throttle_status = amdsmi_get_gpu_metrics_indep_throttle_status ( device )
print ( throttle_status )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_socket_power
Description: Get the average socket power in Watts
Input parameters:
* `processor_handle` device which to query
Output: average socket power in Watts
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_socket_power` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_socket_power = amdsmi_get_gpu_metrics_avg_socket_power ( device )
print ( avg_socket_power )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_curr_fan_speed
Description: Get the current fan speed in percent
Input parameters:
* `processor_handle` device which to query
Output: current fan speed in percent
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_fan_speed` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
curr_fan_speed = amdsmi_get_gpu_metrics_curr_fan_speed ( device )
print ( curr_fan_speed )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_gfx_clock_frequency
Description: Get the average gfx clock frequency in MHz
Input parameters:
* `processor_handle` device which to query
Output: average gfx clock frequency in MHz
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_gfx_clock_frequency` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_gfx_clock_frequency = amdsmi_get_gpu_metrics_avg_gfx_clock_frequency ( device )
print ( avg_gfx_clock_frequency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_soc_clock_frequency
Description: Get the average soc clock frequency in MHz
Input parameters:
* `processor_handle` device which to query
Output: average soc clock frequency in MHz
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_soc_clock_frequency` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_soc_clock_frequency = amdsmi_get_gpu_metrics_avg_soc_clock_frequency ( device )
print ( avg_soc_clock_frequency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_uclock_frequency
Description: Get the average u clock frequency in MHz
Input parameters:
* `processor_handle` device which to query
Output: average u clock frequency in MHz
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_uclock_frequency` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_uclock_frequency = amdsmi_get_gpu_metrics_avg_uclock_frequency ( device )
print ( avg_uclock_frequency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_vclock0_frequency
Description: Get the average v0 clock frequency in MHz
Input parameters:
* `processor_handle` device which to query
Output: average v0 clock frequency in MHz
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_vclock0_frequency` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_vclock0_frequency = amdsmi_get_gpu_metrics_avg_vclock0_frequency ( device )
print ( avg_vclock0_frequency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_dclock0_frequency
Description: Get the average d0 clock frequency in MHz
Input parameters:
* `processor_handle` device which to query
Output: average d0 clock frequency in MHz
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_dclock0_frequency` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_dclock0_frequency = amdsmi_get_gpu_metrics_avg_dclock0_frequency ( device )
print ( avg_dclock0_frequency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_vclock1_frequency
Description: Get the average v1 clock frequency in MHz
Input parameters:
* `processor_handle` device which to query
Output: average v1 clock frequency in MHz
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_vclock1_frequency` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_vclock1_frequency = amdsmi_get_gpu_metrics_avg_vclock1_frequency ( device )
print ( avg_vclock1_frequency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_avg_dclock1_frequency
Description: Get the average d1 clock frequency in MHz
Input parameters:
* `processor_handle` device which to query
Output: average d1 clock frequency in MHz
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_dclock1_frequency` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
avg_dclock1_frequency = amdsmi_get_gpu_metrics_avg_dclock1_frequency ( device )
print ( avg_dclock1_frequency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_volt_soc
Description: Get the soc voltage in millivolts
Input parameters:
* `processor_handle` device which to query
Output: soc voltage in millivolts
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_volt_soc` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
volt_soc = amdsmi_get_gpu_metrics_volt_soc ( device )
print ( volt_soc )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_volt_gfx
Description: Get the gfx voltage in millivolts
Input parameters:
* `processor_handle` device which to query
Output: gfx voltage in millivolts
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_volt_gfx` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
volt_gfx = amdsmi_get_gpu_metrics_volt_gfx ( device )
print ( volt_gfx )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_volt_mem
Description: Get the mem voltage in millivolts
Input parameters:
* `processor_handle` device which to query
Output: mem voltage in millivolts
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_volt_mem` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
volt_mem = amdsmi_get_gpu_metrics_volt_mem ( device )
print ( volt_mem )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_gpu_metrics_header_info
Description: Get the gpu metrics structure header info
Input parameters:
* `processor_handle` device which to query
Output: dictionary of gpu metrics header information
Exceptions that can be thrown by `amdsmi_get_gpu_metrics_header_info` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
``` python
try :
devices = amdsmi_get_processor_handles ( )
if len ( devices ) == 0 :
print ( " No GPUs on the machine " )
else :
for device in devices :
header_info = amdsmi_get_gpu_metrics_header_info ( device )
print ( header_info )
except AmdSmiException as e :
print ( e )
```
## CPU APIs
2023-12-07 07:30:31 -08:00
### amdsmi_get_processor_info
2023-10-30 06:30:11 -04:00
**Note: CURRENTLY HARDCODED TO RETURN EMPTY VALUES **
2023-12-07 07:30:31 -08:00
Description: Return processor name
2023-10-30 06:30:11 -04:00
Input parameters:
2023-12-07 07:30:31 -08:00
`processor_handle` processor handle
2023-10-30 06:30:11 -04:00
2023-12-07 07:30:31 -08:00
Output: Processor name
2023-10-30 06:30:11 -04:00
2023-12-07 07:30:31 -08:00
Exceptions that can be thrown by `amdsmi_get_processor_info` function:
2023-10-30 06:30:11 -04:00
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No processors on machine " )
2023-10-30 06:30:11 -04:00
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
print ( amdsmi_get_processor_info ( processor ) )
2023-10-30 06:30:11 -04:00
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_hsmp_proto_ver
Description: Get the hsmp protocol version.
Output: amdsmi hsmp protocol version
Exceptions that can be thrown by `amdsmi_get_cpu_hsmp_proto_ver` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
version = amdsmi_get_cpu_hsmp_proto_ver ( processor )
2023-10-30 06:30:11 -04:00
print ( version )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_smu_fw_version
Description: Get the SMU Firmware version.
Output: amdsmi SMU Firmware version
Exceptions that can be thrown by `amdsmi_get_cpu_smu_fw_version` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
version = amdsmi_get_cpu_smu_fw_version ( processor )
2023-10-30 06:30:11 -04:00
print ( version [ ' debug ' ] )
print ( version [ ' minor ' ] )
print ( version [ ' major ' ] )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_prochot_status
Description: Get the CPU's prochot status.
Output: amdsmi cpu prochot status
Exceptions that can be thrown by `amdsmi_get_cpu_prochot_status` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
prochot = amdsmi_get_cpu_prochot_status ( processor )
2023-10-30 06:30:11 -04:00
print ( prochot )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_fclk_mclk
Description: Get the Data fabric clock and Memory clock in MHz.
Output: amdsmi data fabric clock and memory clock
Exceptions that can be thrown by `amdsmi_get_cpu_fclk_mclk` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
clk = amdsmi_get_cpu_fclk_mclk ( processor )
2023-10-30 06:30:11 -04:00
for fclk , mclk in clk . items ( ) :
print ( fclk )
print ( mclk )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_cclk_limit
Description: Get the core clock in MHz.
Output: amdsmi core clock
Exceptions that can be thrown by `amdsmi_get_cpu_cclk_limit` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
cclk_limit = amdsmi_get_cpu_cclk_limit ( processor )
2023-10-30 06:30:11 -04:00
print ( cclk_limit )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_socket_current_active_freq_limit
Description: Get current active frequency limit of the socket.
Output: amdsmi frequency value in MHz and frequency source name
Exceptions that can be thrown by `amdsmi_get_cpu_socket_current_active_freq_limit` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
freq_limit = amdsmi_get_cpu_socket_current_active_freq_limit ( processor )
2023-10-30 06:30:11 -04:00
for freq , src in freq_limit . items ( ) :
print ( freq )
print ( src )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_socket_freq_range
Description: Get socket frequency range
Output: amdsmi maximum frequency and minimum frequency
Exceptions that can be thrown by `amdsmi_get_cpu_socket_freq_range` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
freq_range = amdsmi_get_cpu_socket_freq_range ( processor )
2023-10-30 06:30:11 -04:00
for fmax , fmin in freq_range . items ( ) :
print ( fmax )
print ( fmin )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_core_current_freq_limit
Description: Get socket frequency limit of the core
Output: amdsmi frequency
Exceptions that can be thrown by `amdsmi_get_cpu_core_current_freq_limit` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU cores on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
freq_limit = amdsmi_get_cpu_core_current_freq_limit ( processor )
2023-10-30 06:30:11 -04:00
print ( freq_limit )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_socket_power
Description: Get the socket power.
Output: amdsmi socket power
Exceptions that can be thrown by `amdsmi_get_cpu_socket_power` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-10-30 06:30:11 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
sock_power = amdsmi_get_cpu_socket_power ( processor )
2023-10-30 06:30:11 -04:00
print ( sock_power )
except AmdSmiException as e :
print ( e )
```
2023-11-02 07:23:31 -04:00
### amdsmi_get_cpu_socket_power_cap
Description: Get the socket power cap.
Output: amdsmi socket power cap
Exceptions that can be thrown by `amdsmi_get_cpu_socket_power_cap` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-02 07:23:31 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
sock_power = amdsmi_get_cpu_socket_power_cap ( processor )
2023-11-02 07:23:31 -04:00
print ( sock_power )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_socket_power_cap_max
Description: Get the socket power cap max.
Output: amdsmi socket power cap max
Exceptions that can be thrown by `amdsmi_get_cpu_socket_power_cap_max` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-02 07:23:31 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
sock_power = amdsmi_get_cpu_socket_power_cap_max ( processor )
2023-11-02 07:23:31 -04:00
print ( sock_power )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_pwr_svi_telemetry_all_rails
Description: Get the SVI based power telemetry for all rails.
Output: amdsmi svi based power value
Exceptions that can be thrown by `amdsmi_get_cpu_pwr_svi_telemetry_all_rails` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-02 07:23:31 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
power = amdsmi_get_cpu_pwr_svi_telemetry_all_rails ( processor )
2023-11-02 07:23:31 -04:00
print ( power )
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_socket_power_cap
Description: Set the power cap value for a given socket.
2023-12-07 07:30:31 -08:00
Input: amdsmi socket power cap value
2023-11-02 07:23:31 -04:00
Exceptions that can be thrown by `amdsmi_set_cpu_socket_power_cap` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-02 07:23:31 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
power = amdsmi_set_cpu_socket_power_cap ( processor , 1000 )
2023-11-02 07:23:31 -04:00
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_pwr_efficiency_mode
Description: Set the power efficiency profile policy.
2023-12-07 07:30:31 -08:00
Input: mode(0, 1, or 2)
2023-11-02 07:23:31 -04:00
Exceptions that can be thrown by `amdsmi_set_cpu_pwr_efficiency_mode` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-02 07:23:31 -04:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
policy = amdsmi_set_cpu_pwr_efficiency_mode ( processor , 0 )
2023-11-02 07:23:31 -04:00
except AmdSmiException as e :
print ( e )
```
2023-11-07 01:32:53 -05:00
### amdsmi_get_cpu_core_boostlimit
Description: Get boost limit of the cpu core
Output: amdsmi frequency
Exceptions that can be thrown by `amdsmi_get_cpu_core_boostlimit` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-07 01:32:53 -05:00
print ( " No CPU cores on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
boost_limit = amdsmi_get_cpu_core_boostlimit ( processor )
2023-11-07 01:32:53 -05:00
print ( boost_limit )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_socket_c0_residency
Description: Get the cpu socket C0 residency.
Output: amdsmi C0 residency value
Exceptions that can be thrown by `amdsmi_get_cpu_socket_c0_residency` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-07 01:32:53 -05:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
c0_residency = amdsmi_get_cpu_socket_c0_residency ( processor )
2023-11-07 01:32:53 -05:00
print ( c0_residency )
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_core_boostlimit
Description: Set the cpu core boost limit.
Output: amdsmi boostlimit value
Exceptions that can be thrown by `amdsmi_set_cpu_core_boostlimit` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-07 01:32:53 -05:00
print ( " No CPU cores on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
boost_limit = amdsmi_set_cpu_core_boostlimit ( processor , 1000 )
2023-11-07 01:32:53 -05:00
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_socket_boostlimit
Description: Set the cpu socket boost limit.
Input: amdsmi boostlimit value
Exceptions that can be thrown by `amdsmi_set_cpu_socket_boostlimit` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-07 01:32:53 -05:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
boost_limit = amdsmi_set_cpu_socket_boostlimit ( processor , 1000 )
2023-11-07 01:32:53 -05:00
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_ddr_bw
Description: Get the CPU DDR Bandwidth.
Output: amdsmi ddr bandwidth data
Exceptions that can be thrown by `amdsmi_get_cpu_ddr_bw` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-07 01:32:53 -05:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
ddr_bw = amdsmi_get_cpu_ddr_bw ( processor )
2023-11-07 01:32:53 -05:00
print ( ddr_bw [ ' max_bw ' ] )
print ( ddr_bw [ ' utilized_bw ' ] )
print ( ddr_bw [ ' utilized_pct ' ] )
except AmdSmiException as e :
print ( e )
```
2023-11-09 10:12:46 -05:00
### amdsmi_get_cpu_socket_temperature
Description: Get the socket temperature.
Output: amdsmi temperature value
Exceptions that can be thrown by `amdsmi_get_cpu_socket_temperature` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-09 10:12:46 -05:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
ptmon = amdsmi_get_cpu_socket_temperature ( processor )
2023-11-09 10:12:46 -05:00
print ( ptmon )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_dimm_temp_range_and_refresh_rate
Description: Get DIMM temperature range and refresh rate.
Output: amdsmi dimm metric data
Exceptions that can be thrown by `amdsmi_get_cpu_dimm_temp_range_and_refresh_rate` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-09 10:12:46 -05:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
dimm = amdsmi_get_cpu_dimm_temp_range_and_refresh_rate ( processor )
2023-11-09 10:12:46 -05:00
print ( dimm [ ' range ' ] )
print ( dimm [ ' ref_rate ' ] )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_dimm_power_consumption
Description: amdsmi_get_cpu_dimm_power_consumption.
Output: amdsmi dimm power consumption value
Exceptions that can be thrown by `amdsmi_get_cpu_dimm_power_consumption` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-09 10:12:46 -05:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
dimm = amdsmi_get_cpu_dimm_power_consumption ( processor )
2023-11-09 10:12:46 -05:00
print ( dimm [ ' power ' ] )
print ( dimm [ ' update_rate ' ] )
print ( dimm [ ' dimm_addr ' ] )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_dimm_thermal_sensor
Description: Get DIMM thermal sensor value.
Output: amdsmi dimm temperature data
Exceptions that can be thrown by `amdsmi_get_cpu_dimm_thermal_sensor` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-09 10:12:46 -05:00
print ( " No CPU sockets on machine " )
else :
2023-12-07 07:30:31 -08:00
for processor in processor_handles :
dimm = amdsmi_get_cpu_dimm_thermal_sensor ( processor )
2023-11-09 10:12:46 -05:00
print ( dimm [ ' sensor ' ] )
print ( dimm [ ' update_rate ' ] )
print ( dimm [ ' dimm_addr ' ] )
print ( dimm [ ' temp ' ] )
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_xgmi_width
Description: Set xgmi width.
Input: amdsmi xgmi width
Exceptions that can be thrown by `amdsmi_set_cpu_xgmi_width` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
2023-12-07 07:30:31 -08:00
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
xgmi_width = amdsmi_set_cpu_xgmi_width ( processor , 0 , 100 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_gmi3_link_width_range
Description: Set gmi3 link width range.
Input: minimum & maximum link width to be set.
Exceptions that can be thrown by `amdsmi_set_cpu_gmi3_link_width_range` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
gmi_link_width = amdsmi_set_cpu_gmi3_link_width_range ( processor , 0 , 100 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_cpu_apb_enable
Description: Enable APB.
Input: amdsmi processor handle
Exceptions that can be thrown by `amdsmi_cpu_apb_enable` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
apb_enable = amdsmi_cpu_apb_enable ( processor )
except AmdSmiException as e :
print ( e )
```
### amdsmi_cpu_apb_disable
Description: Disable APB.
Input: pstate value
Exceptions that can be thrown by `amdsmi_cpu_apb_disable` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
apb_disable = amdsmi_cpu_apb_disable ( processor , 0 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_socket_lclk_dpm_level
Description: Set NBIO lclk dpm level value.
Input: nbio id, min value, max value
Exceptions that can be thrown by `amdsmi_set_cpu_socket_lclk_dpm_level` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
2023-11-09 10:12:46 -05:00
print ( " No CPU sockets on machine " )
else :
for socket in socket_handles :
2023-12-07 07:30:31 -08:00
nbio = amdsmi_set_cpu_socket_lclk_dpm_level ( socket , 0 , 0 , 2 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_socket_lclk_dpm_level
Description: Get NBIO LCLK dpm level.
Output: nbio id
Exceptions that can be thrown by `amdsmi_get_cpu_socket_lclk_dpm_level` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
nbio = amdsmi_get_cpu_socket_lclk_dpm_level ( processor )
print ( nbio [ ' max_dpm_level ' ] )
print ( nbio [ ' max_dpm_level ' ] )
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_pcie_link_rate
Description: Set pcie link rate.
Input: rate control value
Exceptions that can be thrown by `amdsmi_set_cpu_pcie_link_rate` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
link_rate = amdsmi_set_cpu_pcie_link_rate ( processor , 0 , 0 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_set_cpu_df_pstate_range
Description: Set df pstate range.
Input: max pstate, min pstate
Exceptions that can be thrown by `amdsmi_set_cpu_df_pstate_range` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
pstate_range = amdsmi_set_cpu_df_pstate_range ( processor , 0 , 2 )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_current_io_bandwidth
Description: Get current input output bandwidth.
Output: link id and bw type to which io bandwidth to be obtained
Exceptions that can be thrown by `amdsmi_get_cpu_current_io_bandwidth` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
io_bw = amdsmi_get_cpu_current_io_bandwidth ( processor )
print ( io_bw )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_cpu_current_xgmi_bw
Description: Get current xgmi bandwidth.
Output: amdsmi link id and bw type to which xgmi bandwidth to be obtained
Exceptions that can be thrown by `amdsmi_get_cpu_current_xgmi_bw` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
xgmi_bw = amdsmi_get_cpu_current_xgmi_bw ( processor )
print ( xgmi_bw )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_metrics_table_version
Description: Get metrics table version.
Output: amdsmi metrics table version
Exceptions that can be thrown by `amdsmi_get_metrics_table_version` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
met_ver = amdsmi_get_metrics_table_version ( processor )
print ( met_ver )
except AmdSmiException as e :
print ( e )
```
### amdsmi_get_metrics_table
Description: Get metrics table
Output: metric table data
Exceptions that can be thrown by `amdsmi_get_metrics_table` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
mtbl = amdsmi_get_metrics_table ( processor )
print ( mtbl [ ' accumulation_counter ' ] )
print ( mtbl [ ' max_socket_temperature ' ] )
print ( mtbl [ ' max_vr_temperature ' ] )
print ( mtbl [ ' max_hbm_temperature ' ] )
print ( mtbl [ ' socket_power_limit ' ] )
print ( mtbl [ ' max_socket_power_limit ' ] )
print ( mtbl [ ' socket_power ' ] )
except AmdSmiException as e :
print ( e )
```
### amdsmi_first_online_core_on_cpu_socket
Description: Get first online core on cpu socket.
Output: first online core on cpu socket
Exceptions that can be thrown by `amdsmi_first_online_core_on_cpu_socket` function:
* `AmdSmiLibraryException`
Example:
``` python
try :
processor_handles = amdsmi_get_processor_handles ( )
if len ( processor_handles ) == 0 :
print ( " No CPU sockets on machine " )
else :
for processor in processor_handles :
pcore_ind = amdsmi_first_online_core_on_cpu_socket ( processor )
print ( pcore_ind )
2023-11-09 10:12:46 -05:00
except AmdSmiException as e :
print ( e )
```