Update documentation and add python API documentation

Change-Id: Ibccf5b6a5fba81cea42e04a022deac8a3207b9b8


[ROCm/rocm_smi_lib commit: 50a079af0f]
このコミットが含まれているのは:
Istvan Kiss
2024-03-06 20:55:02 +01:00
committed by Charis Poag
コミット f0c16aa8a0
18個のファイルの変更1359行の追加493行の削除
+29
ファイルの表示
@@ -0,0 +1,29 @@
====================
Python Tutorials
====================
This chapter is the rocm_smi Python api tutorials.
.. 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)