From 5a4c3aebf0b53eb4b86f890d7e49b0c85f77cdcc Mon Sep 17 00:00:00 2001 From: Tim Davis Date: Mon, 20 Jul 2026 15:26:02 -0500 Subject: [PATCH 1/3] v1.2.2: fix for MSVC which has no stdalign.h --- CMakeLists.txt | 17 ++++++++++++++--- Config/LAGraph.h.in | 13 +++++++------ experimental/algorithm/LAGraph_cdlp.c | 11 +++++++++-- include/LAGraph.h | 17 +++++++++-------- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1aad95a819..91beb26b75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,13 +36,13 @@ # get the version #------------------------------------------------------------------------------- -cmake_minimum_required ( VERSION 3.20 ) # LAGraph can be built stand-alone +cmake_minimum_required ( VERSION 3.23 ) # version of LAGraph -set ( LAGraph_DATE "Sept 8, 2025" ) +set ( LAGraph_DATE "July 21, 2026" ) set ( LAGraph_VERSION_MAJOR 1 CACHE STRING "" FORCE ) set ( LAGraph_VERSION_MINOR 2 CACHE STRING "" FORCE ) -set ( LAGraph_VERSION_SUB 1 CACHE STRING "" FORCE ) +set ( LAGraph_VERSION_SUB 2 CACHE STRING "" FORCE ) message ( STATUS "Building LAGraph version: v" ${LAGraph_VERSION_MAJOR}. @@ -70,6 +70,17 @@ include ( SuiteSparsePolicy ) enable_language ( C ) +# check if stdalign.h exists +include ( CheckIncludeFile ) +check_include_file ( stdalign.h HAVE_STDALIGN_H ) +if ( HAVE_STDALIGN_H ) + set ( LAGraph_HAS_STDALIGN_H 1 ) + message ( STATUS "stdalign.h is available" ) +else ( ) + message ( STATUS "stdalign.h is not available" ) + set ( LAGraph_HAS_STDALIGN_H 0 ) +endif ( ) + # configure LAGraph.h with the LAGraph date and version configure_file ( "Config/LAGraph.h.in" diff --git a/Config/LAGraph.h.in b/Config/LAGraph.h.in index a46c06c8eb..b47e20b68f 100644 --- a/Config/LAGraph.h.in +++ b/Config/LAGraph.h.in @@ -41,6 +41,7 @@ #define LAGRAPH_VERSION_MAJOR @LAGraph_VERSION_MAJOR@ #define LAGRAPH_VERSION_MINOR @LAGraph_VERSION_MINOR@ #define LAGRAPH_VERSION_UPDATE @LAGraph_VERSION_SUB@ +#define LAGRAPH_HAS_STDALIGN_H @LAGraph_HAS_STDALIGN_H@ //============================================================================== // include files and helper macros @@ -104,8 +105,8 @@ #if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS ) // use SuiteSparse, and its GxB* extensions - #if GxB_IMPLEMENTATION < GxB_VERSION (9,0,0) - #error "If using SuiteSparse::GraphBLAS, version 9.0.0 or later is required" + #if GxB_IMPLEMENTATION < GxB_VERSION (10,0,0) + #error "SuiteSparse::GraphBLAS v10.0.0 or later is required" #endif #define LAGRAPH_SUITESPARSE 1 #else @@ -2410,11 +2411,11 @@ int LAGr_SingleSourceShortestPath ) ; //------------------------------------------------------------------------------ -// LAGr_Betweenness: betweeness centrality metric +// LAGr_Betweenness: betweenness centrality metric //------------------------------------------------------------------------------ -/** LAGr_Betweenness: betweeness centrality metric. This methods computes an - * approximation of the betweeness-centrality metric of all nodes in the graph. +/** LAGr_Betweenness: betweenness centrality metric. This methods computes an + * approximation of the betweenness-centrality metric of all nodes in the graph. * Only a few given source nodes are used for the approximation. This is an * Advanced algorithm (G->AT is required). * @@ -2442,7 +2443,7 @@ LAGRAPH_PUBLIC int LAGr_Betweenness ( // output: - GrB_Vector *centrality, // centrality(i): betweeness centrality of i + GrB_Vector *centrality, // centrality(i): betweenness centrality of i // input: const LAGraph_Graph G, // input graph const GrB_Index *sources, // source vertices to compute shortest paths diff --git a/experimental/algorithm/LAGraph_cdlp.c b/experimental/algorithm/LAGraph_cdlp.c index b8aceb624d..a6f2ba8f97 100644 --- a/experimental/algorithm/LAGraph_cdlp.c +++ b/experimental/algorithm/LAGraph_cdlp.c @@ -73,7 +73,13 @@ #include #include -#include +#if LAGRAPH_HAS_STDALIGN_H + #include + #define ALIGNAS_64 alignas(64) +#else + // the alignas keyword/macro is not available + #define ALIGNAS_64 +#endif #include "LG_internal.h" // A Go-style slice / Lisp-style property list @@ -141,7 +147,7 @@ void counts_reducer(GrB_Index* e1, GrB_Index* c1, GrB_Index e2, GrB_Index c2) { #define bucket_shift (64llu - bucket_bits) typedef struct { - alignas(64) plist buckets[nof_buckets]; + ALIGNAS_64 plist buckets[nof_buckets]; } ptable; void ptable_free(ptable* table) { @@ -187,6 +193,7 @@ void ptable_reduce(ptable* table, GrB_Index* entry, GrB_Index* count, plist_redu } //**************************************************************************** + int LAGraph_cdlp ( GrB_Vector *CDLP_handle, // output vector diff --git a/include/LAGraph.h b/include/LAGraph.h index ea88c7c7dc..0a2fca849a 100644 --- a/include/LAGraph.h +++ b/include/LAGraph.h @@ -37,10 +37,11 @@ // See also the LAGraph_Version utility method, which returns these values. // These definitions are derived from LAGraph/CMakeLists.txt. -#define LAGRAPH_DATE "Sept 8, 2025" +#define LAGRAPH_DATE "July 21, 2026" #define LAGRAPH_VERSION_MAJOR 1 #define LAGRAPH_VERSION_MINOR 2 -#define LAGRAPH_VERSION_UPDATE 1 +#define LAGRAPH_VERSION_UPDATE 2 +#define LAGRAPH_HAS_STDALIGN_H 1 //============================================================================== // include files and helper macros @@ -104,8 +105,8 @@ #if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS ) // use SuiteSparse, and its GxB* extensions - #if GxB_IMPLEMENTATION < GxB_VERSION (9,0,0) - #error "If using SuiteSparse::GraphBLAS, version 9.0.0 or later is required" + #if GxB_IMPLEMENTATION < GxB_VERSION (10,0,0) + #error "SuiteSparse::GraphBLAS v10.0.0 or later is required" #endif #define LAGRAPH_SUITESPARSE 1 #else @@ -2410,11 +2411,11 @@ int LAGr_SingleSourceShortestPath ) ; //------------------------------------------------------------------------------ -// LAGr_Betweenness: betweeness centrality metric +// LAGr_Betweenness: betweenness centrality metric //------------------------------------------------------------------------------ -/** LAGr_Betweenness: betweeness centrality metric. This methods computes an - * approximation of the betweeness-centrality metric of all nodes in the graph. +/** LAGr_Betweenness: betweenness centrality metric. This methods computes an + * approximation of the betweenness-centrality metric of all nodes in the graph. * Only a few given source nodes are used for the approximation. This is an * Advanced algorithm (G->AT is required). * @@ -2442,7 +2443,7 @@ LAGRAPH_PUBLIC int LAGr_Betweenness ( // output: - GrB_Vector *centrality, // centrality(i): betweeness centrality of i + GrB_Vector *centrality, // centrality(i): betweenness centrality of i // input: const LAGraph_Graph G, // input graph const GrB_Index *sources, // source vertices to compute shortest paths From 7c754f092f5fed106dea7518bd03ab7d4465295a Mon Sep 17 00:00:00 2001 From: Tim Davis Date: Mon, 20 Jul 2026 16:01:41 -0500 Subject: [PATCH 2/3] revise SuiteSparsePolicy.cmake (from SuiteSparse 7.12.3) --- cmake_modules/SuiteSparsePolicy.cmake | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/cmake_modules/SuiteSparsePolicy.cmake b/cmake_modules/SuiteSparsePolicy.cmake index 80906521bf..27c43547f5 100644 --- a/cmake_modules/SuiteSparsePolicy.cmake +++ b/cmake_modules/SuiteSparsePolicy.cmake @@ -35,10 +35,10 @@ # GraphBLAS is false. # # SUITESPARSE_CUDA_ARCHITECTURES: a string, such as "all" or -# "35;50;75;80" that lists the CUDA architectures to use +# "75;80" that lists the CUDA architectures to use # when compiling CUDA kernels with nvcc. The "all" # option requires cmake 3.23 or later. -# Default: "52;75;80". +# Default: "all". # # BLA_VENDOR and BLA_SIZEOF_INTEGER: By default, SuiteSparse searches for # the BLAS library in a specific order. If you wish to @@ -310,24 +310,19 @@ if ( SUITESPARSE_USE_FORTRAN ) set ( SUITESPARSE_HAS_FORTRAN ON ) if ( NOT "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_C_COMPILER_ID}" OR NOT "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_CXX_COMPILER_ID}" ) - message ( STATUS " " ) - message ( STATUS "Incompatible Fortran/C/C++ compilers detected:" ) - message ( STATUS " Fortran: ${CMAKE_Fortran_COMPILER}" ) - message ( STATUS " Fortran id: ${CMAKE_Fortran_COMPILER_ID}" ) - message ( STATUS " C ${CMAKE_C_COMPILER}" ) - message ( STATUS " C id: ${CMAKE_C_COMPILER_ID}" ) - message ( STATUS " C++ ${CMAKE_CXX_COMPILER}" ) - message ( STATUS " C++ id: ${CMAKE_CXX_COMPILER_ID}" ) if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "IntelLLVM" ) + message ( STATUS " " ) + message ( STATUS "Incompatible Fortran/C/C++ compilers detected:" ) + message ( STATUS " Fortran: ${CMAKE_Fortran_COMPILER}" ) + message ( STATUS " Fortran id: ${CMAKE_Fortran_COMPILER_ID}" ) + message ( STATUS " C ${CMAKE_C_COMPILER}" ) + message ( STATUS " C id: ${CMAKE_C_COMPILER_ID}" ) + message ( STATUS " C++ ${CMAKE_CXX_COMPILER}" ) + message ( STATUS " C++ id: ${CMAKE_CXX_COMPILER_ID}" ) # icx/icpx cannot be used with gfortran: this is a fatal error message ( FATAL_ERROR "ERROR: Using Fortran with SuiteSparse requires that " " it has the same compiler ID as the C/C++ compilers." " Use a compatible Fortran compiler, or set SUITESPARSE_USE_FORTRAN to OFF." ) - else ( ) - # other cases: just issue a warning and hope it works. - message ( WARNING "Warning: Using Fortran with SuiteSparse requires that " - " it has the same compiler ID as the C/C++ compilers." - " Use a compatible Fortran compiler, or set SUITESPARSE_USE_FORTRAN to OFF." ) endif ( ) endif ( ) message ( STATUS "Fortran: enabled" ) @@ -401,7 +396,7 @@ endif ( ) if ( SUITESPARSE_HAS_CUDA ) message ( STATUS "CUDA: enabled" ) - set ( SUITESPARSE_CUDA_ARCHITECTURES "52;75;80" CACHE STRING "CUDA architectures" ) + set ( SUITESPARSE_CUDA_ARCHITECTURES "all" CACHE STRING "CUDA architectures" ) set ( CMAKE_CUDA_ARCHITECTURES ${SUITESPARSE_CUDA_ARCHITECTURES} ) else ( ) message ( STATUS "CUDA: not enabled" ) From 9a9e36047016990ae14809cf9cab1cd3c3582f38 Mon Sep 17 00:00:00 2001 From: Tim Davis Date: Mon, 20 Jul 2026 19:14:59 -0500 Subject: [PATCH 3/3] LAGraph config --- CMakeLists.txt | 22 ++++++++++++++++++++-- Config/LAGraphConfig.cmake.in | 4 ++-- cmake_modules/FindGraphBLAS.cmake | 20 ++++++++++---------- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91beb26b75..bc760d5587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,8 +163,7 @@ else ( ) # message ( STATUS "GRAPHBLAS_ROOT: ${GRAPHBLAS_ROOT} $ENV{GRAPHBLAS_ROOT}" ) # No package version is explicitly stated here; an arbitrary GraphBLAS - # library can have any version number. For SuiteSparse:GraphBLAS, LAGraph - # requires v7.1.0 or later, which is checked in LAGraph.h. + # library can have any version number. message ( STATUS "Looking for GraphBLAS with FindGraphBLAS.cmake" ) find_package ( GraphBLAS MODULE REQUIRED ) @@ -386,6 +385,25 @@ else ( ) endif ( ) endif ( ) +if ( GRAPHBLAS_VERSION ) + if ( ${GRAPHBLAS_VERSION} MATCHES "([0-9]+).[0-9]+.[0-9]+" ) + set ( GraphBLAS_VER_MAJOR ${CMAKE_MATCH_1} ) + endif ( ) + if ( ${GRAPHBLAS_VERSION} MATCHES "[0-9]+.([0-9]+).[0-9]+" ) + set ( GraphBLAS_VER_MINOR ${CMAKE_MATCH_1} ) + endif ( ) + if ( ${GRAPHBLAS_VERSION} MATCHES "[0-9]+.[0-9]+.([0-9]+)" ) + set ( GraphBLAS_VER_PATCH ${CMAKE_MATCH_1} ) + endif ( ) + if ( LAGRAPH_DUMP ) + message ( STATUS "major: ${GraphBLAS_VER_MAJOR}" ) + message ( STATUS "minor: ${GraphBLAS_VER_MINOR}" ) + message ( STATUS "patch: ${GraphBLAS_VER_PATCH}" ) + endif ( ) +endif ( ) + +message (STATUS "Config with GraphBLAS version ${GraphBLAS_VER_MAJOR}.${GraphBLAS_VER_MINOR}.${GraphBLAS_VER_PATCH}" ) + # generate config file to be used in common build tree set ( SUITESPARSE_IN_BUILD_TREE ON ) configure_package_config_file ( diff --git a/Config/LAGraphConfig.cmake.in b/Config/LAGraphConfig.cmake.in index 6e801a9d86..666b93e03d 100644 --- a/Config/LAGraphConfig.cmake.in +++ b/Config/LAGraphConfig.cmake.in @@ -41,9 +41,9 @@ include ( CMakeFindDependencyMacro ) set ( _dependencies_found ON ) if ( NOT TARGET GraphBLAS::GraphBLAS ) - # Look GraphBLAS + # Look for GraphBLAS list ( PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ) - find_dependency ( GraphBLAS @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@ ) + find_dependency ( GraphBLAS @GraphBLAS_VER_MAJOR@.@GraphBLAS_VER_MINOR@ ) endif ( ) if ( NOT GraphBLAS_FOUND ) diff --git a/cmake_modules/FindGraphBLAS.cmake b/cmake_modules/FindGraphBLAS.cmake index 64b8a9a3b3..3ebf3df2c9 100644 --- a/cmake_modules/FindGraphBLAS.cmake +++ b/cmake_modules/FindGraphBLAS.cmake @@ -271,18 +271,18 @@ string ( if ( GRAPHBLAS_VERSION ) if ( ${GRAPHBLAS_VERSION} MATCHES "([0-9]+).[0-9]+.[0-9]+" ) - set ( GraphBLAS_VERSION_MAJOR ${CMAKE_MATCH_1} ) + set ( GraphBLAS_VER_MAJOR ${CMAKE_MATCH_1} ) endif ( ) if ( ${GRAPHBLAS_VERSION} MATCHES "[0-9]+.([0-9]+).[0-9]+" ) - set ( GraphBLAS_VERSION_MINOR ${CMAKE_MATCH_1} ) + set ( GraphBLAS_VER_MINOR ${CMAKE_MATCH_1} ) endif ( ) if ( ${GRAPHBLAS_VERSION} MATCHES "[0-9]+.[0-9]+.([0-9]+)" ) - set ( GraphBLAS_VERSION_PATCH ${CMAKE_MATCH_1} ) + set ( GraphBLAS_VER_PATCH ${CMAKE_MATCH_1} ) endif ( ) if ( LAGRAPH_DUMP ) - message ( STATUS "major: ${GraphBLAS_VERSION_MAJOR}" ) - message ( STATUS "minor: ${GraphBLAS_VERSION_MINOR}" ) - message ( STATUS "patch: ${GraphBLAS_VERSION_PATCH}" ) + message ( STATUS "major: ${GraphBLAS_VER_MAJOR}" ) + message ( STATUS "minor: ${GraphBLAS_VER_MINOR}" ) + message ( STATUS "patch: ${GraphBLAS_VER_PATCH}" ) endif ( ) endif ( ) @@ -300,10 +300,10 @@ if ( EXISTS "${GRAPHBLAS_INCLUDE_DIR}" AND NOT GRAPHBLAS_VERSION ) message ( STATUS "minor: ${GRAPHBLAS_MINOR_STR}" ) message ( STATUS "patch: ${GRAPHBLAS_PATCH_STR}" ) endif ( ) - string ( REGEX MATCH "[0-9]+" GraphBLAS_VERSION_MAJOR ${GRAPHBLAS_MAJOR_STR} ) - string ( REGEX MATCH "[0-9]+" GraphBLAS_VERSION_MINOR ${GRAPHBLAS_MINOR_STR} ) - string ( REGEX MATCH "[0-9]+" GraphBLAS_VERSION_PATCH ${GRAPHBLAS_PATCH_STR} ) - set (GRAPHBLAS_VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_PATCH}") + string ( REGEX MATCH "[0-9]+" GraphBLAS_VER_MAJOR ${GRAPHBLAS_MAJOR_STR} ) + string ( REGEX MATCH "[0-9]+" GraphBLAS_VER_MINOR ${GRAPHBLAS_MINOR_STR} ) + string ( REGEX MATCH "[0-9]+" GraphBLAS_VER_PATCH ${GRAPHBLAS_PATCH_STR} ) + set (GRAPHBLAS_VERSION "${GraphBLAS_VER_MAJOR}.${GraphBLAS_VER_MINOR}.${GraphBLAS_VER_PATCH}") endif ( ) set ( GRAPHBLAS_LIBRARIES ${GRAPHBLAS_LIBRARY} )