Use amd-smi Python API instead of CLI (#1334)

* Use amd-smi Python API instead of CLI

Formatting fix

python path

* Update CHANGELOG

* Create amdsmi interface

* Added amdsmi tests

* Removed run

* Prioritize rocm's amdsmi python API

* address review comments

* update changelog

* fix ruff formatting

---------

Co-authored-by: Vignesh Edithal <Vignesh.Edithal@amd.com>
This commit is contained in:
abchoudh-amd
2025-10-24 11:11:33 +05:30
committed by GitHub
parent 839fb95717
commit a7bbe0c5d2
9 changed files with 294 additions and 138 deletions
@@ -92,14 +92,6 @@ def parse_table_dict(output: str) -> dict:
return result
def run(cmd):
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if cmd[0] == "amd-smi" and p.returncode == 8:
print("ERROR: No GPU detected. Unable to load amd-smi")
assert 0
return p.stdout.decode("utf-8")
def get_num_xcds():
num_xcds = None