Skip to content

Commit

Permalink
sync with SuiteSparse v7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Sep 14, 2023
1 parent 8e67037 commit 3c8a19e
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 14 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ endif ( )

if ( SUITESPARSE_CUDA )
# with CUDA and RMM
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSUITESPARSE_CUDA" )
add_subdirectory ( CUDA )
set ( GB_CUDA GraphBLAS_CUDA ${CUDA_LIBRARIES} )
set ( GB_RMM rmm_wrap ${CUDA_LIBRARIES} )
Expand Down Expand Up @@ -263,9 +262,9 @@ if ( NOT NSTATIC )
add_library ( GraphBLAS_static STATIC ${GRAPHBLAS_SOURCES} )

set_target_properties ( GraphBLAS_static PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
OUTPUT_NAME graphblas
SOVERSION ${GraphBLAS_VERSION_MAJOR}
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
OUTPUT_NAME graphblas
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD 11
C_STANDARD_REQUIRED ON )

Expand All @@ -280,6 +279,7 @@ if ( NOT NSTATIC )

if ( SUITESPARSE_CUDA )
add_dependencies ( GraphBLAS_static GraphBLAS_CUDA )
set ( GRAPHBLAS_STATIC_MODULES "${GRAPHBLAS_STATIC_MODULES} GraphBLAS_CUDA" )
# add_dependencies ( GraphBLAS_static rmm_wrap )
endif ( )
endif ( )
Expand Down
32 changes: 32 additions & 0 deletions CUDA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ add_library ( GraphBLAS_CUDA SHARED ${GRAPHBLAS_CUDA_SOURCES} )

set_target_properties ( GraphBLAS_CUDA PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
OUTPUT_NAME graphblascuda
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD 11
C_STANDARD_REQUIRED ON )
Expand Down Expand Up @@ -72,6 +73,8 @@ 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_compile_definitions ( GraphBLAS_CUDA PUBLIC "SUITESPARSE_CUDA" )

target_include_directories ( GraphBLAS_CUDA
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${SUITESPARSE_INCLUDEDIR}> )
Expand Down Expand Up @@ -113,6 +116,35 @@ install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/GraphBLAS_CUDAConfigVersion.cmake
DESTINATION ${SUITESPARSE_LIBDIR}/cmake/GraphBLAS )

#-------------------------------------------------------------------------------
# create pkg-config file
#-------------------------------------------------------------------------------

if ( NOT MSVC )
set ( prefix "${CMAKE_INSTALL_PREFIX}" )
set ( exec_prefix "\${prefix}" )
cmake_path ( IS_ABSOLUTE SUITESPARSE_LIBDIR SUITESPARSE_LIBDIR_IS_ABSOLUTE )
if (SUITESPARSE_LIBDIR_IS_ABSOLUTE)
set ( libdir "${SUITESPARSE_LIBDIR}")
else ( )
set ( libdir "\${exec_prefix}/${SUITESPARSE_LIBDIR}")
endif ( )
cmake_path ( IS_ABSOLUTE SUITESPARSE_INCLUDEDIR SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE )
if (SUITESPARSE_INCLUDEDIR_IS_ABSOLUTE)
set ( includedir "${SUITESPARSE_INCLUDEDIR}")
else ( )
set ( includedir "\${prefix}/${SUITESPARSE_INCLUDEDIR}")
endif ( )
configure_file (
Config/GraphBLAS_CUDA.pc.in
GraphBLAS_CUDA.pc
@ONLY
NEWLINE_STYLE LF )
install ( FILES
${CMAKE_CURRENT_BINARY_DIR}/GraphBLAS_CUDA.pc
DESTINATION ${SUITESPARSE_LIBDIR}/pkgconfig )
endif ( )

#-------------------------------------------------------------------------------
# test suite for the CUDA kernels
#-------------------------------------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions CUDA/Config/GraphBLAS_CUDA.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# GraphBLAS_CUDA, Copyright (c) 2017-2023, Timothy A. Davis.
# All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

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

