Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Dec 5, 2023
1 parent 72c9c39 commit 01f7a58
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 50 deletions.
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ if ( COVERAGE )
message ( STATUS "OpenMP disabled for test coverage" )
else ( )
if ( NOPENMP )
set ( OPENMP_C_FOUND OFF )
set ( OpenMP_C_FOUND OFF )
else ( )
find_package ( OpenMP )
if ( OPENMP_C_FOUND AND BUILD_STATIC_LIBS )
if ( OpenMP_C_FOUND AND BUILD_STATIC_LIBS )
list ( APPEND LAGRAPH_STATIC_LIBS ${OpenMP_C_LIBRARIES} )
endif ( )
find_package ( Threads )
Expand Down Expand Up @@ -201,10 +201,6 @@ include_directories ( ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src/utility
${PROJECT_SOURCE_DIR}/test/include )

if ( NOT SUITESPARSE_ROOT_CMAKELISTS )
include_directories ( ${GRAPHBLAS_INCLUDE_DIR} )
endif ( )

# tell LAGraph where to find its own source (for LAGraph/data files)
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLGDIR=${PROJECT_SOURCE_DIR}" )
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O" )
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ library:

# install only in SuiteSparse/lib and SuiteSparse/include
local:
( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=1 .. && cmake --build . --config Release -j${JOBS} )
( cd build && cmake $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DLOCAL_INSTALL=1 .. && cmake --build . --config Release -j${JOBS} )

vanilla:
( cd build && cmake $(CMAKE_OPTIONS) -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} )
( cd build && cmake $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} )

# compile with -g for debugging
debug:
Expand Down
65 changes: 42 additions & 23 deletions cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,25 @@
# explicitly, if the defaults are not appropriate for your
# system.
# Default: false
#
# SUITESPARSE_PKGFILEDIR: where to install the CMake Config and pkg-config
# files. This defaults to the same directory as where
# the compiled libraries are installed, in a subfolder
# called cmake. If not already set in the cache,
# LOCAL_INSTALL=0 defines this as "lib", and the
# CMAKE_INSTALL_PREFIX is added. LOCAL_INSTALL=1 defines
# this as SuiteSparse/lib. This variable is cached so
# that if it is not set, or unset first, it remains
# unchanged (see "make local" and "make global" in the
# SuiteSparse_config/Makefile for an example).
#
# SUITESPARSE_INCLUDEDIR_POSTFIX : # Postfix for installation target of
# header from SuiteSparse. Default: suitesparse, so the
# default include directory is:
# CMAKE_INSTALL_PREFIX/include/suitesparse

message ( STATUS "Source: ${CMAKE_SOURCE_DIR} ")
message ( STATUS "Build: ${CMAKE_BINARY_DIR} ")
message ( STATUS "Source: ${CMAKE_SOURCE_DIR} ")
message ( STATUS "Build: ${CMAKE_BINARY_DIR} ")

cmake_policy ( SET CMP0042 NEW ) # enable MACOSX_RPATH by default
cmake_policy ( SET CMP0048 NEW ) # VERSION variable policy
Expand Down Expand Up @@ -166,6 +182,9 @@ if ( NOT SUITESPARSE_ROOT_CMAKELISTS )
endif ( )
endif ( )

set ( SUITESPARSE_INCLUDEDIR_POSTFIX "suitesparse" CACHE STRING
"Postfix for installation target of header from SuiteSparse (default: \"suitesparse\")" )

if ( LOCAL_INSTALL )
if ( INSIDE_SUITESPARSE )
# ../lib and ../include exist: the package is inside SuiteSparse.
Expand All @@ -179,11 +198,11 @@ if ( LOCAL_INSTALL )
endif ( )
endif ( )
set ( SUITESPARSE_LIBDIR ${SUITESPARSE_LOCAL_PREFIX}/lib )
set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include )
set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${SUITESPARSE_LOCAL_PREFIX}/bin )
else ( )
set ( SUITESPARSE_LIBDIR ${CMAKE_INSTALL_LIBDIR} )
set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR} )
set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${CMAKE_INSTALL_BINDIR} )
endif ( )

Expand All @@ -207,7 +226,7 @@ if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE Release )
endif ( )

message ( STATUS "Build type: ${CMAKE_BUILD_TYPE} ")
message ( STATUS "Build type: ${CMAKE_BUILD_TYPE} ")

set ( CMAKE_INCLUDE_CURRENT_DIR ON )

Expand All @@ -218,16 +237,16 @@ set ( CMAKE_INCLUDE_CURRENT_DIR ON )
include ( CheckLanguage )
option ( NFORTRAN "ON: do not try to use Fortran. OFF (default): try Fortran" off )
if ( NFORTRAN )
message ( STATUS "Fortran: not enabled" )
message ( STATUS "Fortran: not enabled" )
else ( )
check_language ( Fortran )
if ( CMAKE_Fortran_COMPILER )
enable_language ( Fortran )
message ( STATUS "Fortran: ${CMAKE_Fortran_COMPILER}" )
message ( STATUS "Fortran: ${CMAKE_Fortran_COMPILER}" )
else ( )
# Fortran not available:
set ( NFORTRAN true )
message ( STATUS "Fortran: not available" )
message ( STATUS "Fortran: not available" )
endif ( )
endif ( )

