mirror of
https://github.com/ollama/ollama.git
synced 2026-04-17 15:53:27 +02:00
ci: harden cuda include path handling (#15093)
On windows we can get multiple include dirs, so find where the headers are then copy from that location.
This commit is contained in:
@@ -284,41 +284,54 @@ if(MLX_ENGINE)
|
|||||||
# The Go mlxrunner sets CUDA_PATH to OLLAMA_INSTALL_DIR so MLX finds them at
|
# The Go mlxrunner sets CUDA_PATH to OLLAMA_INSTALL_DIR so MLX finds them at
|
||||||
# $CUDA_PATH/include/*.h via NVRTC --include-path.
|
# $CUDA_PATH/include/*.h via NVRTC --include-path.
|
||||||
if(CUDAToolkit_FOUND)
|
if(CUDAToolkit_FOUND)
|
||||||
set(_cuda_inc "${CUDAToolkit_INCLUDE_DIRS}")
|
# CUDAToolkit_INCLUDE_DIRS may be a semicolon-separated list
|
||||||
set(_dst "${OLLAMA_INSTALL_DIR}/include")
|
# (e.g. ".../include;.../include/cccl"). Find the entry that
|
||||||
set(_MLX_JIT_CUDA_HEADERS
|
# contains the CUDA runtime headers we need.
|
||||||
builtin_types.h
|
set(_cuda_inc "")
|
||||||
cooperative_groups.h
|
foreach(_dir ${CUDAToolkit_INCLUDE_DIRS})
|
||||||
cuda_bf16.h
|
if(EXISTS "${_dir}/cuda_runtime_api.h")
|
||||||
cuda_bf16.hpp
|
set(_cuda_inc "${_dir}")
|
||||||
cuda_device_runtime_api.h
|
break()
|
||||||
cuda_fp16.h
|
endif()
|
||||||
cuda_fp16.hpp
|
|
||||||
cuda_fp8.h
|
|
||||||
cuda_fp8.hpp
|
|
||||||
cuda_runtime_api.h
|
|
||||||
device_types.h
|
|
||||||
driver_types.h
|
|
||||||
math_constants.h
|
|
||||||
surface_types.h
|
|
||||||
texture_types.h
|
|
||||||
vector_functions.h
|
|
||||||
vector_functions.hpp
|
|
||||||
vector_types.h
|
|
||||||
)
|
|
||||||
foreach(_hdr ${_MLX_JIT_CUDA_HEADERS})
|
|
||||||
install(FILES "${_cuda_inc}/${_hdr}"
|
|
||||||
DESTINATION ${_dst}
|
|
||||||
COMPONENT MLX)
|
|
||||||
endforeach()
|
endforeach()
|
||||||
# Subdirectory headers
|
if(NOT _cuda_inc)
|
||||||
install(DIRECTORY "${_cuda_inc}/cooperative_groups"
|
message(WARNING "Could not find cuda_runtime_api.h in CUDAToolkit_INCLUDE_DIRS: ${CUDAToolkit_INCLUDE_DIRS}")
|
||||||
DESTINATION ${_dst}
|
else()
|
||||||
COMPONENT MLX
|
set(_dst "${OLLAMA_INSTALL_DIR}/include")
|
||||||
FILES_MATCHING PATTERN "*.h")
|
set(_MLX_JIT_CUDA_HEADERS
|
||||||
install(FILES "${_cuda_inc}/crt/host_defines.h"
|
builtin_types.h
|
||||||
DESTINATION "${_dst}/crt"
|
cooperative_groups.h
|
||||||
COMPONENT MLX)
|
cuda_bf16.h
|
||||||
|
cuda_bf16.hpp
|
||||||
|
cuda_device_runtime_api.h
|
||||||
|
cuda_fp16.h
|
||||||
|
cuda_fp16.hpp
|
||||||
|
cuda_fp8.h
|
||||||
|
cuda_fp8.hpp
|
||||||
|
cuda_runtime_api.h
|
||||||
|
device_types.h
|
||||||
|
driver_types.h
|
||||||
|
math_constants.h
|
||||||
|
surface_types.h
|
||||||
|
texture_types.h
|
||||||
|
vector_functions.h
|
||||||
|
vector_functions.hpp
|
||||||
|
vector_types.h
|
||||||
|
)
|
||||||
|
foreach(_hdr ${_MLX_JIT_CUDA_HEADERS})
|
||||||
|
install(FILES "${_cuda_inc}/${_hdr}"
|
||||||
|
DESTINATION ${_dst}
|
||||||
|
COMPONENT MLX)
|
||||||
|
endforeach()
|
||||||
|
# Subdirectory headers
|
||||||
|
install(DIRECTORY "${_cuda_inc}/cooperative_groups"
|
||||||
|
DESTINATION ${_dst}
|
||||||
|
COMPONENT MLX
|
||||||
|
FILES_MATCHING PATTERN "*.h")
|
||||||
|
install(FILES "${_cuda_inc}/crt/host_defines.h"
|
||||||
|
DESTINATION "${_dst}/crt"
|
||||||
|
COMPONENT MLX)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# On Windows, explicitly install dl.dll (dlfcn-win32 POSIX dlopen emulation)
|
# On Windows, explicitly install dl.dll (dlfcn-win32 POSIX dlopen emulation)
|
||||||
|
|||||||
Reference in New Issue
Block a user