Skip to content

Commit

Permalink
support pyrsmi when amdsmi is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Feb 21, 2024
1 parent 064789c commit c37d410
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion optimum_benchmark/system_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def is_rocm_system():
if is_rocm_system() and is_amdsmi_available():
import amdsmi

if is_rocm_system() and not is_pyrsmi_available():
if is_rocm_system() and is_pyrsmi_available():
from pyrsmi import rocml


Expand Down
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib.util
import os
import subprocess

Expand Down Expand Up @@ -37,15 +38,21 @@
pass

# we keep this as a check that amdsmi is installed since it's not available on pypi
PYRSMI = "pyrsmi@git+https://github.com/ROCm/pyrsmi.git"
if USE_ROCM:
INSTALL_REQUIRES.append("amdsmi")
if not importlib.util.find_spec("amdsmi"):
INSTALL_REQUIRES.append(PYRSMI)
else:
try:
subprocess.run(["rocm-smi"], stdout=subprocess.DEVNULL)
INSTALL_REQUIRES.append("amdsmi")
if not importlib.util.find_spec("amdsmi"):
INSTALL_REQUIRES.append(PYRSMI)
except FileNotFoundError:
pass

if PYRSMI in INSTALL_REQUIRES:
print("ROCm GPU detected without amdsmi installed. Using pyrsmi instead but some features may not work.")


EXTRAS_REQUIRE = {
"quality": ["ruff"],
Expand Down

0 comments on commit c37d410

Please sign in to comment.