Expand All @@ -250,43 +269,43 @@ if ( ENABLE_CUDA )

# try finding CUDA
check_language ( CUDA )
message ( STATUS "Looking for CUDA" )
# message ( STATUS "Looking for CUDA" )
if ( CMAKE_CUDA_COMPILER )
# with CUDA:
message ( STATUS "Find CUDA tool kit:" )
# message ( STATUS "Find CUDA tool kit:" )
# FindCUDAToolKit needs to have C or CXX enabled first (see above)
include ( FindCUDAToolkit )
message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} )
message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} )
message ( STATUS "CUDA toolkit include: " ${CUDAToolkit_INCLUDE_DIRS} )
message ( STATUS "CUDA toolkit lib dir: " ${CUDAToolkit_LIBRARY_DIR} )
find_package ( CUDAToolkit )
message ( STATUS "CUDA toolkit : " ${CUDAToolkit_FOUND} )
message ( STATUS "CUDA toolkit ver: " ${CUDAToolkit_VERSION} )
message ( STATUS "CUDA toolkit inc: " ${CUDAToolkit_INCLUDE_DIRS} )
message ( STATUS "CUDA toolkit lib: " ${CUDAToolkit_LIBRARY_DIR} )
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 )
message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" )
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 )
message ( STATUS "CUDA: not found" )
set ( SUITESPARSE_CUDA OFF )
endif ( )

else ( )

# CUDA is disabled
set ( SUITESPARSE_CUDA off )
set ( SUITESPARSE_CUDA OFF )

endif ( )

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

4 changes: 2 additions & 2 deletions config/LAGraph.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// LAGraph.h: user-visible include file for LAGraph
//------------------------------------------------------------------------------

// LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved.
// LAGraph, (c) 2019-2023 by The LAGraph Contributors, All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
//
// For additional details (including references to third party source code and
Expand Down Expand Up @@ -99,7 +99,7 @@
#if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS )
// use SuiteSparse, and its GxB* extensions
#if GxB_IMPLEMENTATION < GxB_VERSION (7,1,0)
#error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later s required"
#error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later is required"
#endif
#define LAGRAPH_SUITESPARSE 1
#else
Expand Down
17 changes: 13 additions & 4 deletions experimental/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ if ( BUILD_SHARED_LIBS )
C_STANDARD 11
PUBLIC_HEADER "include/LAGraphX.h"
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls )

if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" )
set_target_properties ( LAGraphX PROPERTIES EXPORT_NO_SYSTEM ON )
endif ( )

target_link_libraries ( LAGraphX PRIVATE LAGraph GraphBLAS::GraphBLAS )

target_include_directories ( LAGraphX PUBLIC
Expand Down Expand Up @@ -61,10 +66,14 @@ if ( BUILD_STATIC_LIBS )
OUTPUT_NAME lagraphx_static )
endif ( )

if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" )
set_target_properties ( LAGraphX_static PROPERTIES EXPORT_NO_SYSTEM ON )
endif ( )

if ( TARGET GraphBLAS::GraphBLAS_static )
target_link_libraries ( LAGraphX_static PUBLIC GraphBLAS::GraphBLAS_static )
target_link_libraries ( LAGraphX_static PRIVATE GraphBLAS::GraphBLAS_static )
else ( )
target_link_libraries ( LAGraphX_static PUBLIC GraphBLAS::GraphBLAS )
target_link_libraries ( LAGraphX_static PRIVATE GraphBLAS::GraphBLAS )
endif ( )

target_include_directories ( LAGraphX_static PUBLIC
Expand All @@ -76,12 +85,12 @@ endif ( )
# add OpenMP
#-------------------------------------------------------------------------------

if ( OPENMP_C_FOUND )
if ( OpenMP_C_FOUND )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( LAGraphX PRIVATE OpenMP::OpenMP_C )
endif ( )
if ( BUILD_STATIC_LIBS )
target_link_libraries ( LAGraphX_static PUBLIC OpenMP::OpenMP_C )
target_link_libraries ( LAGraphX_static PRIVATE OpenMP::OpenMP_C )
endif ( )
endif ( )

Expand Down
4 changes: 2 additions & 2 deletions experimental/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if ( BUILD_STATIC_LIBS )
OUTPUT_NAME lagraphxtest_static )
endif ( )

target_link_libraries ( lagraphxtest_static PUBLIC LAGraph_static lagraphtest_static GraphBLAS::GraphBLAS )
target_link_libraries ( lagraphxtest_static PRIVATE LAGraph_static lagraphtest_static GraphBLAS::GraphBLAS )
endif ( )

#-------------------------------------------------------------------------------
Expand All @@ -79,7 +79,7 @@ if ( OPENMP_C_FOUND )
target_link_libraries ( lagraphxtest PRIVATE OpenMP::OpenMP_C )
endif ( )
if ( BUILD_STATIC_LIBS )
target_link_libraries ( lagraphxtest_static PUBLIC OpenMP::OpenMP_C )
target_link_libraries ( lagraphxtest_static PRIVATE OpenMP::OpenMP_C )
endif ( )
endif ( )

Expand Down
4 changes: 2 additions & 2 deletions include/LAGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// LAGraph.h: user-visible include file for LAGraph
//------------------------------------------------------------------------------

// LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved.
// LAGraph, (c) 2019-2023 by The LAGraph Contributors, All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
//
// For additional details (including references to third party source code and
Expand Down Expand Up @@ -99,7 +99,7 @@
#if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS )
// use SuiteSparse, and its GxB* extensions
#if GxB_IMPLEMENTATION < GxB_VERSION (7,1,0)
#error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later s required"
#error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later is required"
#endif
#define LAGRAPH_SUITESPARSE 1
#else
Expand Down
15 changes: 12 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ endif ( )

if ( BUILD_SHARED_LIBS )
add_library ( LAGraph SHARED ${LAGRAPH_LIB_SOURCES} )
SET_TARGET_PROPERTIES ( LAGraph PROPERTIES
set_target_properties ( LAGraph PROPERTIES
VERSION ${LAGraph_VERSION_MAJOR}.${LAGraph_VERSION_MINOR}.${LAGraph_VERSION_SUB}
SOVERSION ${LAGraph_VERSION_MAJOR}
OUTPUT_NAME lagraph
C_STANDARD_REQUIRED ON
C_STANDARD 11
PUBLIC_HEADER "include/LAGraph.h"
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls )

if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" )
set_target_properties ( LAGraph PROPERTIES EXPORT_NO_SYSTEM ON )
endif ( )

target_link_libraries ( LAGraph PRIVATE GraphBLAS::GraphBLAS ${M_LIB} )

target_include_directories ( LAGraph PUBLIC
Expand Down Expand Up @@ -66,6 +71,10 @@ if ( BUILD_STATIC_LIBS )
OUTPUT_NAME lagraph_static )
endif ( )

if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" )
set_target_properties ( LAGraph_static PROPERTIES EXPORT_NO_SYSTEM ON )
endif ( )

if ( TARGET GraphBLAS::GraphBLAS_static )
target_link_libraries ( LAGraph_static PUBLIC GraphBLAS::GraphBLAS_static )
else ( )
Expand All @@ -82,12 +91,12 @@ endif ( )
# add OpenMP
#-------------------------------------------------------------------------------

if ( OPENMP_C_FOUND )
if ( OpenMP_C_FOUND )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( LAGraph PRIVATE OpenMP::OpenMP_C )
endif ( )
if ( BUILD_STATIC_LIBS )
target_link_libraries ( LAGraph_static PUBLIC OpenMP::OpenMP_C )
target_link_libraries ( LAGraph_static PRIVATE OpenMP::OpenMP_C )
endif ( )
endif ( )

Expand Down
4 changes: 2 additions & 2 deletions src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if ( BUILD_STATIC_LIBS )
OUTPUT_NAME lagraphtest_static )
endif ( )

target_link_libraries ( lagraphtest_static PUBLIC LAGraph_static GraphBLAS::GraphBLAS )
target_link_libraries ( lagraphtest_static PRIVATE LAGraph_static GraphBLAS::GraphBLAS )
endif ( )

#-------------------------------------------------------------------------------
Expand All @@ -81,7 +81,7 @@ if ( OPENMP_C_FOUND )
target_link_libraries ( lagraphtest PRIVATE OpenMP::OpenMP_C )
endif ( )
if ( BUILD_STATIC_LIBS )
target_link_libraries ( lagraphtest_static PUBLIC OpenMP::OpenMP_C )
target_link_libraries ( lagraphtest_static PRIVATE OpenMP::OpenMP_C )
endif ( )
endif ( )

Expand Down
8 changes: 4 additions & 4 deletions src/test/LG_check_sssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,25 @@ int LG_check_sssp
{
etypecode = 0 ;
etypesize = sizeof (int32_t) ;
etypeinf = INT32_MAX ;
etypeinf = (double) INT32_MAX ;
}
else if (etype == GrB_INT64)
{
etypecode = 1 ;
etypesize = sizeof (int64_t) ;
etypeinf = INT64_MAX ;
etypeinf = (double) INT64_MAX ;
}
else if (etype == GrB_UINT32)
{
etypecode = 2 ;
etypesize = sizeof (uint32_t) ;
etypeinf = UINT32_MAX ;
etypeinf = (double) UINT32_MAX ;
}
else if (etype == GrB_UINT64)
{
etypecode = 3 ;
etypesize = sizeof (uint64_t) ;
etypeinf = UINT64_MAX ;
etypeinf = (double) UINT64_MAX ;
}
else if (etype == GrB_FP32)
{
Expand Down

0 comments on commit 01f7a58

Please sign in to comment.