-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows rapids-cmake patch CUDAToolkit to fix missing cublas and cusolver dependencies. https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7633
- Loading branch information
1 parent
8ff1c5c
commit b43b36c
Showing
11 changed files
with
203 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.. cmake-module:: ../../rapids-cmake/cuda/patch_toolkit.cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
include_guard(GLOBAL) | ||
|
||
#[=======================================================================[.rst: | ||
|
||
--------------------------------- | ||
|
||
.. versionadded:: v22.10.00 | ||
|
||
Corrects missing dependencies in the CUDA toolkit | ||
|
||
.. code-block:: cmake | ||
|
||
rapids_cuda_patch_toolkit( ) | ||
|
||
For CMake versions 3.23.1-3, and 3.24.1 the dependencies | ||
of cublas and cusolver targets are incorrect. This module must be called | ||
from the same CMakeLists.txt as the first `find_project(CUDAToolkit)` to | ||
patch the targets. | ||
|
||
.. note:: | ||
:cmake:command:`rapids_cpm_find` will automatically call this module | ||
when asked to find the CUDAToolkit. | ||
|
||
#]=======================================================================] | ||
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) | ||
endif() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
|
||
cmake_minimum_required(VERSION 3.23.1) | ||
project(rapids-project LANGUAGES CUDA) | ||
|
||
include(${rapids-cmake-dir}/cuda/patch_toolkit.cmake) | ||
|
||
function(verify_links_to target library) | ||
get_target_property(link_libs ${target} INTERFACE_LINK_LIBRARIES) | ||
if(NOT ${library} IN_LIST link_libs) | ||
message(FATAL_ERROR "${target} doesn't link to ${library}") | ||
endif() | ||
endfunction() | ||
|
||
find_package(CUDAToolkit) | ||
rapids_cuda_patch_toolkit() | ||
|
||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
include(${rapids-cmake-dir}/cuda/patch_toolkit.cmake) | ||
|
||
rapids_cuda_patch_toolkit() | ||
find_package(CUDAToolkit) | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
include(${rapids-cmake-dir}/cuda/patch_toolkit.cmake) | ||
|
||
function(verify_links_to target library) | ||
get_target_property(link_libs ${target} INTERFACE_LINK_LIBRARIES) | ||
if(NOT ${library} IN_LIST link_libs) | ||
message(FATAL_ERROR "${target} doesn't link to ${library}") | ||
endif() | ||
endfunction() | ||
|
||
# Verify we can call before find_package | ||
rapids_cuda_patch_toolkit() | ||
|
||
find_package(CUDAToolkit) | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
include(${rapids-cmake-dir}/find/package.cmake) | ||
|
||
function(verify_links_to target library) | ||
get_target_property(link_libs ${target} INTERFACE_LINK_LIBRARIES) | ||
if(NOT ${library} IN_LIST link_libs) | ||
message(FATAL_ERROR "${target} doesn't link to ${library}") | ||
endif() | ||
endfunction() | ||
|
||
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() |