Commit e928109c by Junru Shao Committed by Tianqi Chen

[BUG] Fix incorrect libcuda.so found by cmake when multiple versions of CUDA exist (#1788)

parent eacc2bc4
...@@ -56,13 +56,15 @@ macro(find_cuda use_cuda) ...@@ -56,13 +56,15 @@ macro(find_cuda use_cuda)
else(MSVC) else(MSVC)
find_library(_CUDA_CUDA_LIBRARY cuda find_library(_CUDA_CUDA_LIBRARY cuda
PATHS ${CUDA_TOOLKIT_ROOT_DIR} PATHS ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 targets/x86_64-linux/lib targets/x86_64-linux/lib/stubs) PATH_SUFFIXES lib lib64 targets/x86_64-linux/lib targets/x86_64-linux/lib/stubs lib64/stubs
NO_DEFAULT_PATH)
if(_CUDA_CUDA_LIBRARY) if(_CUDA_CUDA_LIBRARY)
set(CUDA_CUDA_LIBRARY ${_CUDA_CUDA_LIBRARY}) set(CUDA_CUDA_LIBRARY ${_CUDA_CUDA_LIBRARY})
endif() endif()
find_library(CUDA_NVRTC_LIBRARY nvrtc find_library(CUDA_NVRTC_LIBRARY nvrtc
PATHS ${CUDA_TOOLKIT_ROOT_DIR} PATHS ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 targets/x86_64-linux/lib targets/x86_64-linux/lib/stubs) PATH_SUFFIXES lib lib64 targets/x86_64-linux/lib targets/x86_64-linux/lib/stubs lib64/stubs
NO_DEFAULT_PATH)
find_library(CUDA_CUDNN_LIBRARY cudnn find_library(CUDA_CUDNN_LIBRARY cudnn
${CUDA_TOOLKIT_ROOT_DIR}/lib64 ${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib) ${CUDA_TOOLKIT_ROOT_DIR}/lib)
...@@ -70,5 +72,11 @@ macro(find_cuda use_cuda) ...@@ -70,5 +72,11 @@ macro(find_cuda use_cuda)
${CUDA_TOOLKIT_ROOT_DIR}/lib64 ${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib) ${CUDA_TOOLKIT_ROOT_DIR}/lib)
endif(MSVC) endif(MSVC)
message(STATUS "Found CUDA_TOOLKIT_ROOT_DIR=" ${CUDA_TOOLKIT_ROOT_DIR})
message(STATUS "Found CUDA_CUDA_LIBRARY=" ${CUDA_CUDA_LIBRARY})
message(STATUS "Found CUDA_CUDART_LIBRARY=" ${CUDA_CUDART_LIBRARY})
message(STATUS "Found CUDA_NVRTC_LIBRARY=" ${CUDA_NVRTC_LIBRARY})
message(STATUS "Found CUDA_CUDNN_LIBRARY=" ${CUDA_CUDNN_LIBRARY})
message(STATUS "Found CUDA_CUBLAS_LIBRARY=" ${CUDA_CUBLAS_LIBRARY})
endif(CUDA_FOUND) endif(CUDA_FOUND)
endmacro(find_cuda) endmacro(find_cuda)
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# - LLVM_INCLUDE_DIRS # - LLVM_INCLUDE_DIRS
# - LLVM_LIBS # - LLVM_LIBS
# - LLVM_DEFINITIONS # - LLVM_DEFINITIONS
# - TVM_LLVM_VERISON # - TVM_LLVM_VERSION
# #
macro(find_llvm use_llvm) macro(find_llvm use_llvm)
set(LLVM_CONFIG ${use_llvm}) set(LLVM_CONFIG ${use_llvm})
...@@ -56,4 +56,9 @@ macro(find_llvm use_llvm) ...@@ -56,4 +56,9 @@ macro(find_llvm use_llvm)
separate_arguments(LLVM_LIBS) separate_arguments(LLVM_LIBS)
string(STRIP ${TVM_LLVM_VERSION} TVM_LLVM_VERSION) string(STRIP ${TVM_LLVM_VERSION} TVM_LLVM_VERSION)
endif() endif()
if(NOT LLVM_CONFIG STREQUAL "OFF")
message(STATUS "Found LLVM_INCLUDE_DIRS=" ${LLVM_INCLUDE_DIRS})
message(STATUS "Found LLVM_DEFINITIONS=" ${LLVM_DEFINITIONS})
message(STATUS "Found TVM_LLVM_VERSION=" ${TVM_LLVM_VERSION})
endif()
endmacro(find_llvm) endmacro(find_llvm)
...@@ -21,21 +21,27 @@ macro(find_rocm use_rocm) ...@@ -21,21 +21,27 @@ macro(find_rocm use_rocm)
if(IS_DIRECTORY ${__use_rocm}) if(IS_DIRECTORY ${__use_rocm})
set(__rocm_sdk ${__use_rocm}) set(__rocm_sdk ${__use_rocm})
message(STATUS "Custom ROCM SDK PATH=" ${__use_rocm}) message(STATUS "Custom ROCM SDK PATH=" ${__use_rocm})
elseif(IS_DIRECTORY $ENV{ROCM_PATH}) elseif(IS_DIRECTORY $ENV{ROCM_PATH})
set(__rocm_sdk $ENV{ROCM_PATH}) set(__rocm_sdk $ENV{ROCM_PATH})
elseif(IS_DIRECTORY /opt/rocm) elseif(IS_DIRECTORY /opt/rocm)
set(__rocm_sdk /opt/rocm) set(__rocm_sdk /opt/rocm)
else() else()
set(__rocm_sdk "") set(__rocm_sdk "")
endif() endif()
if(__rocm_sdk) if(__rocm_sdk)
set(ROCM_INCLUDE_DIRS ${__rocm_sdk}/include) set(ROCM_INCLUDE_DIRS ${__rocm_sdk}/include)
find_library(ROCM_HIPHCC_LIBRARY hip_hcc ${__rocm_sdk}/lib) find_library(ROCM_HIPHCC_LIBRARY hip_hcc ${__rocm_sdk}/lib)
find_library(ROCM_MIOPEN_LIBRARY MIOpen ${__rocm_sdk}/lib) find_library(ROCM_MIOPEN_LIBRARY MIOpen ${__rocm_sdk}/lib)
find_library(ROCM_ROCBLAS_LIBRARY rocblas ${__rocm_sdk}/lib) find_library(ROCM_ROCBLAS_LIBRARY rocblas ${__rocm_sdk}/lib)
if(ROCM_HIPHCC_LIBRARY) if(ROCM_HIPHCC_LIBRARY)
set(ROCM_FOUND TRUE) set(ROCM_FOUND TRUE)
endif() endif()
endif(__rocm_sdk) endif(__rocm_sdk)
if(ROCM_FOUND)
message(STATUS "Found ROCM_INCLUDE_DIRS=" ${ROCM_INCLUDE_DIRS})
message(STATUS "Found ROCM_HIPHCC_LIBRARY=" ${ROCM_HIPHCC_LIBRARY})
message(STATUS "Found ROCM_MIOPEN_LIBRARY=" ${ROCM_MIOPEN_LIBRARY})
message(STATUS "Found ROCM_ROCBLAS_LIBRARY=" ${ROCM_ROCBLAS_LIBRARY})
endif(ROCM_FOUND)
endmacro(find_rocm) endmacro(find_rocm)
...@@ -51,5 +51,8 @@ macro(find_vulkan use_vulkan) ...@@ -51,5 +51,8 @@ macro(find_vulkan use_vulkan)
find_path(_spirv spirv.hpp HINTS ${Vulkan_INCLUDE_DIRS} PATH_SUFFIXES vulkan spirv/unified1) find_path(_spirv spirv.hpp HINTS ${Vulkan_INCLUDE_DIRS} PATH_SUFFIXES vulkan spirv/unified1)
find_path(_glsl_std GLSL.std.450.h HINTS ${Vulkan_INCLUDE_DIRS} PATH_SUFFIXES vulkan spirv/unified1) find_path(_glsl_std GLSL.std.450.h HINTS ${Vulkan_INCLUDE_DIRS} PATH_SUFFIXES vulkan spirv/unified1)
list(APPEND Vulkan_INCLUDE_DIRS ${_libspirv} ${_spirv} ${_glsl_std}) list(APPEND Vulkan_INCLUDE_DIRS ${_libspirv} ${_spirv} ${_glsl_std})
message(STATUS "Vulkan_INCLUDE_DIRS=" ${Vulkan_INCLUDE_DIRS})
message(STATUS "Vulkan_LIBRARY=" ${Vulkan_LIBRARY})
message(STATUS "Vulkan_SPIRV_TOOLS_LIBRARY=" ${Vulkan_SPIRV_TOOLS_LIBRARY})
endif(Vulkan_FOUND) endif(Vulkan_FOUND)
endmacro(find_vulkan) endmacro(find_vulkan)
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