mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-21 04:35:02 +08:00
[CPU][FIX] Fix build failures on Arm CPUs with torch nightly (#30481)
Signed-off-by: Fadi Arafeh <fadi.arafeh@arm.com>
This commit is contained in:
parent
042da73244
commit
f355ad5412
@ -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):
|
|||||||
# 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:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user