Skip to content

Commit 4ab2ee6

Browse files
committed
fix(hygon): failed to detect
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 635d4d8 commit 4ab2ee6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

gpustack_runtime/detector/pyrocmsmi/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# https://rocm.docs.amd.com/projects/rocm_smi_lib/en/latest/doxygen/html/rocm__smi_8h.html.
66
from __future__ import annotations as __future_annotations__
77

8+
import contextlib
89
import os
910
import sys
1011
import threading
@@ -25,7 +26,7 @@
2526
if not rocmsmi_lib_path:
2627
rocm_path = Path(os.getenv("ROCM_HOME", os.getenv("ROCM_PATH") or "/opt/rocm"))
2728
rocmsmi_lib_path = str(rocm_path / "lib")
28-
if not Path(rocmsmi_lib_path).exists():
29+
if not (Path(rocmsmi_lib_path) / "librocm_smi64.so").exists():
2930
rocmsmi_lib_path = str(rocm_path / "rocm_smi" / "lib")
3031
else:
3132
rocm_path = Path(
@@ -54,7 +55,11 @@
5455
if str(rocmsmi_bindings_path) not in sys.path:
5556
sys.path.append(str(rocmsmi_bindings_path))
5657
try:
57-
from rsmiBindings import *
58+
with (
59+
Path(os.devnull).open("w") as dev_null,
60+
contextlib.redirect_stdout(dev_null),
61+
):
62+
from rsmiBindings import *
5863
except ImportError:
5964
pass
6065

0 commit comments

Comments
 (0)