Run the AMD SMI static identity example#
The static identity example is a read-only introduction to hardware and software identity information available through AMD SMI. It reports ASIC, board, VRAM, cache, driver, and virtualization details for every discovered AMD GPU. It then checks optional NIC ASIC, PCIe bus, driver, and RDMA device information.
py/examples/static_identity/amdsmi_static_identity.py is the Python implementation.
The example does not modify device state, reset a GPU, change a configuration, or collect changing telemetry such as temperature, power, or utilization.
Prerequisites
Review the shared prerequisites for AMD SMI Python examples before running this script. An AMD GPU is required for GPU identity output.
NIC identity requires an AMD SMI build with NIC support and an appropriate NIC
driver. RDMA device details can be incomplete when supporting system libraries,
such as libibverbs, are unavailable. The example reports unavailable optional
capabilities and continues with the remaining queries.
Run the example
From the smi-lib repository root, run:
sudo python3 py/examples/static_identity/amdsmi_static_identity.py
Reported values depend on the installed hardware, driver, firmware, and
optional NIC support. If no GPUs are available, the example prints
No GPUs found before checking optional NIC identity.
Example flow
The example initializes AMD SMI, obtains GPU processor handles, prints static identity information for every GPU, checks optional NIC identity, and then shuts down AMD SMI:
initialized = False
try:
amdsmi_init(AmdSmiInitFlags.INIT_ALL_PROCESSORS)
initialized = True
processors = amdsmi_get_processor_handles()
for processor_number, processor in enumerate(processors):
print_gpu_static_identity(processor_number, processor)
print_nic_static_identity()
finally:
if initialized:
amdsmi_shut_down()
AmdSmiInitFlags.INIT_ALL_PROCESSORS is passed explicitly so the example can
discover GPUs and optional NICs. The current native implementation does not
use this flag to restrict the discovery scope.
amdsmi_get_processor_handles() returns opaque GPU processor handles. Keep a
returned handle and pass it to the per-GPU APIs; do not construct handles
yourself. amdsmi_get_gpu_device_bdf() prints each GPU’s
PCI bus:device.function (BDF) address, such as 0000:41:00.0, so the output
can be associated with a physical device.
Read GPU ASIC information
amdsmi_get_gpu_asic_info() returns ASIC identifiers and capabilities:
asic_info = amdsmi_get_gpu_asic_info(processor)
print(asic_info['market_name'])
print(asic_info['vendor_id'])
print(asic_info['vendor_name'])
print(asic_info['subvendor_id'])
print(asic_info['device_id'])
print(asic_info['rev_id'])
print(asic_info['asic_serial'])
print(asic_info['oam_id'])
print(asic_info['num_of_compute_units'])
print(asic_info['target_graphics_version'])
print(asic_info['subsystem_id'])
print(asic_info['flags'])
The returned dictionary contains:
Field |
Meaning |
|---|---|
|
Marketed GPU name |
|
PCI vendor identifier |
|
GPU vendor name |
|
PCI subsystem vendor identifier |
|
PCI device identifier |
|
ASIC revision identifier |
|
ASIC serial number, when available |
|
OAM module identifier, or |
|
Number of compute units |
|
Graphics IP target version |
|
PCI subsystem identifier |
|
ASIC capability flags |
PCI identifiers are formatted as hexadecimal strings. Some identity fields can be empty or unavailable when the platform or firmware does not provide them.
Read GPU board information
amdsmi_get_gpu_board_info() returns board-level identification:
board_info = amdsmi_get_gpu_board_info(processor)
print(board_info['product_name'])
print(board_info['product_serial'])
The returned dictionary contains:
Field |
Meaning |
|---|---|
|
Board model number |
|
Board product serial number |
|
Field-replaceable unit identifier |
|
Board product name |
|
Board manufacturer name |
Board details are populated by the platform and firmware. A missing or empty field does not necessarily indicate an AMD SMI error.
Read GPU VRAM and cache information
amdsmi_get_gpu_vram_info() describes the GPU’s installed video memory:
vram_info = amdsmi_get_gpu_vram_info(processor)
print(vram_info['vram_type'].name)
print(vram_info['vram_size'])
print(vram_info['vram_max_bandwidth'])
The returned dictionary contains:
Field |
Meaning |
|---|---|
|
VRAM technology as an |
|
VRAM vendor name |
|
Total VRAM size in bytes |
|
VRAM interface width in bits |
|
Maximum VRAM bandwidth in MB/s |
amdsmi_get_gpu_cache_info() returns cache entries for the GPU. The example
prints one entry for each cache type:
cache_info = amdsmi_get_gpu_cache_info(processor)
for cache in cache_info['cache']:
print(cache['cache_properties'])
print(cache['cache_size'])
print(cache['cache_level'])
Each cache entry contains:
Field |
Meaning |
|---|---|
|
List of cache roles, such as |
|
Size of one cache instance in bytes |
|
Cache hierarchy level |
|
Maximum number of compute units that share the cache |
|
Number of cache instances |
An empty cache list means that no cache entries were returned for the GPU.
Read GPU driver and virtualization information
amdsmi_get_gpu_driver_info() identifies the driver serving a GPU:
driver_info = amdsmi_get_gpu_driver_info(processor)
print(driver_info['driver_name'])
print(driver_info['driver_version'])
print(driver_info['driver_date'])
The returned dictionary contains driver_name, driver_version, and
driver_date. These describe the installed GPU driver, not the AMD SMI library
version.
amdsmi_get_gpu_virtualization_mode() identifies the GPU’s virtualization
context:
virtualization_mode = amdsmi_get_gpu_virtualization_mode(processor)
print(virtualization_mode.name)
The return value is an AmdSmiVirtualizationMode. The script prints enum
names so the output is easier to associate with the corresponding AMD SMI
Python API values.
Read optional NIC identity information
NIC identity is a separate optional section. The example first obtains NIC processor handles and prints the number of discovered NICs:
nic_processors = amdsmi_get_nic_processor_handles()
print(len(nic_processors))
For each returned handle, amdsmi_get_nic_device_bdf() identifies the NIC by
its PCI bus:device.function (BDF) address:
nic_bdf = amdsmi_get_nic_device_bdf(nic)
print(nic_bdf)
amdsmi_get_nic_asic_info() returns the NIC’s PCI identifiers and product
identity:
asic_info = amdsmi_get_nic_asic_info(nic)
print(asic_info['vendor_id'])
print(asic_info['subvendor_id'])
print(asic_info['device_id'])
print(asic_info['subsystem_id'])
print(asic_info['revision'])
print(asic_info['permanent_address'])
print(asic_info['product_name'])
print(asic_info['part_number'])
print(asic_info['serial_number'])
print(asic_info['vendor_name'])
The returned dictionary contains:
Field |
Meaning |
|---|---|
|
PCI vendor identifier |
|
PCI subsystem vendor identifier |
|
PCI device identifier |
|
PCI subsystem identifier |
|
Device revision identifier |
|
Permanent MAC address |
|
NIC product name |
|
NIC part number |
|
NIC serial number |
|
NIC vendor name |
amdsmi_get_nic_bus_info() returns the NIC’s PCIe bus capabilities:
bus_info = amdsmi_get_nic_bus_info(nic)
print(bus_info['bdf'])
print(bus_info['max_pcie_width'])
print(bus_info['max_pcie_speed'])
print(bus_info['pcie_interface_version'])
print(bus_info['slot_type'])
The returned dictionary contains:
Field |
Meaning |
|---|---|
|
PCI bus:device.function address |
|
Maximum supported PCIe link width |
|
Maximum supported PCIe link speed |
|
PCIe interface version |
|
Physical PCIe slot type |
amdsmi_get_nic_driver_info() identifies the driver serving the NIC:
driver_info = amdsmi_get_nic_driver_info(nic)
print(driver_info['name'])
print(driver_info['version'])
The returned dictionary contains name and version.
amdsmi_get_nic_rdma_dev_info() returns RDMA device entries. Each entry
identifies an RDMA device and contains a list of RDMA ports:
rdma_dev_info = amdsmi_get_nic_rdma_dev_info(nic)
for rdma_dev in rdma_dev_info['rdma_dev_info']:
print(rdma_dev['rdma_dev'])
print(rdma_dev['node_guid'])
print(rdma_dev['node_type'])
print(rdma_dev['sys_image_guid'])
print(rdma_dev['fw_ver'])
for rdma_port in rdma_dev['rdma_port_info']:
print(rdma_port['netdev'])
print(rdma_port['state'])
print(rdma_port['rdma_port'])
print(rdma_port['max_mtu'])
print(rdma_port['active_mtu'])
Each RDMA device dictionary contains:
Field |
Meaning |
|---|---|
|
RDMA device name |
|
RDMA node globally unique identifier |
|
RDMA node type |
|
RDMA system-image globally unique identifier |
|
RDMA device firmware version |
|
List of RDMA port information dictionaries |
Each rdma_port_info dictionary contains:
Field |
Meaning |
|---|---|
|
Associated network device name |
|
RDMA port state |
|
RDMA port number |
|
Maximum supported MTU |
|
Currently active MTU |
The maximum and active MTU values can be unavailable or incomplete without
libibverbs. Each NIC query is handled independently, so an unavailable API
does not prevent the example from trying the remaining NIC identity APIs.
The optional NIC APIs can fail when the hardware, driver, operating system, or build configuration does not support them. The example handles these status codes without terminating the GPU identity flow:
STATUS_NOT_SUPPORTEDSTATUS_DRIVER_NOT_LOADEDSTATUS_NOT_FOUNDSTATUS_NO_DATA
These APIs raise an AmdSmiLibraryException for the statuses above. Other AMD
SMI errors are reported by the outer exception handler. The initialized flag
ensures amdsmi_shut_down() is called only after amdsmi_init() succeeds,
releasing AMD SMI resources before the script exits.
The static identity example is a read-only introduction to hardware and software identity information available through AMD SMI. It reports ASIC, board, VRAM, cache, driver, and virtualization details for every discovered AMD GPU. It then checks optional NIC ASIC, PCIe bus, driver, and RDMA device information.
go/examples/static_identity/amdsmi_static_identity.go is the Go
implementation.
The example does not modify device state, reset a GPU, change a configuration, or collect changing telemetry such as temperature, power, or utilization.
Prerequisites
Review the shared prerequisites for AMD SMI Go examples before running this program. An AMD GPU is required for GPU identity output.
NIC identity requires an AMD SMI build with NIC support and an appropriate NIC
driver. RDMA device details can be incomplete when supporting system libraries,
such as libibverbs, are unavailable. The example reports unavailable optional
capabilities and continues with the remaining queries.
Run the example
From smi-lib/go/, run:
sudo go run examples/static_identity/amdsmi_static_identity.go
Reported values depend on the installed hardware, driver, firmware, and
optional NIC support. If no GPUs are available, the example prints
No GPUs found before checking optional NIC identity.
Example flow
The example initializes AMD SMI, obtains GPU processor handles, prints static identity information for every GPU, checks optional NIC identity, and then shuts down AMD SMI:
initFlags := amdsmi.AMDSMI_INIT_ALL_PROCESSORS
if err := amdsmi.Init(initFlags); err != nil {
return err
}
defer func() {
if shutdownErr := amdsmi.ShutDown(); shutdownErr != nil {
fmt.Println(shutdownErr)
return
}
fmt.Println("Shutdown complete")
}()
processors, err := amdsmi.GetProcessorHandles()
if err != nil {
return err
}
for processorNumber, processor := range processors {
if err := printGpuStaticIdentity(processorNumber, processor); err != nil {
return err
}
}
return printNicStaticIdentity()
amdsmi.AMDSMI_INIT_ALL_PROCESSORS is passed explicitly so the example can
discover GPUs and optional NICs. The current native implementation does not
use this flag to restrict the discovery scope.
amdsmi.GetProcessorHandles() returns opaque GPU processor handles. Keep a
returned handle and pass it to the per-GPU APIs; do not construct handles
yourself. amdsmi.GetGpuDeviceBdf() prints each GPU’s
PCI bus:device.function (BDF) address, such as 0000:41:00.0, so the output
can be associated with a physical device.
Read GPU ASIC information
amdsmi.GetGpuAsicInfo() returns ASIC identifiers and capabilities:
asicInfo, err := amdsmi.GetGpuAsicInfo(processor)
if err != nil {
return err
}
fmt.Println(asicInfo.MarketName)
fmt.Println(asicInfo.VendorID)
fmt.Println(asicInfo.VendorName)
fmt.Println(asicInfo.SubvendorID)
fmt.Println(asicInfo.DeviceID)
fmt.Println(asicInfo.RevID)
fmt.Println(asicInfo.AsicSerial)
fmt.Println(asicInfo.OamID)
fmt.Println(asicInfo.NumComputeUnits)
fmt.Println(asicInfo.TargetGraphicsVersion)
fmt.Println(asicInfo.SubsystemID)
fmt.Println(asicInfo.Flags)
The returned amdsmi.AsicInfo contains:
Field |
Meaning |
|---|---|
|
Marketed GPU name |
|
PCI vendor identifier |
|
GPU vendor name |
|
PCI subsystem vendor identifier |
|
PCI device identifier |
|
ASIC revision identifier |
|
ASIC serial number, when available |
|
OAM module identifier, or |
|
Number of compute units |
|
Graphics IP target version |
|
PCI subsystem identifier |
|
ASIC capability flags |
PCI identifiers are formatted as hexadecimal strings. Some identity fields can be empty or unavailable when the platform or firmware does not provide them.
Read GPU board information
amdsmi.GetGpuBoardInfo() returns board-level identification:
boardInfo, err := amdsmi.GetGpuBoardInfo(processor)
if err != nil {
return err
}
fmt.Println(boardInfo.ProductName)
fmt.Println(boardInfo.ProductSerial)
The returned amdsmi.BoardInfo contains:
Field |
Meaning |
|---|---|
|
Board model number |
|
Board product serial number |
|
Field-replaceable unit identifier |
|
Board product name |
|
Board manufacturer name |
Board details are populated by the platform and firmware. A missing or empty field does not necessarily indicate an AMD SMI error.
Read GPU VRAM and cache information
amdsmi.GetGpuVramInfo() describes the GPU’s installed video memory:
vramInfo, err := amdsmi.GetGpuVramInfo(processor)
if err != nil {
return err
}
fmt.Println(vramInfo.VramType)
fmt.Println(vramInfo.VramSize)
fmt.Println(vramInfo.VramMaxBandwidth)
The returned amdsmi.VramInfo contains:
Field |
Meaning |
|---|---|
|
VRAM technology as an |
|
VRAM vendor name |
|
Total VRAM size in bytes |
|
VRAM interface width in bits |
|
Maximum VRAM bandwidth in MB/s |
amdsmi.GetGpuCacheInfo() returns cache entries for the GPU. The example
prints one entry for each cache type:
cacheInfo, err := amdsmi.GetGpuCacheInfo(processor)
if err != nil {
return err
}
for _, cache := range cacheInfo.Cache {
fmt.Println(cache.CacheProperties)
fmt.Println(cache.CacheSize)
fmt.Println(cache.CacheLevel)
}
Each amdsmi.CacheEntry contains:
Field |
Meaning |
|---|---|
|
Cache roles as an |
|
Size of one cache instance in bytes |
|
Cache hierarchy level |
|
Maximum number of compute units that share the cache |
|
Number of cache instances |
An empty Cache slice means that no cache entries were returned for the GPU.
Read GPU driver and virtualization information
amdsmi.GetGpuDriverInfo() identifies the driver serving a GPU:
driverInfo, err := amdsmi.GetGpuDriverInfo(processor)
if err != nil {
return err
}
fmt.Println(driverInfo.DriverName)
fmt.Println(driverInfo.DriverVersion)
fmt.Println(driverInfo.DriverDate)
The returned amdsmi.DriverInfo contains DriverName, DriverVersion, and
DriverDate. These describe the installed GPU driver, not the AMD SMI library
version.
amdsmi.GetGpuVirtualizationMode() identifies the GPU’s virtualization
context:
virtualizationMode, err := amdsmi.GetGpuVirtualizationMode(processor)
if err != nil {
return err
}
fmt.Println(virtualizationMode)
The return value is an amdsmi.VirtualizationMode. Printing the value uses
its String() representation so the output is easier to associate with the
corresponding AMD SMI Go API values.
Read optional NIC identity information
NIC identity is a separate optional section. The example first obtains NIC processor handles and prints the number of discovered NICs:
nicProcessors, err := example_utils.GetOptionalAPI(
os.Stdout,
"amdsmi.GetNicProcessorHandles",
amdsmi.GetNicProcessorHandles,
)
if err != nil {
return nil
}
fmt.Println(len(nicProcessors))
For each returned handle, amdsmi.GetNicDeviceBdf() identifies the NIC by its
PCI bus:device.function (BDF) address:
nicBdf, err := amdsmi.GetNicDeviceBdf(nic)
if err != nil {
return err
}
fmt.Println(nicBdf)
amdsmi.GetNicAsicInfo() returns the NIC’s PCI identifiers and product
identity:
asicInfo, err := example_utils.GetOptionalAPI(
os.Stdout,
"amdsmi.GetNicAsicInfo",
func() (amdsmi.NicAsicInfo, error) {
return amdsmi.GetNicAsicInfo(nic)
},
)
if err == nil {
fmt.Println(asicInfo.VendorID)
fmt.Println(asicInfo.SubvendorID)
fmt.Println(asicInfo.DeviceID)
fmt.Println(asicInfo.SubsystemID)
fmt.Println(asicInfo.Revision)
fmt.Println(asicInfo.PermanentAddress)
fmt.Println(asicInfo.ProductName)
fmt.Println(asicInfo.PartNumber)
fmt.Println(asicInfo.SerialNumber)
fmt.Println(asicInfo.VendorName)
}
The returned amdsmi.NicAsicInfo contains:
Field |
Meaning |
|---|---|
|
PCI vendor identifier |
|
PCI subsystem vendor identifier |
|
PCI device identifier |
|
PCI subsystem identifier |
|
Device revision identifier |
|
Permanent MAC address |
|
NIC product name |
|
NIC part number |
|
NIC serial number |
|
NIC vendor name |
amdsmi.GetNicBusInfo() returns the NIC’s PCIe bus capabilities:
busInfo, err := example_utils.GetOptionalAPI(
os.Stdout,
"amdsmi.GetNicBusInfo",
func() (amdsmi.NicBusInfo, error) {
return amdsmi.GetNicBusInfo(nic)
},
)
if err == nil {
fmt.Println(busInfo.Bdf)
fmt.Println(busInfo.MaxPcieWidth)
fmt.Println(busInfo.MaxPcieSpeed)
fmt.Println(busInfo.PcieInterfaceVersion)
fmt.Println(busInfo.SlotType)
}
The returned amdsmi.NicBusInfo contains:
Field |
Meaning |
|---|---|
|
PCI bus:device.function address |
|
Maximum supported PCIe link width |
|
Maximum supported PCIe link speed |
|
PCIe interface version |
|
Physical PCIe slot type |
amdsmi.GetNicDriverInfo() identifies the driver serving the NIC:
driverInfo, err := example_utils.GetOptionalAPI(
os.Stdout,
"amdsmi.GetNicDriverInfo",
func() (amdsmi.NicDriverInfo, error) {
return amdsmi.GetNicDriverInfo(nic)
},
)
if err == nil {
fmt.Println(driverInfo.Name)
fmt.Println(driverInfo.Version)
}
The returned amdsmi.NicDriverInfo contains Name and Version.
amdsmi.GetNicRdmaDevInfo() returns RDMA device entries. Each entry
identifies an RDMA device and contains a list of RDMA ports:
rdmaDevInfo, err := example_utils.GetOptionalAPI(
os.Stdout,
"amdsmi.GetNicRdmaDevInfo",
func() (amdsmi.NicRdmaDevicesInfo, error) {
return amdsmi.GetNicRdmaDevInfo(nic)
},
)
if err == nil {
for _, rdmaDev := range rdmaDevInfo.RdmaDevInfo {
fmt.Println(rdmaDev.RdmaDev)
fmt.Println(rdmaDev.NodeGuid)
fmt.Println(rdmaDev.NodeType)
fmt.Println(rdmaDev.SysImageGuid)
fmt.Println(rdmaDev.FwVer)
for _, rdmaPort := range rdmaDev.RdmaPortInfo {
fmt.Println(rdmaPort.Netdev)
fmt.Println(rdmaPort.State)
fmt.Println(rdmaPort.RdmaPort)
fmt.Println(rdmaPort.MaxMtu)
fmt.Println(rdmaPort.ActiveMtu)
}
}
}
Each amdsmi.NicRdmaDevInfo contains:
Field |
Meaning |
|---|---|
|
RDMA device name |
|
RDMA node globally unique identifier |
|
RDMA node type |
|
RDMA system-image globally unique identifier |
|
RDMA device firmware version |
|
Slice of |
Each amdsmi.NicRdmaPortInfo contains:
Field |
Meaning |
|---|---|
|
Associated network device name |
|
RDMA port state |
|
RDMA port number |
|
Maximum supported MTU |
|
Currently active MTU |
The maximum and active MTU values can be unavailable or incomplete without
libibverbs. Each NIC query is handled independently, so an unavailable API
does not prevent the example from trying the remaining NIC identity APIs.
Handle unavailable capabilities and clean up
The optional NIC APIs can fail when the hardware, driver, operating system, or build configuration does not support them. The example handles these status codes without terminating the GPU identity flow:
AMDSMI_STATUS_NOT_SUPPORTEDAMDSMI_STATUS_DRIVER_NOT_LOADEDAMDSMI_STATUS_NOT_FOUNDAMDSMI_STATUS_NO_DATA
These APIs return an amdsmi.StatusError for the statuses above. The example
uses example_utils.GetOptionalAPI() so optional failures are printed without
aborting the run. Other AMD SMI errors are returned from run(). Shutdown is
placed in a defer so amdsmi.ShutDown() runs after a successful
amdsmi.Init(), releasing AMD SMI resources before the program exits.