Skip to content

Commit 7887f54

Browse files
Merge pull request #229 from GraphBLAS/v1.0.2
remove GxB_SelectOp
2 parents 102bd15 + 1340799 commit 7887f54

File tree

9 files changed

+38
-51
lines changed

9 files changed

+38
-51
lines changed

Diff for: .github/workflows/build.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ jobs:
6262
uses: actions/[email protected]
6363
- name: Install dependencies
6464
run: |
65-
brew extract --version=14.0.6 libomp homebrew/cask
65+
brew tap-new libomp/cask
66+
brew extract --version=14.0.6 libomp libomp/cask
6667
brew install [email protected]
6768
- name: Get GraphBLAS binaries
6869
run: |

Diff for: CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# LAGraph/CMakeLists.txt: cmake script for LAGraph
33
#-------------------------------------------------------------------------------
44

5-
# LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved.
5+
# LAGraph, (c) 2019-2023 by The LAGraph Contributors, All Rights Reserved.
66
# SPDX-License-Identifier: BSD-2-Clause
77
#
88
# For additional details (including references to third party source code and
@@ -49,10 +49,10 @@ cmake_policy ( SET CMP0048 NEW )
4949
set ( CMAKE_MACOSX_RPATH TRUE )
5050

5151
# version of LAGraph
52-
set ( LAGraph_DATE "Dec 28, 2022" )
52+
set ( LAGraph_DATE "Aug 2, 2023" )
5353
set ( LAGraph_VERSION_MAJOR 1 )
5454
set ( LAGraph_VERSION_MINOR 0 )
55-
set ( LAGraph_VERSION_SUB 1 )
55+
set ( LAGraph_VERSION_SUB 2 )
5656

5757
project ( lagraph
5858
VERSION "${LAGraph_VERSION_MAJOR}.${LAGraph_VERSION_MINOR}.${LAGraph_VERSION_SUB}" )

Diff for: ChangeLog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Version 1.0.2: Aug 2, 2023
2+
3+
* port: removed GxB_SelectOp so LAGraph v1.0.2 can be compiled with
4+
SuiteSparse:GraphBLAS v8.x.
5+
16
Version 1.0.1: Dec 26, 2022
27

38
* bug fix: LAGraph_MMWrite incorrectly created a Matrix Market

Diff for: experimental/algorithm/LAGraph_msf.c

+9-14
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,17 @@ static GrB_Index *weight = NULL, *parent = NULL, *partner = NULL;
8888
// for each element A(i, j), it is selected if
8989
// 1. weight[i] == A(i, j) -- where weight[i] stores i's minimum edge weight
9090
// 2. parent[j] == partner[i] -- j belongs to the specified connected component
91-
bool f1 (
92-
GrB_Index i, GrB_Index j,
93-
const void *x, const void *thunk)
91+
void f1 (bool *z, const void *x, GrB_Index i, GrB_Index j, const void *thunk)
9492
{
9593
uint64_t *aij = (uint64_t*) x;
96-
return (weight[i] == *aij) && (parent[j] == partner[i]);
94+
(*z) = (weight[i] == *aij) && (parent[j] == partner[i]);
9795
}
9896

9997
// edge removal:
10098
// A(i, j) is removed when parent[i] == parent[j]
101-
bool f2 (
102-
GrB_Index i, GrB_Index j,
103-
const void *x, const void *thunk)
99+
void f2 (bool *z, const void *x, GrB_Index i, GrB_Index j, const void *thunk)
104100
{
105-
uint64_t *aij = (uint64_t*) x;
106-
return (parent[i] != parent[j]);
101+
(*z) = (parent[i] != parent[j]);
107102
}
108103

109104
//****************************************************************************
@@ -134,7 +129,7 @@ int LAGraph_msf
134129
GrB_Semiring combMin = NULL;
135130
GrB_UnaryOp fst = NULL, snd = NULL;
136131

137-
GxB_SelectOp s1 = NULL, s2 = NULL;
132+
GrB_IndexUnaryOp s1 = NULL, s2 = NULL;
138133
if (result == NULL || A == NULL) return (GrB_NULL_POINTER) ;
139134

140135
GrB_Index ncols ;
@@ -190,8 +185,8 @@ int LAGraph_msf
190185
GRB_TRY (GrB_UnaryOp_new (&snd, get_snd, GrB_UINT64, GrB_UINT64));
191186

192187
// GrB_SelectOp
193-
GxB_SelectOp_new (&s1, f1, GrB_UINT64, GrB_NULL);
194-
GxB_SelectOp_new (&s2, f2, GrB_UINT64, GrB_NULL);
188+
GrB_IndexUnaryOp_new (&s1, (void *) f1, GrB_BOOL, GrB_UINT64, GrB_UINT64);
189+
GrB_IndexUnaryOp_new (&s2, (void *) f2, GrB_BOOL, GrB_UINT64, GrB_UINT64);
195190

196191
// the main computation
197192
GrB_Index nvals, diff, ntuples = 0, num;
@@ -242,7 +237,7 @@ int LAGraph_msf
242237
GRB_TRY (GrB_assign (t, 0, 0, inf, GrB_ALL, 0, 0));
243238
GRB_TRY (GrB_apply (t, mask, 0, snd, edge, 0));
244239
GRB_TRY (GrB_Vector_extractTuples (I, partner, &n, t));
245-
GRB_TRY (GxB_select (T, 0, 0, s1, S, GrB_NULL, 0));
240+
GRB_TRY (GrB_select (T, 0, 0, s1, S, 0, 0));
246241
GRB_TRY (GrB_Vector_clear (t));
247242

248243
// 5. the generated matrix may still have redundant edges
@@ -268,7 +263,7 @@ int LAGraph_msf
268263

269264
// remove the edges in the same connected component
270265
GRB_TRY (GrB_Vector_extractTuples (I, parent, &n, f));
271-
GRB_TRY (GxB_select (S, 0, 0, s2, S, GrB_NULL, 0));
266+
GRB_TRY (GrB_select (S, 0, 0, s2, S, 0, 0));
272267
GrB_Matrix_nvals (&nvals, S);
273268
if (nvals == 0) break;
274269
}

Diff for: experimental/algorithm/LAGraph_scc.c

+15-14
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,23 @@ GrB_Index *I = NULL, *V = NULL, *F = NULL, *B = NULL, *M = NULL;
4747
// hold. The converse is not true unless F[u]==B[u]. However, we can safely remove
4848
// an edge (u, v) if either F[u]!=F[v] or B[u]!=B[v] holds, which can accelerate
4949
// the SCC computation in the future rounds.
50-
bool edge_removal (GrB_Index i, GrB_Index j, const void *x, const void *thunk) ;
51-
bool edge_removal (GrB_Index i, GrB_Index j, const void *x, const void *thunk)
50+
51+
void edge_removal (bool *z, const void *x, GrB_Index i, GrB_Index j, const void *thunk) ;
52+
void edge_removal (bool *z, const void *x, GrB_Index i, GrB_Index j, const void *thunk)
5253
{
53-
return !M[i] && !M[j] && F[i] == F[j] && B[i] == B[j];
54+
(*z) = (!M[i] && !M[j] && F[i] == F[j] && B[i] == B[j]) ;
5455
}
5556

5657
//****************************************************************************
5758
// trim_one: remove the edges connected to trivial SCCs
5859
// - A vertex is a trivial SCC if it has no incoming or outgoing edges.
5960
// - M[i] = i | if vertex i is a trivial SCC
6061
// M[i] = n | otherwise
61-
bool trim_one (GrB_Index i, GrB_Index j, const void *x, const void *thunk) ;
62-
bool trim_one (GrB_Index i, GrB_Index j, const void *x, const void *thunk)
62+
63+
void trim_one (bool *z, const void *x, GrB_Index i, GrB_Index j, const void *thunk) ;
64+
void trim_one (bool *z, const void *x, GrB_Index i, GrB_Index j, const void *thunk)
6365
{
64-
return M[i] == M[j];
66+
(*z) = (M[i] == M[j]) ;
6567
}
6668

6769
//****************************************************************************
@@ -123,7 +125,7 @@ int LAGraph_scc
123125
GrB_Vector ind;
124126
GrB_Vector inf;
125127
GrB_Vector f, b, mask;
126-
GxB_SelectOp sel1, sel2;
128+
GrB_IndexUnaryOp sel1 = NULL, sel2 = NULL ;
127129
GrB_Monoid Add;
128130

129131
if (result == NULL || A == NULL) return (GrB_NULL_POINTER) ;
@@ -169,9 +171,8 @@ int LAGraph_scc
169171
GRB_TRY (GrB_Vector_new (&f, GrB_UINT64, n));
170172
GRB_TRY (GrB_Vector_new (&b, GrB_UINT64, n));
171173
GRB_TRY (GrB_Vector_new (&mask, GrB_UINT64, n));
172-
// GxB_SelectOp
173-
GRB_TRY (GxB_SelectOp_new (&sel1, trim_one, GrB_BOOL, GrB_NULL));
174-
GRB_TRY (GxB_SelectOp_new (&sel2, edge_removal, GrB_BOOL, GrB_NULL));
174+
GRB_TRY (GrB_IndexUnaryOp_new (&sel1, (void *) trim_one, GrB_BOOL, GrB_UINT64, GrB_UINT64));
175+
GRB_TRY (GrB_IndexUnaryOp_new (&sel2, (void *) edge_removal, GrB_BOOL, GrB_UINT64, GrB_UINT64));
175176

