Unverified Commit f355ad54 authored by Fadi Arafeh's avatar Fadi Arafeh Committed by GitHub
Browse files

[CPU][FIX] Fix build failures on Arm CPUs with torch nightly (#30481)


Signed-off-by: default avatarFadi Arafeh <fadi.arafeh@arm.com>
parent 042da732
...@@ -140,16 +140,21 @@ function(vllm_prepare_torch_gomp_shim TORCH_GOMP_SHIM_DIR) ...@@ -140,16 +140,21 @@ function(vllm_prepare_torch_gomp_shim TORCH_GOMP_SHIM_DIR)
run_python(_VLLM_TORCH_GOMP_PATH run_python(_VLLM_TORCH_GOMP_PATH
" "
import os, glob import os, glob
try: import torch
import torch torch_pkg = os.path.dirname(torch.__file__)
torch_pkg = os.path.dirname(torch.__file__) site_root = os.path.dirname(torch_pkg)
site_root = os.path.dirname(torch_pkg)
torch_libs = os.path.join(site_root, 'torch.libs') # Search both torch.libs and torch/lib
print(glob.glob(os.path.join(torch_libs, 'libgomp-*.so*'))[0]) roots = [os.path.join(site_root, 'torch.libs'), os.path.join(torch_pkg, 'lib')]
except: candidates = []
print('') for root in roots:
if not os.path.isdir(root):
continue
candidates.extend(glob.glob(os.path.join(root, 'libgomp*.so*')))
print(candidates[0] if candidates else '')
" "
"failed to probe torch.libs for libgomp") "failed to probe for libgomp")
if(_VLLM_TORCH_GOMP_PATH STREQUAL "" OR NOT EXISTS "${_VLLM_TORCH_GOMP_PATH}") if(_VLLM_TORCH_GOMP_PATH STREQUAL "" OR NOT EXISTS "${_VLLM_TORCH_GOMP_PATH}")
return() return()
......
...@@ -325,10 +325,16 @@ class CpuPlatform(Platform): ...@@ -325,10 +325,16 @@ class CpuPlatform(Platform):
# We need to find the location of PyTorch's libgomp # We need to find the location of PyTorch's libgomp
torch_pkg = os.path.dirname(torch.__file__) torch_pkg = os.path.dirname(torch.__file__)
site_root = os.path.dirname(torch_pkg) site_root = os.path.dirname(torch_pkg)
torch_libs = os.path.join(site_root, "torch.libs") # Search both torch.libs and torch/lib - See: https://github.com/vllm-project/vllm/issues/30470
pytorch_libgomp_so_candidates = glob.glob( torch_libs_paths = [
os.path.join(torch_libs, "libgomp-*.so*") os.path.join(site_root, "torch.libs"),
) os.path.join(torch_pkg, "lib"),
]
pytorch_libgomp_so_candidates = []
for torch_libs in torch_libs_paths:
pytorch_libgomp_so_candidates.extend(
glob.glob(os.path.join(torch_libs, "libgomp*.so*"))
)
if pytorch_libgomp_so_candidates: if pytorch_libgomp_so_candidates:
pytorch_libgomp_so = pytorch_libgomp_so_candidates[0] pytorch_libgomp_so = pytorch_libgomp_so_candidates[0]
if ld_preload_str: if ld_preload_str:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment