Skip to content

Commit

Permalink
Remove linking of cusparse to cublas
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmaynard committed Dec 8, 2022
1 parent 39376be commit 43bc98e
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 16 deletions.
8 changes: 0 additions & 8 deletions rapids-cmake/cuda/patch_toolkit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ 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.
For all versions of CMake, the dependencies of cusparse are incorrect.
.. note::
:cmake:command:`rapids_cpm_find` will automatically call this module
when asked to find the CUDAToolkit.
Expand All @@ -55,11 +54,4 @@ function(rapids_cuda_patch_toolkit)
target_link_libraries(CUDA::cusolver_static INTERFACE CUDA::cusolver_lapack_static)
endif()
endif()

if(CUDA::cusparse IN_LIST itargets)
target_link_libraries(CUDA::cusparse INTERFACE CUDA::cublas)
endif()
if(CUDA::cusparse_static IN_LIST itargets)
target_link_libraries(CUDA::cusparse_static INTERFACE CUDA::cublas_static)
endif()
endfunction()
40 changes: 40 additions & 0 deletions testing/cpm/ccache_nvbench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#=============================================================================
# Copyright (c) 2021, 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)

project(ccache_nvbench LANGUAGES CXX CUDA)

set(rapids-cmake "/home/rmaynard/Work/rapids-cmake/")
add_subdirectory(${rapids-cmake} rapids-cmake)

set(rapids-cmake_SOURCE_DIR "${rapids-cmake}")
set(rapids-cmake_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rapids-cmake")
set(rapids-cmake_POPULATED TRUE)
set(prefix "_FetchContent_rapids-cmake")
set_property(GLOBAL PROPERTY ${prefix}_sourceDir "${rapids-cmake_SOURCE_DIR}")
set_property(GLOBAL PROPERTY ${prefix}_binaryDir "${rapids-cmake_BINARY_DIR}")
define_property(GLOBAL PROPERTY ${prefix}_populated)


include(${rapids-cmake-dir}/cpm/init.cmake)
include(${rapids-cmake-dir}/cpm/nvbench.cmake)

rapids_cpm_init()
rapids_cpm_nvbench()

add_executable(t t.cu)
target_link_libraries(t PUBLIC nvbench::nvbench nvbench::main)
13 changes: 13 additions & 0 deletions testing/cpm/ccache_nvbench/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# set -Eeo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export CCACHE_BASEDIR="${SCRIPT_DIR}/build/release";
export CCACHE_BASEDIR="$(realpath -m $CCACHE_BASEDIR)";

set -x
echo ${CCACHE_BASEDIR}
time cmake --build "${SCRIPT_DIR}/build/release" ;

unset CCACHE_BASEDIR;
Empty file.
4 changes: 4 additions & 0 deletions testing/cpm/ccache_nvbench/t.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

#include <nvbench/nvbench.cuh>

int foo( int x ) { return x * 3 * x * 3 * 4 * x-1; }
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 43bc98e

Please sign in to comment.