Skip to content

Commit 08ca836

Browse files
committed
fix: test
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 380b817 commit 08ca836

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

gpustack_runtime/detector/pyrocmsmi/__init__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@
4646
rocmsmi_bindings_path = p
4747
break
4848

49+
# Refer to https://github.com/ROCm/rocm_smi_lib/blob/amd-staging_deprecated/python_smi_tools/rsmiBindings.py.
50+
# Add bindings path to sys.path for importing rsmiBindings
51+
if rocmsmi_bindings_path and rocmsmi_bindings_path.exists():
52+
if str(rocmsmi_bindings_path) not in sys.path:
53+
sys.path.append(str(rocmsmi_bindings_path))
54+
try:
55+
from rsmiBindings import *
56+
except ImportError:
57+
pass
58+
4959
## Enums ##
5060
ROCMSMI_IOLINK_TYPE_UNDEFINED = 0
5161
ROCMSMI_IOLINK_TYPE_PCIE = 1
@@ -78,13 +88,6 @@ def _LoadRocmSmiLibrary():
7888
and rocmsmi_lib_loc.is_file()
7989
):
8090
try:
81-
# Refer to https://github.com/ROCm/rocm_smi_lib/blob/amd-staging_deprecated/python_smi_tools/rsmiBindings.py.
82-
# Add bindings path to sys.path for importing rsmiBindings
83-
if rocmsmi_bindings_path and rocmsmi_bindings_path.exists():
84-
if str(rocmsmi_bindings_path) not in sys.path:
85-
sys.path.append(str(rocmsmi_bindings_path))
86-
from rsmiBindings import *
87-
8891
rocmsmiLib = CDLL(str(rocmsmi_lib_loc))
8992
except OSError:
9093
pass

0 commit comments

Comments
 (0)