Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix find_library(cublas) issue on the machine installing multiple cuda #591

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ else()
set(CUDA_RUNTIME_LIBS "${CUDA_RUNTIME_LIBS_DYNAMIC}" CACHE STRING "Path to a library" FORCE)
endif()

# CUDA 10.1/10.2 put cublas, cublasLt, cudnn in /usr/lib/<arch>-linux-gnu/, but
# others (<= 10.0 or >= 11) put them in cuda own directory
# If the environment installs several cuda including 10.1/10.2, cmake will find
# the 10.1/10.2 .so files when searching others cuda in the default path.
# CMake already puts /usr/lib/<arch>-linux-gnu/ after cuda own directory in the
# `CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES`, so we always put NO_DEFAULT_PATH here.
find_library(CUBLAS cublas
HINT ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
HINT ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} NO_DEFAULT_PATH)
find_library(CUSPARSE cusparse
HINT ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})

Expand Down