From c95161b99cf42cce9372d60df065ccca8e5287f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 27 Nov 2023 16:30:55 +0100 Subject: [PATCH 1/6] CI: Add runner using MSVC with CUDA --- .github/workflows/root-cmakelists.yaml | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/root-cmakelists.yaml b/.github/workflows/root-cmakelists.yaml index 5fc10ef12..67c99dae5 100644 --- a/.github/workflows/root-cmakelists.yaml +++ b/.github/workflows/root-cmakelists.yaml @@ -212,7 +212,7 @@ jobs: # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners runs-on: windows-latest - name: msvc (${{ matrix.openmp }} OpenMP) + name: msvc (${{ matrix.openmp }} OpenMP ${{ matrix.cuda }} CUDA) defaults: run: @@ -225,9 +225,15 @@ jobs: matrix: openmp: [with, without] + cuda: [without] include: - openmp: without openmp-cmake-flags: "-DNOPENMP=ON" + - openmp: with + cuda: with + cuda-cmake-flags: + -DENABLE_CUDA=ON + -DCMAKE_CUDA_COMPILER_LAUNCHER="ccache" env: CHERE_INVOKING: 1 @@ -283,6 +289,18 @@ jobs: msystem: UCRT64 + - uses: Jimver/cuda-toolkit@v0.2.11 + name: install CUDA toolkit + if: matrix.cuda == 'with' + id: cuda-toolkit + with: + cuda: '12.2.0' + #See https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#install-the-cuda-software + method: 'local' + # Do not cache the installer (~3 GiB). It doesn't speed up the + # installation significantly. And we need the space for ccache. + use-github-cache: 'false' + - name: setup build environment # get packages from MSYS2 # Copy only relevant parts to avoid picking up headers and libraries @@ -311,7 +329,7 @@ jobs: shell: msys2 {0} run: | echo "ccachedir=$(cygpath -m $(${CCACHE} -k cache_dir))" >> $GITHUB_OUTPUT - echo "key=ccache:msvc:root:${{ matrix.openmp }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT + echo "key=ccache:msvc:root:${{ matrix.openmp }}:${{ matrix.cuda }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT - name: restore ccache # Setup the GitHub cache used to maintain the ccache from one job to the next @@ -321,8 +339,8 @@ jobs: key: ${{ steps.ccache-prepare.outputs.key }} # Prefer caches from the same branch. Fall back to caches from the dev branch. restore-keys: | - ccache:msvc:root:${{ matrix.openmp }}:${{ github.ref }} - ccache:msvc:root:${{ matrix.openmp }}: + ccache:msvc:root:${{ matrix.openmp }}:${{ matrix.cuda }}:${{ github.ref }} + ccache:msvc:root:${{ matrix.openmp }}:${{ matrix.cuda }}: - name: configure ccache # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota. @@ -338,6 +356,11 @@ jobs: - name: configure run: | + declare -a _extra_config + if [ ${{ matrix.cuda }} = 'with' ]; then + _extra_config+=(-DCUDAToolkit_ROOT="$(cygpath -m "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}")") + _extra_config+=(-DCMAKE_CUDA_COMPILER="$(cygpath -m "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}")/bin/nvcc.exe") + fi mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build cmake -G"Ninja Multi-Config" \ -DCMAKE_BUILD_TYPE="Release" \ @@ -350,6 +373,8 @@ jobs: -DBLA_VENDOR="All" \ -DPython_EXECUTABLE="C:/msys64/ucrt64/bin/python.exe" \ ${{ matrix.openmp-cmake-flags }} \ + ${{ matrix.cuda-cmake-flags }} \ + "${_extra_config[@]}" \ .. - name: build libraries From 9b5dd77cb2a737bcc04ac4896edef54bafe9c0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 27 Nov 2023 22:21:30 +0100 Subject: [PATCH 2/6] Only link to CUDA::nvtx3 when needed. Replace CUDA::nvToolsExt with CUDA::nvtx3 in GraphBLAS_CUDA and add the preprocessor definition to actually use it. --- CHOLMOD/CMakeLists.txt | 2 +- GraphBLAS/CUDA/CMakeLists.txt | 7 ++++++- SPQR/GPUQREngine/CMakeLists.txt | 2 +- SPQR/GPURuntime/CMakeLists.txt | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHOLMOD/CMakeLists.txt b/CHOLMOD/CMakeLists.txt index 7ea4e246a..8a6f8847b 100644 --- a/CHOLMOD/CMakeLists.txt +++ b/CHOLMOD/CMakeLists.txt @@ -748,7 +748,7 @@ add_test ( NAME CHOLMOD_int64_single_supernodal if ( WIN32 AND BUILD_SHARED_LIBS ) # Set PATH to pick up the necessary libraries for all tests - set ( CHOLMOD_CTEST_NAMES + set ( CHOLMOD_CTEST_NAMES CHOLMOD_int32_double_bcsstk01 CHOLMOD_int64_double_bcsstk01 CHOLMOD_int32_single_bcsstk01 CHOLMOD_int64_single_bcsstk01 CHOLMOD_int32_double_lp_afiro CHOLMOD_int64_double_lp_afiro CHOLMOD_int32_single_lp_afiro CHOLMOD_int64_single_lp_afiro CHOLMOD_int32_double_can24 CHOLMOD_int64_double_can24 CHOLMOD_int32_single_can24 CHOLMOD_int64_single_can24 diff --git a/GraphBLAS/CUDA/CMakeLists.txt b/GraphBLAS/CUDA/CMakeLists.txt index 89c779ff1..1339edb5d 100644 --- a/GraphBLAS/CUDA/CMakeLists.txt +++ b/GraphBLAS/CUDA/CMakeLists.txt @@ -73,7 +73,12 @@ set_target_properties(GraphBLAS_CUDA PROPERTIES CUDA_SEPARABLE_COMPILATION ON) # FIXME: use SUITESPARSE_CUDA_ARCHITECTURES set_target_properties(GraphBLAS_CUDA PROPERTIES CUDA_ARCHITECTURES "52;75;80" ) -target_link_libraries(GraphBLAS_CUDA CUDA::nvrtc CUDA::cudart_static CUDA::cuda_driver CUDA::nvToolsExt ) +target_link_libraries ( GraphBLAS_CUDA CUDA::nvrtc CUDA::cudart_static CUDA::cuda_driver ) + +if ( TARGET CUDA::nvtx3 ) + target_link_libraries ( GraphBLAS_CUDA CUDA::nvtx3 ) + target_compile_definitions ( GraphBLAS_CUDA PRIVATE GBNVTX ) +endif ( ) target_compile_definitions ( GraphBLAS_CUDA PUBLIC "SUITESPARSE_CUDA" ) diff --git a/SPQR/GPUQREngine/CMakeLists.txt b/SPQR/GPUQREngine/CMakeLists.txt index 58cd8f393..87d5850e1 100644 --- a/SPQR/GPUQREngine/CMakeLists.txt +++ b/SPQR/GPUQREngine/CMakeLists.txt @@ -21,7 +21,7 @@ message ( STATUS "Building SPQR/GPUQRENGINE version: v" # define the project #------------------------------------------------------------------------------- -project ( gpuqrengine +project ( gpuqrengine VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}" LANGUAGES CXX CUDA ) diff --git a/SPQR/GPURuntime/CMakeLists.txt b/SPQR/GPURuntime/CMakeLists.txt index 473421afb..dfe936cf1 100644 --- a/SPQR/GPURuntime/CMakeLists.txt +++ b/SPQR/GPURuntime/CMakeLists.txt @@ -21,7 +21,7 @@ message ( STATUS "Building SPQR/GPURUNTIME version: v" # define the project #------------------------------------------------------------------------------- -project ( suitesparse_gpuruntime +project ( suitesparse_gpuruntime VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}" LANGUAGES C CXX CUDA ) @@ -81,7 +81,7 @@ if ( BUILD_SHARED_LIBS ) CUDA::nvrtc CUDA::cudart_static CUDA::cublas ) target_compile_definitions ( GPURuntime PRIVATE "SUITESPARSE_CUDA" ) - target_include_directories ( GPURuntime + target_include_directories ( GPURuntime INTERFACE $ $ ) endif ( ) @@ -117,7 +117,7 @@ if ( BUILD_STATIC_LIBS ) CUDA::nvrtc CUDA::cudart_static CUDA::cublas ) target_compile_definitions ( GPURuntime_static PRIVATE "SUITESPARSE_CUDA" ) - target_include_directories ( GPURuntime_static + target_include_directories ( GPURuntime_static INTERFACE $ $ ) endif ( ) From d1882ef8930c9e8ae074171e0e0876fedbcea893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Tue, 28 Nov 2023 13:15:16 +0100 Subject: [PATCH 3/6] GPUQREngine: Use std::size_t in C++ files --- SPQR/GPUQREngine/Include/GPUQREngine_BucketList.hpp | 4 +++- SPQR/GPUQREngine/Include/GPUQREngine_Front.hpp | 4 +++- SPQR/GPUQREngine/Include/GPUQREngine_LLBundle.hpp | 4 +++- SPQR/GPUQREngine/Include/GPUQREngine_Scheduler.hpp | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SPQR/GPUQREngine/Include/GPUQREngine_BucketList.hpp b/SPQR/GPUQREngine/Include/GPUQREngine_BucketList.hpp index ec4386f47..613081a05 100644 --- a/SPQR/GPUQREngine/Include/GPUQREngine_BucketList.hpp +++ b/SPQR/GPUQREngine/Include/GPUQREngine_BucketList.hpp @@ -20,6 +20,8 @@ #ifndef GPUQRENGINE_BUCKETLIST_HPP #define GPUQRENGINE_BUCKETLIST_HPP +#include + #include "GPUQREngine_Common.hpp" #include "GPUQREngine_TaskDescriptor.hpp" #include "GPUQREngine_LLBundle.hpp" @@ -72,7 +74,7 @@ template class BucketList int VThead; // Index of the first available entry in VTlist // Constructors - void *operator new(size_t, BucketList * p) + void *operator new(std::size_t, BucketList * p) { return p; } diff --git a/SPQR/GPUQREngine/Include/GPUQREngine_Front.hpp b/SPQR/GPUQREngine/Include/GPUQREngine_Front.hpp index 38320cbf6..e49d0e43a 100644 --- a/SPQR/GPUQREngine/Include/GPUQREngine_Front.hpp +++ b/SPQR/GPUQREngine/Include/GPUQREngine_Front.hpp @@ -19,6 +19,8 @@ #ifndef GPUQRENGINE_FRONT_HPP #define GPUQRENGINE_FRONT_HPP +#include + #include "GPUQREngine_Common.hpp" #include "GPUQREngine_SparseMeta.hpp" #include "GPUQREngine_FrontState.hpp" @@ -53,7 +55,7 @@ template class Front /* Debug Fields */ bool printMe; - void* operator new(size_t reqMem, Front* ptr){ return ptr; } + void* operator new(std::size_t reqMem, Front* ptr){ return ptr; } Front( Int fids_arg, // the front identifier diff --git a/SPQR/GPUQREngine/Include/GPUQREngine_LLBundle.hpp b/SPQR/GPUQREngine/Include/GPUQREngine_LLBundle.hpp index e78564013..a04636d5b 100644 --- a/SPQR/GPUQREngine/Include/GPUQREngine_LLBundle.hpp +++ b/SPQR/GPUQREngine/Include/GPUQREngine_LLBundle.hpp @@ -24,6 +24,8 @@ #ifndef GPUQRENGINE_LLBUNDLE_HPP #define GPUQRENGINE_LLBUNDLE_HPP +#include + #include "GPUQREngine_Common.hpp" #include "GPUQREngine_TaskDescriptor.hpp" @@ -76,7 +78,7 @@ template class LLBundle TaskType CurrentTask; - void *operator new(size_t, LLBundle * p){ return p; } + void *operator new(std::size_t, LLBundle * p){ return p; } //------------------------------------------------------------------------------ // // This file contains the constructor and destructor for the LLBundle class. diff --git a/SPQR/GPUQREngine/Include/GPUQREngine_Scheduler.hpp b/SPQR/GPUQREngine/Include/GPUQREngine_Scheduler.hpp index 5c642ca41..ab02ed522 100644 --- a/SPQR/GPUQREngine/Include/GPUQREngine_Scheduler.hpp +++ b/SPQR/GPUQREngine/Include/GPUQREngine_Scheduler.hpp @@ -19,6 +19,8 @@ #ifndef GPUQRENGINE_SCHEDULER_HPP #define GPUQRENGINE_SCHEDULER_HPP +#include + #include "GPUQREngine_Common.hpp" #include "GPUQREngine_FrontState.hpp" #include "GPUQREngine_TaskDescriptor.hpp" @@ -97,7 +99,7 @@ class Scheduler cudaStream_t memoryStreamD2H; /* Scheduler.cpp */ - void *operator new(size_t, Scheduler * p){ return p; } + void *operator new(std::size_t, Scheduler * p){ return p; } Scheduler(Front *fronts, Int numFronts, size_t gpuMemorySize); ~Scheduler(); From 13f03058be95ee3c06b742deb38755720b864470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Tue, 28 Nov 2023 20:53:41 +0100 Subject: [PATCH 4/6] SPQR: Change types in demos to avoid ambiguous function overloads. --- SPQR/Demo/qrdemo_gpu2.cpp | 4 ++-- SPQR/Demo/qrdemo_gpu3.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SPQR/Demo/qrdemo_gpu2.cpp b/SPQR/Demo/qrdemo_gpu2.cpp index b35e3adce..bbb35f82d 100644 --- a/SPQR/Demo/qrdemo_gpu2.cpp +++ b/SPQR/Demo/qrdemo_gpu2.cpp @@ -61,7 +61,7 @@ int main (int argc, char **argv) m = A->nrow ; n = A->ncol ; - long ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2])); + int ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2])); printf ("Matrix %6ld-by-%-6ld nnz: %6ld\n", m, n, cholmod_l_nnz (A, cc)) ; @@ -70,7 +70,7 @@ int main (int argc, char **argv) B = cholmod_l_ones (m, 1, A->xtype, cc) ; double tol = SPQR_NO_TOL ; - long econ = 0 ; + int64_t econ = 0 ; // [Q,R,E] = qr (A), but discard Q // SuiteSparseQR (ordering, tol, econ, A, &R, &E, cc) ; diff --git a/SPQR/Demo/qrdemo_gpu3.cpp b/SPQR/Demo/qrdemo_gpu3.cpp index dd2533eb3..75cc95e98 100644 --- a/SPQR/Demo/qrdemo_gpu3.cpp +++ b/SPQR/Demo/qrdemo_gpu3.cpp @@ -63,7 +63,7 @@ int main (int argc, char **argv) m = A->nrow ; n = A->ncol ; - long ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2])); + int ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2])); printf ("Matrix %6ld-by-%-6ld nnz: %6ld\n", m, n, cholmod_l_nnz (A, cc)) ; @@ -72,7 +72,7 @@ int main (int argc, char **argv) B = cholmod_l_ones (m, 1, A->xtype, cc) ; double tol = SPQR_NO_TOL ; - long econ = 0 ; + int64_t econ = 0 ; // [Q,R,E] = qr (A), but discard Q // SuiteSparseQR (ordering, tol, econ, A, &R, &E, cc) ; From c11dc531d91429beb04e7e74a707a1557cf7a20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Tue, 28 Nov 2023 21:48:27 +0100 Subject: [PATCH 5/6] SuiteSparsePolicy.cmake: Use `find_package` instead of `include` for CUDAToolkit --- GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake | 10 +++++----- .../cmake_modules/SuiteSparsePolicy.cmake | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake b/GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake index f80b1a32a..4c6d7272d 100644 --- a/GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake +++ b/GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake @@ -254,7 +254,7 @@ if ( ENABLE_CUDA ) # with CUDA: message ( STATUS "Find CUDA tool kit:" ) # FindCUDAToolKit needs to have C or CXX enabled first (see above) - include ( FindCUDAToolkit ) + find_package ( CUDAToolkit ) message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} ) message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} ) message ( STATUS "CUDA toolkit include: " ${CUDAToolkit_INCLUDE_DIRS} ) @@ -262,22 +262,22 @@ if ( ENABLE_CUDA ) if ( CUDAToolkit_VERSION VERSION_LESS "11.2" ) # CUDA is present but too old message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" ) - set ( SUITESPARSE_CUDA off ) + set ( SUITESPARSE_CUDA OFF ) else ( ) # CUDA 11.2 or later present enable_language ( CUDA ) - set ( SUITESPARSE_CUDA on ) + set ( SUITESPARSE_CUDA ON ) endif ( ) else ( ) # without CUDA: message ( STATUS "CUDA: not found" ) - set ( SUITESPARSE_CUDA off ) + set ( SUITESPARSE_CUDA OFF ) endif ( ) else ( ) # CUDA is disabled - set ( SUITESPARSE_CUDA off ) + set ( SUITESPARSE_CUDA OFF ) endif ( ) diff --git a/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake b/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake index a9d2c4c8d..0a294b27d 100644 --- a/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake +++ b/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake @@ -255,7 +255,7 @@ if ( ENABLE_CUDA ) # with CUDA: message ( STATUS "Find CUDA tool kit:" ) # FindCUDAToolKit needs to have C or CXX enabled first (see above) - include ( FindCUDAToolkit ) + find_package ( CUDAToolkit ) message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} ) message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} ) message ( STATUS "CUDA toolkit include: " ${CUDAToolkit_INCLUDE_DIRS} ) @@ -263,22 +263,22 @@ if ( ENABLE_CUDA ) if ( CUDAToolkit_VERSION VERSION_LESS "11.2" ) # CUDA is present but too old message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" ) - set ( SUITESPARSE_CUDA off ) + set ( SUITESPARSE_CUDA OFF ) else ( ) # CUDA 11.2 or later present enable_language ( CUDA ) - set ( SUITESPARSE_CUDA on ) + set ( SUITESPARSE_CUDA ON ) endif ( ) else ( ) # without CUDA: message ( STATUS "CUDA: not found" ) - set ( SUITESPARSE_CUDA off ) + set ( SUITESPARSE_CUDA OFF ) endif ( ) else ( ) # CUDA is disabled - set ( SUITESPARSE_CUDA off ) + set ( SUITESPARSE_CUDA OFF ) endif ( ) From 9e81579346bf9dabce86233eb756628189edf118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Wed, 29 Nov 2023 20:11:06 +0100 Subject: [PATCH 6/6] SPQR: Add dependencies for CUDA libraries Needed for `SuiteSparse_free`, `SuiteSparse_malloc` and others. --- SPQR/GPUQREngine/CMakeLists.txt | 19 +++++++++++++------ SPQR/GPURuntime/CMakeLists.txt | 14 ++++++++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/SPQR/GPUQREngine/CMakeLists.txt b/SPQR/GPUQREngine/CMakeLists.txt index 87d5850e1..d00d5eee2 100644 --- a/SPQR/GPUQREngine/CMakeLists.txt +++ b/SPQR/GPUQREngine/CMakeLists.txt @@ -90,9 +90,10 @@ if ( BUILD_SHARED_LIBS ) WINDOWS_EXPORT_ALL_SYMBOLS ON ) target_include_directories ( GPUQREngine PRIVATE - ${GPUQRENGINE_INCLUDES} - "$" - "$" ) + ${GPUQRENGINE_INCLUDES} ) + + target_link_libraries ( GPUQREngine PRIVATE + GPURuntime SuiteSparse::SuiteSparseConfig ) set_target_properties ( GPUQREngine PROPERTIES POSITION_INDEPENDENT_CODE ON @@ -128,9 +129,15 @@ if ( BUILD_STATIC_LIBS ) target_include_directories ( GPUQREngine_static PRIVATE ${CUDAToolkit_INCLUDE_DIRS} - ${GPUQRENGINE_INCLUDES} - $ - $ ) + ${GPUQRENGINE_INCLUDES} ) + + target_link_libraries ( GPUQREngine_static PUBLIC GPURuntime_static ) + + if ( TARGET SuiteSparse::SuiteSparseConfig_static ) + target_link_libraries ( GPUQREngine_static PUBLIC SuiteSparse::SuiteSparseConfig_static ) + else ( ) + target_link_libraries ( GPUQREngine_static PUBLIC SuiteSparse::SuiteSparseConfig ) + endif ( ) set_target_properties ( GPUQREngine_static PROPERTIES POSITION_INDEPENDENT_CODE ON diff --git a/SPQR/GPURuntime/CMakeLists.txt b/SPQR/GPURuntime/CMakeLists.txt index dfe936cf1..8fc4c15c0 100644 --- a/SPQR/GPURuntime/CMakeLists.txt +++ b/SPQR/GPURuntime/CMakeLists.txt @@ -70,8 +70,9 @@ if ( BUILD_SHARED_LIBS ) target_include_directories ( GPURuntime PRIVATE ${CUDAToolkit_INCLUDE_DIRS} - ${SUITESPARSE_GPURUNTIME_INCLUDES} - $ ) + ${SUITESPARSE_GPURUNTIME_INCLUDES} ) + + target_link_libraries ( GPURuntime PRIVATE SuiteSparse::SuiteSparseConfig ) set_target_properties ( GPURuntime PROPERTIES POSITION_INDEPENDENT_CODE ON @@ -106,8 +107,13 @@ if ( BUILD_STATIC_LIBS ) target_include_directories ( GPURuntime_static PRIVATE ${CUDAToolkit_INCLUDE_DIRS} - ${SUITESPARSE_GPURUNTIME_INCLUDES} - $ ) + ${SUITESPARSE_GPURUNTIME_INCLUDES} ) + + if ( TARGET SuiteSparse::SuiteSparseConfig_static ) + target_link_libraries ( GPURuntime_static PUBLIC SuiteSparse::SuiteSparseConfig_static ) + else ( ) + target_link_libraries ( GPURuntime_static PUBLIC SuiteSparse::SuiteSparseConfig ) + endif ( ) set_target_properties ( GPURuntime_static PROPERTIES POSITION_INDEPENDENT_CODE ON