Skip to content

Commit 50cd0c8

Browse files
Merge pull request #363 from GraphBLAS/v1.2
V1.2: revised msf, adding maxflow, revised scc
2 parents 61284a2 + 09e1f7c commit 50cd0c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3662
-10861
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
cmake_minimum_required ( VERSION 3.20 ) # LAGraph can be built stand-alone
4040

4141
# version of LAGraph
42-
set ( LAGraph_DATE "June 1, 2025" )
42+
set ( LAGraph_DATE "July 25, 2025" )
4343
set ( LAGraph_VERSION_MAJOR 1 CACHE STRING "" FORCE )
4444
set ( LAGraph_VERSION_MINOR 2 CACHE STRING "" FORCE )
4545
set ( LAGraph_VERSION_SUB 0 CACHE STRING "" FORCE )

ChangeLog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
June 1, 2025: version 1.2.0
1+
July 25, 2025: version 1.2.0
22

33
* v2.1 C API: using the new GrB_get/set methods in the C API;
44
LAGraph can now use a "vanilla" GraphBLAS that supports the v2.1

Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#
2020
# To compile with an alternate compiler:
2121
#
22-
# make CC=gcc CXX=g++
22+
# make CC=gcc CXX=g++ FC=gfortran
2323
#
2424
# To compile/install for system-wide usage (typically in /usr/local):
2525
#
@@ -48,28 +48,30 @@
4848

4949
JOBS ?= 8
5050

51+
F = -DSUITESPARSE_USE_FORTRAN=OFF
52+
5153
default: library
5254

5355
library:
54-
( cd build && cmake $(CMAKE_OPTIONS) .. && cmake --build . --config Release -j${JOBS} )
56+
( cd build && cmake $(F) $(CMAKE_OPTIONS) .. && cmake --build . --config Release -j${JOBS} )
5557

5658
# install only in SuiteSparse/lib and SuiteSparse/include
5759
local:
58-
( cd build && cmake $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DSUITESPARSE_LOCAL_INSTALL=1 .. && cmake --build . --config Release -j${JOBS} )
60+
( cd build && cmake $(F) $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DSUITESPARSE_LOCAL_INSTALL=1 .. && cmake --build . --config Release -j${JOBS} )
5961

6062
# install CMAKE_INSTALL_PREFIX
6163
global:
62-
( cd build && cmake $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DSUITESPARSE_LOCAL_INSTALL=0 .. && cmake --build . --config Release -j${JOBS} )
64+
( cd build && cmake $(F) $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DSUITESPARSE_LOCAL_INSTALL=0 .. && cmake --build . --config Release -j${JOBS} )
6365

6466
vanilla:
65-
( cd build && cmake $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} )
67+
( cd build && cmake $(F) $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} )
6668

6769
# compile with -g for debugging
6870
debug:
69-
( cd build && cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . --config Release -j${JOBS} )
71+
( cd build && cmake $(F) $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . --config Release -j${JOBS} )
7072

7173
vanilla_debug:
72-
( cd build && cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug -USUITESPARSE_PKGFILEDIR -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} )
74+
( cd build && cmake $(F) $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug -USUITESPARSE_PKGFILEDIR -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} )
7375

7476
all: library
7577

@@ -83,7 +85,7 @@ verbose_test: library
8385
# dlopen and dlinit), and run the tests with valgrind. For best results,
8486
# compile GraphBLAS without OpenMP and with the JIT disabled.
8587
memcheck: distclean
86-
( cd build && cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug -DLAGRAPH_USE_OPENMP=0 .. )
88+
( cd build && cmake $(F) $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug -DLAGRAPH_USE_OPENMP=0 .. )
8789
( cd build && cmake --build . --config Release -j${JOBS} )
8890
( cd build && ctest . -T memcheck )
8991

@@ -96,7 +98,7 @@ remake:
9698

9799
# just run cmake to set things up
98100
setup:
99-
( cd build && cmake $(CMAKE_OPTIONS) .. )
101+
( cd build && cmake $(F) $(CMAKE_OPTIONS) .. )
100102

101103
install:
102104
( cd build && cmake --install . )
@@ -107,7 +109,7 @@ uninstall:
107109

108110
# clean, compile, and run test coverage
109111
cov: distclean
110-
( cd build && cmake -DCOVERAGE=1 .. && cmake --build . --config Release -j${JOBS} && cmake --build . --target test_coverage )
112+
( cd build && cmake $(F) -DCOVERAGE=1 .. && cmake --build . --config Release -j${JOBS} && cmake --build . --target test_coverage )
111113

112114
# remove all files not in the distribution
113115
clean: distclean

cmake_modules/SuiteSparsePolicy.cmake

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@
7272
# for your system.
7373
# Default: ON
7474
#
75+
# *** WARNING: Using the Intel icx compiler, the Intel MKL BLAS, and the
76+
# GNU Fortran compiler together will result in two OpenMP libraries
77+
# linked to the UMFPACK, CHOLMOD, ParU, and SPQR libraries. This will
78+
# cause serious performance issues. This cmake file detects if icx and
79+
# gfortran are in use, and issues a fatal error. Otherwise, if the C,
80+
# C++, and Fortran compilers have a different compiler ID, a warning is
81+
# issued; this is NOT recommended, but it might be OK. In that case,
82+
# ensure that you are linking with just one OpenMP library. If this
83+
# occurs, disable the use of Fortran by setting SUITESPARSE_USE_FORTRAN
84+
# to OFF, use a suite of C/C++/Fortran compilers with the same ID,
85+
# or ensure that all your compiled libraries link against a single
86+
# OpenMP library.
87+
#
7588
# SUITESPARSE_PKGFILEDIR: Directory where CMake Config and pkg-config files
7689
# will be installed. By default, CMake Config files will
7790
# be installed in the subfolder `cmake` of the directory
@@ -288,11 +301,36 @@ endif ( )
288301
include ( CheckLanguage )
289302
option ( SUITESPARSE_USE_FORTRAN "ON (default): use Fortran. OFF: do not use Fortran" ON )
290303
if ( SUITESPARSE_USE_FORTRAN )
304+
message ( STATUS "Checking if Fortran is available and compatible with C/C++" )
291305
check_language ( Fortran )
292306
if ( CMAKE_Fortran_COMPILER )
307+
# Fortran is available; ensure that it is compatible with C/C++
308+
enable_language ( CXX )
293309
enable_language ( Fortran )
294-
message ( STATUS "Fortran: ${CMAKE_Fortran_COMPILER}" )
295310
set ( SUITESPARSE_HAS_FORTRAN ON )
311+
if ( NOT "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_C_COMPILER_ID}" OR
312+
NOT "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_CXX_COMPILER_ID}" )
313+
message ( STATUS " " )
314+
message ( STATUS "Incompatible Fortran/C/C++ compilers detected:" )
315+
message ( STATUS " Fortran: ${CMAKE_Fortran_COMPILER}" )
316+
message ( STATUS " Fortran id: ${CMAKE_Fortran_COMPILER_ID}" )
317+
message ( STATUS " C ${CMAKE_C_COMPILER}" )
318+
message ( STATUS " C id: ${CMAKE_C_COMPILER_ID}" )
319+
message ( STATUS " C++ ${CMAKE_CXX_COMPILER}" )
320+
message ( STATUS " C++ id: ${CMAKE_CXX_COMPILER_ID}" )
321+
if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "IntelLLVM" )
322+
# icx/icpx cannot be used with gfortran: this is a fatal error
323+
message ( FATAL_ERROR "ERROR: Using Fortran with SuiteSparse requires that "
324+
" it has the same compiler ID as the C/C++ compilers."
325+
" Use a compatible Fortran compiler, or set SUITESPARSE_USE_FORTRAN to OFF." )
326+
else ( )
327+
# other cases: just issue a warning and hope it works.
328+
message ( WARNING "Warning: Using Fortran with SuiteSparse requires that "
329+
" it has the same compiler ID as the C/C++ compilers."
330+
" Use a compatible Fortran compiler, or set SUITESPARSE_USE_FORTRAN to OFF." )
331+
endif ( )
332+
endif ( )
333+
message ( STATUS "Fortran: enabled" )
296334
else ( )
297335
# Fortran not available:
298336
set ( SUITESPARSE_HAS_FORTRAN OFF )

data/cycle_flow.mtx

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
%%MatrixMarket matrix coordinate real general
2+
% A 90x90 adjacency matrix representing a cycle of 90 vertices.
3+
% Each edge has capacity = 1.
4+
% There are 90 edges in total.
5+
90 90 90
6+
1 2 1
7+
2 3 1
8+
3 4 1
9+
4 5 1
10+
5 6 1
11+
6 7 1
12+
7 8 1
13+
8 9 1
14+
9 10 1
15+
10 11 1
16+
11 12 1
17+
12 13 1
18+
13 14 1
19+
14 15 1
20+
15 16 1
21+
16 17 1
22+
17 18 1
23+
18 19 1
24+
19 20 1
25+
20 21 1
26+
21 22 1
27+
22 23 1
28+
23 24 1
29+
24 25 1
30+
25 26 1
31+
26 27 1
32+
27 28 1
33+
28 29 1
34+
29 30 1
35+
30 31 1
36+
31 32 1
37+
32 33 1
38+
33 34 1
39+
34 35 1
40+
35 36 1
41+
36 37 1
42+
37 38 1
43+
38 39 1
44+
39 40 1
45+
40 41 1
46+
41 42 1
47+
42 43 1
48+
43 44 1
49+
44 45 1
50+
45 46 1
51+
46 47 1
52+
47 48 1
53+
48 49 1
54+
49 50 1
55+
50 51 1
56+
51 52 1
57+
52 53 1
58+
53 54 1
59+
54 55 1
60+
55 56 1
61+
56 57 1
62+
57 58 1
63+
58 59 1
64+
59 60 1
65+
60 61 1
66+
61 62 1
67+
62 63 1
68+
63 64 1
69+
64 65 1
70+
65 66 1
71+
66 67 1
72+
67 68 1
73+
68 69 1
74+
69 70 1
75+
70 71 1
76+
71 72 1
77+
72 73 1
78+
73 74 1
79+
74 75 1
80+
75 76 1
81+
76 77 1
82+
77 78 1
83+
78 79 1
84+
79 80 1
85+
80 81 1
86+
81 82 1
87+
82 83 1
88+
83 84 1
89+
84 85 1
90+
85 86 1
91+
86 87 1
92+
87 88 1
93+
88 89 1
94+
89 90 1
95+
90 1 1

data/matrix_random_flow.mtx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
%%MatrixMarket matrix coordinate integer general
2+
%
3+
10 10 20
4+
1 4 55
5+
3 1 11
6+
3 2 67
7+
3 5 10
8+
4 1 29
9+
4 9 22
10+
5 4 78
11+
5 9 9
12+
6 2 75
13+
6 3 87
14+
6 8 30
15+
7 4 60
16+
7 6 89
17+
7 8 11
18+
7 9 23
19+
8 1 55
20+
8 5 98
21+
8 7 89
22+
8 10 30
23+
9 7 46

data/rand.mtx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
%%MatrixMarket matrix coordinate real general
2+
20 20 36
3+
1 2 10
4+
1 3 15
5+
1 4 5
6+
1 5 7
7+
2 6 10
8+
3 6 5
9+
3 7 10
10+
4 7 5
11+
4 8 5
12+
5 8 7
13+
6 9 8
14+
6 10 10
15+
7 10 5
16+
7 11 5
17+
8 9 5
18+
8 11 7
19+
9 12 10
20+
9 13 3
21+
10 13 10
22+
10 14 5
23+
11 14 10
24+
11 12 5
25+
12 15 5
26+
12 16 7
27+
13 16 10
28+
13 17 5
29+
14 17 10
30+
14 15 3
31+
15 18 7
32+
15 19 5
33+
16 19 10
34+
16 20 10
35+
17 20 15
36+
17 18 5
37+
18 20 5
38+
19 20 10

data/wiki.mtx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
%%MatrixMarket matrix coordinate real general
2+
% 6x6 matrix with 6 non-zero entries
3+
6 6 6
4+
1 2 2
5+
1 3 9
6+
2 3 1
7+
3 5 7
8+
4 6 7
9+
5 6 4

experimental/algorithm/LAGr_EdgeBetweennessCentrality.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@
6666
// (1+x)/y function for double: z = (1 + x) / y
6767
//------------------------------------------------------------------------------
6868

69-
void add_one_divide_function (double *z, const double *x, const double *y)
69+
void LG_EBC_add_one_divide_function (double *z, const double *x, const double *y)
7070
{
7171
double a = (*(x)) ;
7272
double b = (*(y)) ;
7373
(*(z)) = (1 + a) / b ;
7474
}
7575

7676
#define ADD_ONE_DIVIDE_FUNCTION_DEFN \
77-
"void add_one_divide_function (double *z, const double *x, const double *y)\n" \
77+
"void LG_EBC_add_one_divide_function (double *z, const double *x, const double *y)\n" \
7878
"{ \n" \
7979
" double a = (*(x)) ; \n" \
8080
" double b = (*(y)) ; \n" \
@@ -203,9 +203,9 @@ int LAGr_EdgeBetweennessCentrality
203203
// =========================================================================
204204

205205
GRB_TRY (GxB_BinaryOp_new (&Add_One_Divide,
206-
(GxB_binary_function) add_one_divide_function,
206+
(GxB_binary_function) LG_EBC_add_one_divide_function,
207207
GrB_FP64, GrB_FP64, GrB_FP64,
208-
"add_one_divide_function", ADD_ONE_DIVIDE_FUNCTION_DEFN)) ;
208+
"LG_EBC_add_one_divide_function", ADD_ONE_DIVIDE_FUNCTION_DEFN)) ;
209209

210210
// Initialize the frontier, paths, Update, and bc_vertex_flow
211211
GRB_TRY (GrB_Vector_new (&paths, GrB_FP64, n)) ;

0 commit comments

Comments
 (0)