Skip to content

Commit 5a4c3ae

Browse files
v1.2.2: fix for MSVC which has no stdalign.h
1 parent 239370e commit 5a4c3ae

4 files changed

Lines changed: 39 additions & 19 deletions

File tree

CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
# get the version
3737
#-------------------------------------------------------------------------------
3838

39-
cmake_minimum_required ( VERSION 3.20 ) # LAGraph can be built stand-alone
39+
cmake_minimum_required ( VERSION 3.23 )
4040

4141
# version of LAGraph
42-
set ( LAGraph_DATE "Sept 8, 2025" )
42+
set ( LAGraph_DATE "July 21, 2026" )
4343
set ( LAGraph_VERSION_MAJOR 1 CACHE STRING "" FORCE )
4444
set ( LAGraph_VERSION_MINOR 2 CACHE STRING "" FORCE )
45-
set ( LAGraph_VERSION_SUB 1 CACHE STRING "" FORCE )
45+
set ( LAGraph_VERSION_SUB 2 CACHE STRING "" FORCE )
4646

4747
message ( STATUS "Building LAGraph version: v"
4848
${LAGraph_VERSION_MAJOR}.
@@ -70,6 +70,17 @@ include ( SuiteSparsePolicy )
7070

7171
enable_language ( C )
7272

73+
# check if stdalign.h exists
74+
include ( CheckIncludeFile )
75+
check_include_file ( stdalign.h HAVE_STDALIGN_H )
76+
if ( HAVE_STDALIGN_H )
77+
set ( LAGraph_HAS_STDALIGN_H 1 )
78+
message ( STATUS "stdalign.h is available" )
79+
else ( )
80+
message ( STATUS "stdalign.h is not available" )
81+
set ( LAGraph_HAS_STDALIGN_H 0 )
82+
endif ( )
83+
7384
# configure LAGraph.h with the LAGraph date and version
7485
configure_file (
7586
"Config/LAGraph.h.in"

Config/LAGraph.h.in

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define LAGRAPH_VERSION_MAJOR @LAGraph_VERSION_MAJOR@
4242
#define LAGRAPH_VERSION_MINOR @LAGraph_VERSION_MINOR@
4343
#define LAGRAPH_VERSION_UPDATE @LAGraph_VERSION_SUB@
44+
#define LAGRAPH_HAS_STDALIGN_H @LAGraph_HAS_STDALIGN_H@
4445

4546
//==============================================================================
4647
// include files and helper macros
@@ -104,8 +105,8 @@
104105

105106
#if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS )
106107
// use SuiteSparse, and its GxB* extensions
107-
#if GxB_IMPLEMENTATION < GxB_VERSION (9,0,0)
108-
#error "If using SuiteSparse::GraphBLAS, version 9.0.0 or later is required"
108+
#if GxB_IMPLEMENTATION < GxB_VERSION (10,0,0)
109+
#error "SuiteSparse::GraphBLAS v10.0.0 or later is required"
109110
#endif
110111
#define LAGRAPH_SUITESPARSE 1
111112
#else
@@ -2410,11 +2411,11 @@ int LAGr_SingleSourceShortestPath
24102411
) ;
24112412

24122413
//------------------------------------------------------------------------------
2413-
// LAGr_Betweenness: betweeness centrality metric
2414+
// LAGr_Betweenness: betweenness centrality metric
24142415
//------------------------------------------------------------------------------
24152416

2416-
/** LAGr_Betweenness: betweeness centrality metric. This methods computes an
2417-
* approximation of the betweeness-centrality metric of all nodes in the graph.
2417+
/** LAGr_Betweenness: betweenness centrality metric. This methods computes an
2418+
* approximation of the betweenness-centrality metric of all nodes in the graph.
24182419
* Only a few given source nodes are used for the approximation. This is an
24192420
* Advanced algorithm (G->AT is required).
24202421
*
@@ -2442,7 +2443,7 @@ LAGRAPH_PUBLIC
24422443
int LAGr_Betweenness
24432444
(
24442445
// output:
2445-
GrB_Vector *centrality, // centrality(i): betweeness centrality of i
2446+
GrB_Vector *centrality, // centrality(i): betweenness centrality of i
24462447
// input:
24472448
const LAGraph_Graph G, // input graph
24482449
const GrB_Index *sources, // source vertices to compute shortest paths

experimental/algorithm/LAGraph_cdlp.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@
7373

7474
#include <LAGraph.h>
7575
#include <LAGraphX.h>
76-
#include <stdalign.h>
76+
#if LAGRAPH_HAS_STDALIGN_H
77+
#include <stdalign.h>
78+
#define ALIGNAS_64 alignas(64)
79+
#else
80+
// the alignas keyword/macro is not available
81+
#define ALIGNAS_64
82+
#endif
7783
#include "LG_internal.h"
7884

7985
// 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) {
141147
#define bucket_shift (64llu - bucket_bits)
142148

143149
typedef struct {
144-
alignas(64) plist buckets[nof_buckets];
150+
ALIGNAS_64 plist buckets[nof_buckets];
145151
} ptable;
146152

147153
void ptable_free(ptable* table) {
@@ -187,6 +193,7 @@ void ptable_reduce(ptable* table, GrB_Index* entry, GrB_Index* count, plist_redu
187193
}
188194

189195
//****************************************************************************
196+
190197
int LAGraph_cdlp
191198
(
192199
GrB_Vector *CDLP_handle, // output vector

include/LAGraph.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737
// See also the LAGraph_Version utility method, which returns these values.
3838
// These definitions are derived from LAGraph/CMakeLists.txt.
3939

40-
#define LAGRAPH_DATE "Sept 8, 2025"
40+
#define LAGRAPH_DATE "July 21, 2026"
4141
#define LAGRAPH_VERSION_MAJOR 1
4242
#define LAGRAPH_VERSION_MINOR 2
43-
#define LAGRAPH_VERSION_UPDATE 1
43+
#define LAGRAPH_VERSION_UPDATE 2
44+
#define LAGRAPH_HAS_STDALIGN_H 1
4445

4546
//==============================================================================
4647
// include files and helper macros
@@ -104,8 +105,8 @@
104105

105106
#if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS )
106107
// use SuiteSparse, and its GxB* extensions
107-
#if GxB_IMPLEMENTATION < GxB_VERSION (9,0,0)
108-
#error "If using SuiteSparse::GraphBLAS, version 9.0.0 or later is required"
108+
#if GxB_IMPLEMENTATION < GxB_VERSION (10,0,0)
109+
#error "SuiteSparse::GraphBLAS v10.0.0 or later is required"
109110
#endif
110111
#define LAGRAPH_SUITESPARSE 1
111112
#else
@@ -2410,11 +2411,11 @@ int LAGr_SingleSourceShortestPath
24102411
) ;
24112412

24122413
//------------------------------------------------------------------------------
2413-
// LAGr_Betweenness: betweeness centrality metric
2414+
// LAGr_Betweenness: betweenness centrality metric
24142415
//------------------------------------------------------------------------------
24152416

2416-
/** LAGr_Betweenness: betweeness centrality metric. This methods computes an
2417-
* approximation of the betweeness-centrality metric of all nodes in the graph.
2417+
/** LAGr_Betweenness: betweenness centrality metric. This methods computes an
2418+
* approximation of the betweenness-centrality metric of all nodes in the graph.
24182419
* Only a few given source nodes are used for the approximation. This is an
24192420
* Advanced algorithm (G->AT is required).
24202421
*
@@ -2442,7 +2443,7 @@ LAGRAPH_PUBLIC
24422443
int LAGr_Betweenness
24432444
(
24442445
// output:
2445-
GrB_Vector *centrality, // centrality(i): betweeness centrality of i
2446+
GrB_Vector *centrality, // centrality(i): betweenness centrality of i
24462447
// input:
24472448
const LAGraph_Graph G, // input graph
24482449
const GrB_Index *sources, // source vertices to compute shortest paths

0 commit comments

Comments
 (0)