176177
// remove trivial SCCs
177178
GRB_TRY (GrB_reduce (f, 0, GrB_PLUS_UINT64, GrB_PLUS_UINT64, FW, 0));
@@ -186,8 +187,8 @@ int LAGraph_scc
186187
if (nvals < n)
187188
{
188189
GRB_TRY (GrB_Vector_extractTuples (I, M, &n, scc));
189-
GRB_TRY (GxB_select (FW, 0, 0, sel1, FW, GrB_NULL, 0));
190-
GRB_TRY (GxB_select (BW, 0, 0, sel1, BW, GrB_NULL, 0));
190+
GRB_TRY (GrB_select (FW, 0, 0, sel1, FW, 0, 0));
191+
GRB_TRY (GrB_select (BW, 0, 0, sel1, BW, 0, 0));
191192
}
192193

193194
GRB_TRY (GrB_Matrix_nvals (&nvals, FW));
@@ -209,8 +210,8 @@ int LAGraph_scc
209210
GRB_TRY (GrB_Vector_extractTuples (I, B, &n, b));
210211
GRB_TRY (GrB_Vector_extractTuples (I, M, &n, mask));
211212

212-
GRB_TRY (GxB_select (FW, 0, 0, sel2, FW, GrB_NULL, 0));
213-
GRB_TRY (GxB_select (BW, 0, 0, sel2, BW, GrB_NULL, 0));
213+
GRB_TRY (GrB_select (FW, 0, 0, sel2, FW, 0, 0));
214+
GRB_TRY (GrB_select (BW, 0, 0, sel2, BW, 0, 0));
214215

215216
GRB_TRY (GrB_Matrix_nvals (&nvals, FW));
216217
}

Diff for: include/LAGraph.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
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 "Dec 28, 2022"
40+
#define LAGRAPH_DATE "Aug 2, 2023"
4141
#define LAGRAPH_VERSION_MAJOR 1
4242
#define LAGRAPH_VERSION_MINOR 0
43-
#define LAGRAPH_VERSION_UPDATE 1
43+
#define LAGRAPH_VERSION_UPDATE 2
4444

4545
//==============================================================================
4646
// include files and helper macros

Diff for: src/benchmark/LAGraph_demo.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,8 @@ static inline int demo_init (bool burble)
11011101
char msg [LAGRAPH_MSG_LEN] ;
11021102
msg [0] = '\0' ;
11031103

1104-
#ifdef __linux__
1105-
// Use mallopt to speedup malloc and free on Linux. Otherwise, it can take
1104+
#ifdef __GLIBC__
1105+
// Use mallopt to speedup malloc and free on Linux (glibc). Otherwise, it can take
11061106
// several seconds to free a large block of memory. For this to be
11071107
// effective, demo_init must be called before calling malloc/free, and
11081108
// before calling LAGraph_Init.

Diff for: src/test/test_Type.c

-6
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,8 @@ void test_TypeName (void)
7979
name [0] = '\0' ;
8080
OK (GrB_Type_new (&type, sizeof (myint))) ;
8181
int result = LAGraph_NameOfType (name, type, msg) ;
82-
#if LAGRAPH_SUITESPARSE
83-
printf ("\nSuiteSparse knows the type name: [%s]\n", name) ;
84-
TEST_CHECK (result == GrB_SUCCESS) ;
85-
OK (strcmp (name, "myint")) ;
86-
#else
8782
TEST_CHECK (result == GrB_NOT_IMPLEMENTED) ;
8883
printf ("\nmsg: %s\n", msg) ;
89-
#endif
9084

9185
TEST_CHECK (LAGraph_NameOfType (NULL, NULL, msg) == GrB_NULL_POINTER) ;
9286
printf ("\nmsg: %s\n", msg) ;

Diff for: src/utility/LAGraph_NameOfType.c

-9
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ int LAGraph_NameOfType
4040
// determine the name of the type
4141
//--------------------------------------------------------------------------
4242

43-
#if LAGRAPH_SUITESPARSE
44-
45-
// always succeeds, even for user-defined types, unless the
46-
// type is an invalid object
47-
return (GxB_Type_name (name, type)) ;
48-
49-
#else
50-
5143
if (type == GrB_BOOL ) strcpy (name, "bool") ;
5244
else if (type == GrB_INT8 ) strcpy (name, "int8_t") ;
5345
else if (type == GrB_INT16 ) strcpy (name, "int16_t") ;
@@ -71,5 +63,4 @@ int LAGraph_NameOfType
7163
}
7264
return (GrB_SUCCESS) ;
7365

74-
#endif
7566
}

0 commit comments

Comments
 (0)