A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 4, 06:15 UTC
[Build] Fall back to system libgomp when torch has no vendored copy (#40575)
Signed-off-by: liuyudong <liuyudong@iscas.ac.cn> Co-authored-by: Claude <noreply@anthropic.com>
lyd1992 committed
May 6, 2026 at 11:42 UTC
aee190ac37cd98ed164d870763a1fec6041e3cb4
1 file changed
+14
-9
cmake/cpu_extension.cmake
+14
-9
@@ -32,18 +32,23 @@ else()
32
"-DVLLM_CPU_EXTENSION")
33
34
# locate PyTorch's libgomp (e.g. site-packages/torch.libs/libgomp-947d5fa1.so.1.0.0)
35
- # and create a local shim dir with it
35
+ # and create a local shim dir with it. When PyTorch is built from source or packaged
36
+ # by a distro (common on RISC-V, s390x, Fedora/RHEL aarch64), no vendored libgomp
37
+ # exists and the shim dir is empty; fall back to the system libgomp in that case.
38
vllm_prepare_torch_gomp_shim(VLLM_TORCH_GOMP_SHIM_DIR)
39
38
- find_library(OPEN_MP
39
- NAMES gomp
40
- PATHS ${VLLM_TORCH_GOMP_SHIM_DIR}
41
- NO_DEFAULT_PATH
42
- REQUIRED
43
- )
44
- # Set LD_LIBRARY_PATH to include the shim dir at build time to use the same libgomp as PyTorch
45
- if (OPEN_MP)
40
+ if(VLLM_TORCH_GOMP_SHIM_DIR)
41
+ find_library(OPEN_MP
42
+ NAMES gomp
43
+ PATHS "${VLLM_TORCH_GOMP_SHIM_DIR}"
44
+ NO_DEFAULT_PATH
45
+ REQUIRED
46
+ )
47
+ # Use the same libgomp as PyTorch at runtime
48
set(ENV{LD_LIBRARY_PATH} "${VLLM_TORCH_GOMP_SHIM_DIR}:$ENV{LD_LIBRARY_PATH}")
49
+ else()
50
+ # Fall back to system / toolchain libgomp
51
+ find_library(OPEN_MP NAMES gomp REQUIRED)
52
endif()
53
endif()
54