Find libamd_smi.so and librocm-core.so relative to wrapper.py
Allow amdsmi to find libamd_smi.so and librocm-core.so relative to amdsmi_wrapper.py location. The amdsmi_wrapper.py file is located in _rocm_sdk_core/share/amd_smi/amdsmi and the libraries are in _rocm_sdk_core/lib/libamd_smi.so.26. _rocm_sdk_core/lib/librocm-core.so.1.
Esse commit está contido em:
commit de
Galantsev, Dmitrii
pai
a2aae5e8a9
commit
ad20d57162
@@ -5511,6 +5511,12 @@ def amdsmi_get_rocm_version()-> Tuple[bool, str]:
|
||||
|
||||
try:
|
||||
possible_locations = list()
|
||||
# 0. Relative to amdsmi_interface.py in TheRock:
|
||||
# `amdsmi_interface.py` is located in
|
||||
# `_rocm_sdk_core/share/amd_smi/amdsmi`, libraries are in
|
||||
# `_rocm_sdk_core/lib`.
|
||||
librocm_core_path = Path(__file__).resolve().parent.parent.parent.parent / "lib/librocm-core.so"
|
||||
possible_locations.append(librocm_core_path)
|
||||
# 1.
|
||||
rocm_path = os.getenv("ROCM_HOME", os.getenv("ROCM_PATH"))
|
||||
if rocm_path:
|
||||
|
||||
@@ -167,6 +167,10 @@ _libraries = {}
|
||||
from pathlib import Path
|
||||
# libamd_smi.so can be located in several different places.
|
||||
# Look for it with below priority:
|
||||
# 0. Relative to amdsmi_wrapper.py in TheRock:
|
||||
# `amdsmi_wrapper.py` is located in
|
||||
# `_rocm_sdk_core/share/amd_smi/amdsmi`, libraries are in
|
||||
# `_rocm_sdk_core/lib`.
|
||||
# 1. ROCM_HOME/ROCM_PATH environment variables
|
||||
# - ROCM_HOME/lib
|
||||
# - ROCM_PATH/lib (usually set to /opt/rocm/)
|
||||
@@ -179,6 +183,9 @@ from pathlib import Path
|
||||
def find_smi_library():
|
||||
err = OSError("Could not load libamd_smi.so")
|
||||
possible_locations = []
|
||||
# 0.
|
||||
libamd_smi_path = Path(__file__).resolve().parent.parent.parent.parent / "lib/libamd_smi.so"
|
||||
possible_locations.append(libamd_smi_path)
|
||||
# 1.
|
||||
rocm_path = os.getenv("ROCM_HOME", os.getenv("ROCM_PATH"))
|
||||
if rocm_path:
|
||||
|
||||
@@ -182,6 +182,10 @@ def main():
|
||||
new_line = f"""from pathlib import Path
|
||||
# {library_name} can be located in several different places.
|
||||
# Look for it with below priority:
|
||||
# 0. Relative to amdsmi_wrapper.py in TheRock:
|
||||
# `amdsmi_wrapper.py` is located in
|
||||
# `_rocm_sdk_core/share/amd_smi/amdsmi`, libraries are in
|
||||
# `_rocm_sdk_core/lib`.
|
||||
# 1. ROCM_HOME/ROCM_PATH environment variables
|
||||
# - ROCM_HOME/lib
|
||||
# - ROCM_PATH/lib (usually set to /opt/rocm/)
|
||||
@@ -194,6 +198,9 @@ def main():
|
||||
def find_smi_library():
|
||||
err = OSError("Could not load {library_name}")
|
||||
possible_locations = []
|
||||
# 0.
|
||||
libamd_smi_path = Path(__file__).resolve().parent.parent.parent.parent / "lib/libamd_smi.so"
|
||||
possible_locations.append(libamd_smi_path)
|
||||
# 1.
|
||||
rocm_path = os.getenv("ROCM_HOME", os.getenv("ROCM_PATH"))
|
||||
if rocm_path:
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário