Skip to content

Commit 13f961b

Browse files
Merge pull request #2 from DrTimothyAldenDavis/master
v3.2.1
2 parents bf6f8d7 + 67a6789 commit 13f961b

38 files changed

+1312
-352
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ if ( CMAKE_VERSION VERSION_GREATER "3.0" )
5757
endif ( )
5858

5959
# version of SuiteSparse:GraphBLAS
60-
set ( GraphBLAS_DATE "Feb 20, 2020" )
60+
set ( GraphBLAS_DATE "Mar 10, 2020" )
6161
set ( GraphBLAS_VERSION_MAJOR 3 )
6262
set ( GraphBLAS_VERSION_MINOR 2 )
63-
set ( GraphBLAS_VERSION_SUB 0 )
63+
set ( GraphBLAS_VERSION_SUB 1 )
6464

6565
# GraphBLAS C API Specification version, at graphblas.org
6666
set ( GraphBLAS_API_DATE "May 18, 2018" )
@@ -107,6 +107,10 @@ if ( GB_BURBLE )
107107
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGB_BURBLE=1 " )
108108
endif ( )
109109

110+
if ( GBCOMPACT )
111+
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBCOMPACT=1 " )
112+
endif ( )
113+
110114
#-------------------------------------------------------------------------------
111115
# configure GraphBLAS
112116
#-------------------------------------------------------------------------------

Demo/Include/simple_timer.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,35 @@
3636

3737
#include <time.h>
3838

39-
#if defined ( __linux__ )
40-
#include <sys/time.h>
41-
#endif
39+
/* -------------------------------------------------------------------------- */
40+
/* decide which timer to use */
41+
/* -------------------------------------------------------------------------- */
4242

4343
#if defined ( _OPENMP )
44-
#include <omp.h>
45-
#endif
4644

47-
#if defined ( __MACH__ )
48-
#include <mach/clock.h>
49-
#include <mach/mach.h>
45+
/* if OpenMP is available, use omp_get_wtime */
46+
#include <omp.h>
47+
48+
#elif defined ( __linux__ ) || defined ( __GNU__ )
49+
50+
/* otherwise, on Linux/GNU, use clock_gettime. May require -lrt */
51+
#include <sys/time.h>
52+
53+
#elif defined ( __MACH__ ) && defined ( __APPLE__ )
54+
55+
/* otherwise, on the Mac, use the MACH timer */
56+
#include <mach/clock.h>
57+
#include <mach/mach.h>
58+
59+
#else
60+
61+
/* Finally, the ANSI C11 clock() function is used if no other timer
62+
is available. */
63+
5064
#endif
5165

66+
/* -------------------------------------------------------------------------- */
67+
5268
void simple_tic /* returns current time in seconds and nanoseconds */
5369
(
5470
double tic [2] /* tic [0]: seconds, tic [1]: nanoseconds */

Demo/Source/simple_timer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void simple_tic /* returns current time in seconds and nanoseconds */
2727
tic [0] = omp_get_wtime ( ) ;
2828
tic [1] = 0 ;
2929

30-
#elif defined ( __linux__ )
30+
#elif defined ( __linux__ ) || defined ( __GNU__ )
3131

3232
/* Linux has a very low resolution clock() function, so use the high
3333
resolution clock_gettime instead. May require -lrt */
@@ -36,8 +36,9 @@ void simple_tic /* returns current time in seconds and nanoseconds */
3636
tic [0] = (double) t.tv_sec ;
3737
tic [1] = (double) t.tv_nsec ;
3838

39-
#elif defined ( __MACH__ )
39+
#elif defined ( __MACH__ ) && defined ( __APPLE__ )
4040

41+
/* otherwise, on the Mac, use the MACH timer */
4142
clock_serv_t cclock ;
4243
mach_timespec_t t ;
4344
host_get_clock_service (mach_host_self ( ), SYSTEM_CLOCK, &cclock) ;

Doc/ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
Version 3.2.1, Mar 10, 2020
2+
3+
* GAP benchmarks in MATLAB: in GraphBLAS/GraphBLAS/GAP (all but CC).
4+
* atomic read/write: faster atomics for icc (see Source/GB_atomics.h)
5+
* install name for Mac: in alternative/Makefile and Tcov/Makefile
6+
* enable -DGBCOMPACT from CMake: for faster Travis builds
7+
* MATLAB interface: better error message in GrB.reduce
8+
* MATLAB triangle count: added sorting heuristic in GrB.tricount.
9+
* bug fix for GraphBLAS/Demo/simple_timer: better selection of which
10+
timer to use; simple_timer.[ch] made consistent.
11+
* no bug fixes needed in primary GraphBLAS library: just in Demo, test,
12+
and alternative/Makefile.
13+
114
Version 3.2.0, Feb 20, 2020
215

316
* GxB_*_define for user-defined compile-time objects: removed. Not
@@ -19,6 +32,7 @@ Version 3.2.0, Feb 20, 2020
1932
subset of "#pragma omp atomic" statements. This will be resolved in a
2033
future version; in the meantime, use v3.1.2 with MS Visual Studio
2134
instead of v3.2.0.
35+
* no bug fixes
2236

2337
Version 3.1.2, Dec 16, 2019
2438

Doc/GraphBLAS_UserGuide.pdf

-1 Bytes
Binary file not shown.

Doc/GraphBLAS_version.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
% version of SuiteSparse:GraphBLAS
22
\date{VERSION
3-
3.2.0,
4-
Feb 20, 2020}
3+
3.2.1,
4+
Mar 10, 2020}
55

GraphBLAS/@GrB/private/mexfunctions/gbvreduce.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ void mexFunction
8181
OK (GxB_Matrix_type (&atype, A)) ;
8282
if (C != NULL)
8383
{
84+
CHECK_ERROR (C->is_hyper, "Cin cannot be hypersparse") ;
85+
CHECK_ERROR (!(C->is_csc), "Cin must be stored by column") ;
86+
CHECK_ERROR (!GB_VECTOR_OK (C), "Cin must be a column vector") ;
8487
OK (GxB_Matrix_type (&ctype, C)) ;
8588
}
8689

GraphBLAS/@GrB/tricount.m

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function s = tricount (A, check)
1+
function s = tricount (A, arg2, arg3)
22
%GRB.TRICOUNT count triangles in a matrix.
33
% s = GrB.tricount (A) counts the number of triangles in the matrix A.
44
% spones (A) must be symmetric; results are undefined if spones (A) is
@@ -7,22 +7,75 @@
77
% To check the input matrix A, use GrB.tricount (A, 'check'). This check
88
% takes additional time so by default the input is not checked.
99
%
10-
% See also GrB.ktruss.
10+
% If d is a vector of length n with d(i) equal to the degree of node i,
11+
% then s = tricount (A, d) can be used. Otherwise, tricount must compute
12+
% the degrees first.
13+
%
14+
% See also GrB.ktruss, GrB.entries.
15+
%
16+
% ADDED: sort if warranted. See LAGraph_tricount.
1117

1218
[m, n] = size (A) ;
1319
if (m ~= n)
1420
gb_error ('A must be square') ;
1521
end
16-
if (nargin < 2)
17-
check = false ;
18-
else
19-
check = isequal (check, 'check') ;
22+
23+
d = [ ] ;
24+
check = false ;
25+
26+
if (nargin == 2)
27+
if (ischar (arg2))
28+
% s = tricount (A, 'check')
29+
check = isequal (arg2, 'check') ;
30+
else
31+
% s = tricount (A, d)
32+
d = arg2 ;
33+
end
34+
elseif (nargin == 3)
35+
if (ischar (arg2))
36+
% s = tricount (A, 'check', d)
37+
check = isequal (arg2, 'check') ;
38+
d = arg3 ;
39+
else
40+
% s = tricount (A, d, 'check')
41+
d = arg2 ;
42+
check = isequal (arg3, 'check') ;
43+
end
2044
end
2145

2246
if (check && ~issymmetric (spones (A)))
2347
gb_error ('pattern of A must be symmetric') ;
2448
end
2549

50+
if (isequal (class (d), 'GrB'))
51+
d = double (d) ;
52+
end
53+
54+
% determine if A should be sorted first
55+
if (n > 1000 && GrB.entries (A) >= 10*n)
56+
if (isempty (d))
57+
% compute the degree of each node, if not provided on input
58+
if (GrB.isbyrow (A))
59+
d = double (GrB.entries (A, 'row', 'degree')) ;
60+
else
61+
d = double (GrB.entries (A, 'col', 'degree')) ;
62+
end
63+
end
64+
% sample the degree
65+
p = randperm (n, 1000) ;
66+
sample = d (randperm (n, 1000)) ;
67+
dmean = full (mean (sample)) ;
68+
dmed = full (median (sample)) ;
69+
% fprintf ('mean degree: %g median: %g\n', dmean, dmed) ;
70+
if (dmean > 4 * dmed)
71+
% sort if the average degree is very high compared to the median
72+
% fprintf ('sorting A first\n') ;
73+
[~, p] = sort (d, 'descend') ;
74+
A = A (p,p) ;
75+
clear p
76+
end
77+
end
78+
2679
% C, L, and U will have the same format as A
2780
C = GrB (n, n, 'int64', GrB.format (A)) ;
2881
L = tril (A, -1) ;

GraphBLAS/GAP/Contents.m

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
% GAP: GAP benchmark methods in MATLAB (in progress)
22
%
3-
% Files
4-
% gap - run GAP benchmarks
5-
% gap_bfs - run bfs for the GAP benchmark
6-
% gap_pagerank - PageRank of a graph (GAP benchmark algorithm)
7-
% gap_pr - run pagerank for the GAP benchmark
8-
% gap_tc - run tricount for the GAP benchmark
9-
% tric - triangle countting tests
10-
% ttest - run triangle counting tests
3+
% gap - run 5 GAP benchmarks (BFS, PR, BC, TC, SSSP; not CC)
4+
% gap_bfs - run bfs for the GAP benchmark
5+
% gap_pr - run pagerank for the GAP benchmark
6+
% gap_pagerank - PageRank of a graph (GAP benchmark algorithm)
7+
% gap_tc - run tricount for the GAP benchmark
8+
% tric - triangle counting tests
9+
% ttest - run triangle counting tests
10+
% gap_bc - run centrality for the GAP benchmark
11+
% gap_centrality - batch betweenness centrality of a graph, via GraphBLAS
12+
% gap_sssp12c - single source shortest path, via delta stepping, for GAP
13+
% gap_sssp12 - single source shortest path, via delta stepping, for GAP
14+
% gap_sssp - run SSSP for the GAP benchmark
1115

1216
% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2020, All Rights Reserved.
1317
% http://suitesparse.com See GraphBLAS/Doc/License.txt for license.

GraphBLAS/GAP/bctest.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
s = [20 34 14 51] ;
3+
Prob = ssget ('HB/west0067') ;
4+
A = GrB (Prob.A, 'by row') ;
5+
A = GrB (A, 'logical')
6+
7+
c = gap_centrality (s, A)
8+

0 commit comments

Comments
 (0)