wsl rocm preload hsa runtime library

This commit is contained in:
Seunghoon Lee
2024-06-28 16:39:54 +09:00
parent 6fb7cee82c
commit a5a7d65dfe
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -680,6 +680,20 @@ def check_torch():
install('onnxruntime-gpu', 'onnxruntime-gpu', ignore=True, quiet=True)
elif is_rocm_available(allow_rocm):
torch_command = install_rocm_zluda(torch_command)
# WSL ROCm
if os.environ.get('WSL_DISTRO_NAME', None) is not None:
import ctypes
try:
# Preload stdc++ library. This will ignore Anaconda stdc++ library.
ctypes.CDLL("/lib/x86_64-linux-gnu/libstdc++.so.6", mode=ctypes.RTLD_GLOBAL)
except OSError:
pass
try:
# Preload HSA Runtime library.
ctypes.CDLL("/opt/rocm/lib/libhsa-runtime64.so", mode=ctypes.RTLD_GLOBAL)
except OSError:
log.error("Failed to preload HSA Runtime library.")
elif is_ipex_available(allow_ipex):
torch_command = install_ipex(torch_command)
elif allow_openvino and args.use_openvino:
+1 -1
View File
@@ -33,7 +33,7 @@ def install(zluda_path: os.PathLike) -> None:
if os.path.exists(zluda_path):
return
if platform.system() != 'Windows': # TODO
if platform.system() != 'Windows': # Windows-only. (PyTorch should be rebuilt on Linux)
return
with open('_zluda', 'wb') as file: