AMD SMI packaging and install paths#
AMD SMI ships through several delivery channels. This page describes each one,
how the Python module locates the native library in each, which combinations
are supported, and how upgrades and downgrades behave. It is the reference for
the loader contract that py-interface/amdsmi_wrapper.py implements.
Delivery paths#
Path |
Native library ( |
Python module |
How the module finds the |
|---|---|---|---|
System package (deb/rpm) |
|
Installed into the system interpreter’s |
SONAME via the dynamic linker |
TheRock native package ( |
|
|
Resolved relative to the wrapper ( |
TheRock tarball |
|
|
Resolved relative to the wrapper ( |
ROCm via pip (TheRock |
|
|
Resolved relative to the wrapper ( |
ROCm via pip in a venv |
Same as above, inside the venv |
Same as above, inside the venv |
Same as above |
Community-built PyPI |
Not bundled; requires a matching ROCm |
Interpreter |
Legacy loader checks |
Bundled-library wheel ( |
Bundled |
Interpreter |
The bundled |
The community-built PyPI releases through 7.0.2 predate the bundled-library wheel and use ROCm release numbers. They require that release’s native library and are not compatible with arbitrary newer AMD SMI libraries. Prefer the wrapper shipped with your ROCm installation. Wheels built from this source use the AMD SMI library version instead.
Bundling AMD SMI does not eliminate its native runtime prerequisites. A raw
BUILD_PYTHON_WHEEL=ON wheel requires libnl-3, libnl-genl-3, and libmnl
from the system; tools/build_wheel.py --repair vendors those libraries into
the repaired manylinux wheel. Both need libdrm_amdgpu for DRM-backed GPU
queries, which load it dynamically. The repaired wheel does not bundle it.
Install libdrm-amdgpu1 on Debian/Ubuntu, libdrm on RHEL/AlmaLinux/Rocky,
or libdrm_amdgpu1 on SLES/openSUSE. Without it, discovery can succeed while
some query results are unavailable or incorrect.
The loader#
The current py-interface/amdsmi_wrapper.py selects the library in this order
(the legacy PyPI wrappers do not implement this contract):
AMDSMI_LIB_OVERRIDE— explicit path, for ABI tests.A bundled
libamd_smi_python.sonext to the wrapper — the bundled-library wheel.The SONAME resolved relative to the wrapper (
parents[3]/lib) — the TheRockshare/amd_smilayout, where a venv has nold.so.conf.dentry.The bare SONAME via the dynamic linker — the system deb/rpm.
Steps 3 and 4 are skipped when _AMDSMI_ALLOW_SYSTEM_FALLBACK is False. The
committed wrapper and the system package keep it True; the wheel build flips
it to False, so the bundled-library wheel does not automatically load a
system libamd_smi.so (which could be a different version and would risk
symbol conflicts inside processes such as PyTorch or JAX that ship their own
copy). An explicit AMDSMI_LIB_OVERRIDE still takes precedence.
The wheel’s libamd_smi_python.so has a distinct SONAME and is linked with
-Bsymbolic-functions, so the system and wheel libraries can be loaded in the
same process without the dynamic linker interposing one on the other.
Two installed copies (system package)#
The deb/rpm installs the module into both the interpreter’s site-packages
and share/amd_smi. Both are required:
site-packages makes a plain
import amdsmiwork.share/amd_smiis captured by the TheRock artifact flow (which packages only/opt/rocm, so it cannot reach the/usrsite-packages tree) and is used by downstream tools thatsys.path.insert(ROCM_PATH + "/share/amd_smi").
A redirector or symlink is not viable because TheRock ships only /opt/rocm.
The build harness runs a guard (tests/run_amdsmi_dual_copy_test.py) asserting
the two copies stay byte-identical, so drift fails a build instead of shipping.
Coexistence and precedence#
A user installs one delivery path. When a bundled-library wheel is installed
alongside a system package, the wheel wins and the package uninstall does not
remove it, because they live in separate, file-manager-owned trees and
sys.path favors the wheel:
Installed together |
|
Package uninstall removes the wheel? |
|---|---|---|
deb + pip wheel (Debian) |
wheel in |
No — dpkg removes only its own files |
rpm + pip |
wheel in |
No — rpm removes only its own files |
deb/rpm + venv wheel |
wheel in the venv (isolated) |
No — separate tree |
The precedence above is the default sys.path ordering between install
locations. A global PYTHONPATH overrides it: Python searches PYTHONPATH
entries before any install location, so import amdsmi resolves there
regardless of where the wheel or package installed. Some ROCm container images
set PYTHONPATH=/opt/rocm/share/amd_smi, which makes the share/amd_smi copy
win over a pip wheel in that environment. Unset PYTHONPATH (or point it at the
copy you want) to restore the install-location precedence.
Support matrix#
Legend: ✅ supported and tested · 🟡 supported, pick one recommended · ⛔ unsupported.
Single path#
Path |
|
|
|---|---|---|
deb/rpm |
✅ |
✅ |
TheRock tarball |
✅ |
✅ (with |
ROCm pip |
✅ |
✅ (with |
ROCm pip in venv |
✅ |
✅ (with |
Community-built PyPI wrapper through 7.0.2 |
⛔ (Python bindings only) |
Requires its matching older ROCm library; prefer the ROCm-shipped wrapper |
Bundled-library wheel |
⛔ (Python bindings only) |
✅ (native runtime prerequisites above) |
Two paths together#
Combination |
Coexist? |
|---|---|
deb/rpm + bundled-library wheel |
✅ (wheel wins; package uninstall keeps the wheel) |
deb/rpm + ROCm pip, same interpreter |
🟡 (discouraged; two library families) |
Bundled-library wheel + ROCm pip |
🟡 (discouraged) |
TheRock tarball + bundled-library wheel |
✅ (wheel uses its bundled |
ROCm pip + ROCm pip venv |
✅ (venv wins while active) |
Unsupported#
Two system packages of different major SOVERSION on one prefix.
Relying on a tarball’s Python wrapper without adding
share/amd_smitoPYTHONPATH.A bundled-library wheel automatically falling back to a system
/opt/rocmlibrary (blocked by design;AMDSMI_LIB_OVERRIDEis an explicit exception).A legacy PyPI wrapper with a native library from a different ROCm release.
Upgrade and downgrade (deb/rpm)#
Transition |
Behavior |
|---|---|
pre-10.1 (pip-era) → 10.1+ package |
The old package’s prerm still |
10.1+ → 10.1+ |
Plain file replacement by the package manager. |
10.1+ → pre-10.1 (downgrade) |
The old package re-adds the pip install; a user-installed bundled-library wheel in |
package removed, then bundled-library wheel |
Package removal deletes only its own files; the wheel includes its own |
package removed, then legacy PyPI wrapper |
The wrapper still requires a matching native library; installing it alone does not replace the removed library. |
RPM interpreter dependency#
On RPM distros the module installs into a version-specific site-packages
(e.g. /usr/lib64/python3.9/site-packages). The package therefore declares a
dependency on the matching interpreter so it installs only where that
interpreter (and thus the baked path) exists:
RHEL/CentOS/Fedora/AlmaLinux/AzureLinux:
python(abi) = X.Y.SLES/openSUSE:
pythonXY(e.g.python311).
Debian’s dist-packages is version-agnostic, so the deb keeps the loose
python3 (>= 3.6.8) dependency and the #!/usr/bin/python3 CLI shebang serves
every python3 minor.