Skip to content

Commit

Permalink
CHOLMOD: Add definition of SUITESPARSE_CUDA to CMake target and .pc file
Browse files Browse the repository at this point in the history
Same for CHOLMOD_CUDA.
  • Loading branch information
mmuetzel committed Sep 12, 2023
1 parent 5f80bb7 commit 999af9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,12 @@ endif ( )
# CHOLMOD_CUDA
if ( SUITESPARSE_CUDA )
target_link_libraries ( CHOLMOD PRIVATE CHOLMOD_CUDA ${CUDA_LIBRARIES} )
set ( CHOLMOD_STATIC_MODULES " ${CHOLMOD_STATIC_MODULES} CHOLMOD_CUDA" )
set ( CHOLMOD_STATIC_MODULES "${CHOLMOD_STATIC_MODULES} CHOLMOD_CUDA" )
set ( CHOLMOD_CFLAGS "${CHOLMOD_CFLAGS} -DSUITESPARSE_CUDA" )
target_compile_definitions ( CHOLMOD PUBLIC "SUITESPARSE_CUDA" )
if ( NOT NSTATIC )
target_link_libraries ( CHOLMOD_static PUBLIC CHOLMOD_CUDA_static ${CUDA_LIBRARIES} )
target_compile_definitions ( CHOLMOD_static PUBLIC "SUITESPARSE_CUDA" )
endif ( )
target_link_libraries ( CHOLMOD PRIVATE CUDA::nvrtc CUDA::cudart_static
CUDA::nvToolsExt CUDA::cublas )
Expand Down
4 changes: 3 additions & 1 deletion CHOLMOD/Config/CHOLMOD.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

# FIXME: Which flags do we need to statically link CUDA if needed?

Name: CHOLMOD
URL: https://github.com/DrTimothyAldenDavis/SuiteSparse
Description: Routines for factorizing sparse symmetric positive definite matrices in SuiteSparse
Version: @CHOLMOD_VERSION_MAJOR@.@CHOLMOD_VERSION_MINOR@.@CHOLMOD_VERSION_SUB@
Requires.private: SuiteSparse_config AMD COLAMD @CHOLMOD_STATIC_MODULES@
Libs: -L${libdir} -lcholmod
Libs.private: @CHOLMOD_STATIC_LIBS@
Cflags: -I${includedir}
Cflags: -I${includedir} @CHOLMOD_CFLAGS@
2 changes: 1 addition & 1 deletion CHOLMOD/Config/CHOLMOD_CUDA.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ URL: https://github.com/DrTimothyAldenDavis/SuiteSparse
Description: CHOLMOD/GPU module in SuiteSparse
Version: @CHOLMOD_VERSION_MAJOR@.@CHOLMOD_VERSION_MINOR@.@CHOLMOD_VERSION_SUB@
Libs: -L${libdir} -lcholmod_cuda
Cflags: -I${includedir}
Cflags: -I${includedir} -DSUITESPARSE_CUDA
8 changes: 5 additions & 3 deletions CHOLMOD/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ target_include_directories ( CHOLMOD_CUDA PRIVATE
${CHOLMOD_CUDA_INCLUDES} )
set_target_properties ( CHOLMOD_CUDA PROPERTIES POSITION_INDEPENDENT_CODE ON )
set_target_properties ( CHOLMOD_CUDA PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
target_compile_definitions ( CHOLMOD_CUDA PUBLIC "SUITESPARSE_CUDA" )

if ( NOT NSTATIC )
target_include_directories ( CHOLMOD_CUDA_static PRIVATE
target_include_directories ( CHOLMOD_CUDA_static PRIVATE
${CUDAToolkit_INCLUDE_DIRS}
${CHOLMOD_CUDA_INCLUDES} )
set_target_properties ( CHOLMOD_CUDA_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
set_target_properties ( CHOLMOD_CUDA_static PROPERTIES POSITION_INDEPENDENT_CODE on )
set_target_properties ( CHOLMOD_CUDA_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
set_target_properties ( CHOLMOD_CUDA_static PROPERTIES POSITION_INDEPENDENT_CODE on )
target_compile_definitions ( CHOLMOD_CUDA_static PUBLIC "SUITESPARSE_CUDA" )
endif ( )

target_link_libraries ( CHOLMOD_CUDA PRIVATE CUDA::nvrtc CUDA::cudart_static
Expand Down

0 comments on commit 999af9f

Please sign in to comment.