Add 'projects/rocm-smi-lib/' from commit '7dba992ebd1beef78ec78d0d2974d6aa531786ff'

git-subtree-dir: projects/rocm-smi-lib
git-subtree-mainline: 25536e61be
git-subtree-split: 7dba992ebd
Este commit está contenido en:
systems-assistant[bot]
2025-07-22 22:52:41 +00:00
Se han modificado 184 ficheros con 62289 adiciones y 0 borrados
@@ -0,0 +1,31 @@
.. meta::
:description: ROCm SMI Python tutorial
:keywords: install, SMI, library, api, AMD, ROCm
ROCm SMI Python API tutorial
-----------------------------
.. code-block:: python
import sys
sys.path.append("/opt/rocm/libexec/rocm_smi/")
try:
import rocm_smi
except ImportError:
raise ImportError("Could not import /opt/rocm/libexec/rocm_smi/rocm_smi.py")
class prof_utils:
def __init__(self, mode) -> None:
rocm_smi.initializeRsmi()
def getPower(self, device):
return rocm_smi.getPower(device)
def listDevices(self):
return rocm_smi.listDevices()
def getMemInfo(self, device):
(memUsed, memTotal) = rocm_smi.getMemInfo(device, "vram")
return round(float(memUsed)/float(memTotal) * 100, 2)