Skip to content

Commit

Permalink
rapids_cuda_patch_toolkit: Better handle non-standard toolkits (#324)
Browse files Browse the repository at this point in the history
Previously we presumed that `cublas`, `cusparse`, and `cusolver` would always be found and offer both static and shared versions. Now we only setup these rules if the correct targets exist.

Fixes #321

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #324
  • Loading branch information
robertmaynard authored Dec 12, 2022
1 parent de91a78 commit ce6d4b4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
19 changes: 12 additions & 7 deletions rapids-cmake/cuda/patch_toolkit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ function(rapids_cuda_patch_toolkit)
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cuda.patch_toolkit")

get_directory_property(itargets IMPORTED_TARGETS)
if(CUDA::cublas_static IN_LIST itargets)
target_link_libraries(CUDA::cublas INTERFACE CUDA::cublasLt)
target_link_libraries(CUDA::cusparse INTERFACE CUDA::cublas)

target_link_libraries(CUDA::cublas_static INTERFACE CUDA::cublasLt_static)
target_link_libraries(CUDA::cusolver_static INTERFACE CUDA::cusolver_lapack_static)
target_link_libraries(CUDA::cusparse_static INTERFACE CUDA::cublas_static)
if(CMAKE_VERSION VERSION_LESS 3.24.2)
if(CUDA::cublas IN_LIST itargets)
target_link_libraries(CUDA::cublas INTERFACE CUDA::cublasLt)
endif()

if(CUDA::cublas_static IN_LIST itargets)
target_link_libraries(CUDA::cublas_static INTERFACE CUDA::cublasLt_static)
endif()

if(CUDA::cusolver_static IN_LIST itargets)
target_link_libraries(CUDA::cusolver_static INTERFACE CUDA::cusolver_lapack_static)
endif()
endif()
endfunction()
2 changes: 0 additions & 2 deletions testing/cuda/patch_toolkit-nested/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ add_subdirectory(subdir)

if(TARGET CUDA::cublas_static)
verify_links_to(CUDA::cublas CUDA::cublasLt)
verify_links_to(CUDA::cusparse CUDA::cublas)
verify_links_to(CUDA::cublas_static CUDA::cublasLt_static)
verify_links_to(CUDA::cusparse_static CUDA::cublas_static)
verify_links_to(CUDA::cusolver_static CUDA::cusolver_lapack_static)
endif()
2 changes: 0 additions & 2 deletions testing/cuda/patch_toolkit-nested/subdir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ rapids_cuda_patch_toolkit()

if(TARGET CUDA::cublas_static)
verify_links_to(CUDA::cublas CUDA::cublasLt)
verify_links_to(CUDA::cusparse CUDA::cublas)
verify_links_to(CUDA::cublas_static CUDA::cublasLt_static)
verify_links_to(CUDA::cusparse_static CUDA::cublas_static)
verify_links_to(CUDA::cusolver_static CUDA::cusolver_lapack_static)
endif()
2 changes: 0 additions & 2 deletions testing/cuda/patch_toolkit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ rapids_cuda_patch_toolkit()

if(TARGET CUDA::cublas_static)
verify_links_to(CUDA::cublas CUDA::cublasLt)
verify_links_to(CUDA::cusparse CUDA::cublas)
verify_links_to(CUDA::cublas_static CUDA::cublasLt_static)
verify_links_to(CUDA::cusparse_static CUDA::cublas_static)
verify_links_to(CUDA::cusolver_static CUDA::cusolver_lapack_static)
endif()
2 changes: 0 additions & 2 deletions testing/find/find_package-cudatoolkit-patching.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ rapids_find_package(CUDAToolkit)

if(TARGET CUDA::cublas_static)
verify_links_to(CUDA::cublas CUDA::cublasLt)
verify_links_to(CUDA::cusparse CUDA::cublas)
verify_links_to(CUDA::cublas_static CUDA::cublasLt_static)
verify_links_to(CUDA::cusparse_static CUDA::cublas_static)
verify_links_to(CUDA::cusolver_static CUDA::cusolver_lapack_static)
endif()

0 comments on commit ce6d4b4

Please sign in to comment.