Name: GraphBLAS_CUDA
URL: https://github.com/DrTimothyAldenDavis/SuiteSparse
Description: CUDA support library for GraphBLAS in SuiteSparse
Version: @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@
Libs: -L${libdir} -lgraphblascuda
Cflags: -I${includedir} -DSUITESPARSE_CUDA
17 changes: 16 additions & 1 deletion CUDA/Config/GraphBLAS_CUDAConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,24 @@ set ( GRAPHBLAS_CUDA_VERSION_MINOR @GraphBLAS_VERSION_MINOR@ )
set ( GRAPHBLAS_CUDA_VERSION_PATCH @GraphBLAS_VERSION_SUB@ )
set ( GRAPHBLAS_CUDA_VERSION "@GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@" )

# Check for dependent targets
include ( CMakeFindDependencyMacro )
set ( _dependencies_found ON )

# Look for NVIDIA CUDA toolkit
find_package ( CUDAToolkit @CUDAToolkit_VERSION_MAJOR@ REQUIRED )
if ( NOT CUDAToolkit_FOUND )
find_dependency ( CUDAToolkit @CUDAToolkit_VERSION_MAJOR@ )
if ( NOT CUDAToolkit_FOUND )
set ( _dependencies_found OFF )
endif ( )
endif ( )

if ( NOT _dependencies_found )
set ( GraphBLAS_CUDA_FOUND OFF )
return ( )
endif ( )

# Import target
include ( ${CMAKE_CURRENT_LIST_DIR}/GraphBLAS_CUDATargets.cmake )

# The following is only for backward compatibility with FindGraphBLAS_CUDA.
Expand Down
1 change: 1 addition & 0 deletions Config/GraphBLAS.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Name: GraphBLAS
URL: https://github.com/DrTimothyAldenDavis/SuiteSparse
Description: Complete implementation of the GraphBLAS standard in SuiteSparse
Version: @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@
Requires.private: @GRAPHBLAS_STATIC_MODULES@
Libs: -L${libdir} -lgraphblas
Libs.private: @GRAPHBLAS_STATIC_LIBS@
Cflags: -I${includedir}
33 changes: 24 additions & 9 deletions Config/GraphBLASConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,37 @@ set ( GRAPHBLAS_VERSION_MINOR @GraphBLAS_VERSION_MINOR@ )
set ( GRAPHBLAS_VERSION_PATCH @GraphBLAS_VERSION_SUB@ )
set ( GRAPHBLAS_VERSION "@GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@" )

# Check for dependent targets
include ( CMakeFindDependencyMacro )
set ( _dependencies_found ON )

if ( @SUITESPARSE_CUDA@ )
# Look for imported targets of additional dependency if GraphBLAS was built with CUDA

if ( @SUITESPARSE_IN_BUILD_TREE@ )
# First check in a common build tree
find_package ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@
PATHS ${CMAKE_SOURCE_DIR}/../GraphBLAS/build/CUDA NO_DEFAULT_PATH )
# Then, check in the currently active CMAKE_MODULE_PATH
if ( NOT TARGET SuiteSparse::GraphBLAS_CUDA )
find_package ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@ REQUIRED )
if ( NOT GraphBLAS_CUDA_FOUND )
if ( @SUITESPARSE_IN_BUILD_TREE@ )
# First check in a common build tree
find_dependency ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@
PATHS ${CMAKE_SOURCE_DIR}/../GraphBLAS/build/CUDA NO_DEFAULT_PATH )
# Then, check in the currently active CMAKE_MODULE_PATH
if ( NOT GraphBLAS_CUDA_FOUND )
find_dependency ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@ )
endif ( )
else ( )
find_dependency ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@ )
endif ( )
else ( )
find_package ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@ REQUIRED )
endif ( )
if ( NOT GraphBLAS_CUDA_FOUND )
set ( _dependencies_found OFF )
endif ( )
endif ( )

if ( NOT _dependencies_found )
set ( GraphBLAS_FOUND OFF )
return ( )
endif ( )

# Import target
include ( ${CMAKE_CURRENT_LIST_DIR}/GraphBLASTargets.cmake )

# The following is only for backward compatibility with FindGraphBLAS.
Expand Down

0 comments on commit 3c8a19e

Please sign in to comment.