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

Set preprocessor macro SUITESPARSE_CUDA on a per-target level #419

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion GraphBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# GraphBLAS/CMakeLists.txt: cmake script for GraphBLAS
#-------------------------------------------------------------------------------

# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# See the User Guide for details on how to compile SuiteSparse:GraphBLAS.
Expand Down Expand Up @@ -246,6 +246,7 @@ target_include_directories ( GraphBLAS
if ( SUITESPARSE_CUDA )
add_dependencies ( GraphBLAS GraphBLAS_CUDA )
# add_dependencies ( GraphBLAS rmm_wrap )
target_compile_definitions ( GraphBLAS PRIVATE "SUITESPARSE_CUDA" )
endif ( )

if ( WIN32 )
Expand Down Expand Up @@ -281,6 +282,7 @@ if ( NOT NSTATIC )
add_dependencies ( GraphBLAS_static GraphBLAS_CUDA )
set ( GRAPHBLAS_STATIC_MODULES "${GRAPHBLAS_STATIC_MODULES} GraphBLAS_CUDA" )
# add_dependencies ( GraphBLAS_static rmm_wrap )
target_compile_definitions ( GraphBLAS_static PRIVATE "SUITESPARSE_CUDA" )
endif ( )
endif ( )

Expand Down
1 change: 0 additions & 1 deletion GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ endif ( )

if ( SUITESPARSE_CUDA )
message ( STATUS "CUDA: enabled" )
add_compile_definitions ( SUITESPARSE_CUDA )
set ( SUITESPARSE_CUDA_ARCHITECTURES "52;75;80" CACHE STRING "CUDA architectures" )
set ( CMAKE_CUDA_ARCHITECTURES ${SUITESPARSE_CUDA_ARCHITECTURES} )
else ( )
Expand Down
16 changes: 8 additions & 8 deletions SPQR/GPUQREngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ set_target_properties ( GPUQREngine PROPERTIES POSITION_INDEPENDENT_CODE ON )
set_target_properties ( GPUQREngine PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
target_link_libraries ( GPUQREngine PRIVATE
CUDA::nvrtc CUDA::cudart_static CUDA::nvToolsExt CUDA::cublas )
target_compile_definitions ( GPUQREngine PRIVATE "SUITESPARSE_CUDA" )

target_include_directories ( GPUQREngine
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>
Expand Down Expand Up @@ -140,15 +141,14 @@ if ( NOT NSTATIC )
${GPUQRENGINE_INCLUDES}
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>" )

if ( SUITESPARSE_CUDA )
target_include_directories ( GPUQREngine_static PRIVATE
"$<TARGET_PROPERTY:GPURuntime,INTERFACE_INCLUDE_DIRECTORIES>" )
target_include_directories ( GPUQREngine_static PRIVATE
"$<TARGET_PROPERTY:GPURuntime,INTERFACE_INCLUDE_DIRECTORIES>" )

set_target_properties ( GPUQREngine_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
set_target_properties ( GPUQREngine_static PROPERTIES POSITION_INDEPENDENT_CODE on )
target_link_libraries ( GPUQREngine_static PUBLIC
CUDA::nvrtc CUDA::cudart_static CUDA::nvToolsExt CUDA::cublas )
endif ( )
set_target_properties ( GPUQREngine_static PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
set_target_properties ( GPUQREngine_static PROPERTIES POSITION_INDEPENDENT_CODE ON )
target_link_libraries ( GPUQREngine_static PUBLIC
CUDA::nvrtc CUDA::cudart_static CUDA::nvToolsExt CUDA::cublas )
target_compile_definitions ( GPUQREngine_static PRIVATE "SUITESPARSE_CUDA" )

target_include_directories ( GPUQREngine_static
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>
Expand Down
9 changes: 5 additions & 4 deletions SPQR/GPURuntime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ configure_file ( "Config/SuiteSparse_GPURuntime.hpp.in"

#-------------------------------------------------------------------------------

set ( CMAKE_CUDA_FLAGS "-cudart=static -lineinfo -DSUITESPARSE_CUDA" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSUITESPARSE_CUDA" )
set ( CMAKE_CUDA_FLAGS "-cudart=static -lineinfo" )
message ( STATUS "C++ flags for CUDA: ${CMAKE_CXX_FLAGS}" )
message ( STATUS "nvcc flags for CUDA: ${CMAKE_CUDA_FLAGS}" )

Expand Down Expand Up @@ -100,6 +99,7 @@ set_target_properties ( GPURuntime PROPERTIES POSITION_INDEPENDENT_CODE ON )
set_target_properties ( GPURuntime PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
target_link_libraries ( GPURuntime PRIVATE
CUDA::nvrtc CUDA::cudart_static CUDA::nvToolsExt CUDA::cublas )
target_compile_definitions ( GPURuntime PRIVATE "SUITESPARSE_CUDA" )

target_include_directories ( GPURuntime
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>
Expand Down Expand Up @@ -129,10 +129,11 @@ if ( NOT NSTATIC )
${SUITESPARSE_GPURUNTIME_INCLUDES}
$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES> )

set_target_properties ( GPURuntime_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
set_target_properties ( GPURuntime_static PROPERTIES POSITION_INDEPENDENT_CODE on )
set_target_properties ( GPURuntime_static PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
set_target_properties ( GPURuntime_static PROPERTIES POSITION_INDEPENDENT_CODE ON )
target_link_libraries ( GPURuntime_static PUBLIC
CUDA::nvrtc CUDA::cudart_static CUDA::nvToolsExt CUDA::cublas )
target_compile_definitions ( GPURuntime_static PRIVATE "SUITESPARSE_CUDA" )

target_include_directories ( GPURuntime_static
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>
Expand Down
1 change: 0 additions & 1 deletion SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ endif ( )

if ( SUITESPARSE_CUDA )
message ( STATUS "CUDA: enabled" )
add_compile_definitions ( SUITESPARSE_CUDA )
set ( SUITESPARSE_CUDA_ARCHITECTURES "52;75;80" CACHE STRING "CUDA architectures" )
set ( CMAKE_CUDA_ARCHITECTURES ${SUITESPARSE_CUDA_ARCHITECTURES} )
else ( )
Expand Down
Loading