Skip to content

Commit

Permalink
Merge pull request #2 from DrTimothyAldenDavis/master
Browse files Browse the repository at this point in the history
v3.2.1
  • Loading branch information
DrTimothyAldenDavis authored Mar 10, 2020
2 parents bf6f8d7 + 67a6789 commit 13f961b
Show file tree
Hide file tree
Showing 38 changed files with 1,312 additions and 352 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ if ( CMAKE_VERSION VERSION_GREATER "3.0" )
endif ( )

# version of SuiteSparse:GraphBLAS
set ( GraphBLAS_DATE "Feb 20, 2020" )
set ( GraphBLAS_DATE "Mar 10, 2020" )
set ( GraphBLAS_VERSION_MAJOR 3 )
set ( GraphBLAS_VERSION_MINOR 2 )
set ( GraphBLAS_VERSION_SUB 0 )
set ( GraphBLAS_VERSION_SUB 1 )

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

if ( GBCOMPACT )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBCOMPACT=1 " )
endif ( )

#-------------------------------------------------------------------------------
# configure GraphBLAS
#-------------------------------------------------------------------------------
Expand Down
32 changes: 24 additions & 8 deletions Demo/Include/simple_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,35 @@

#include <time.h>

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

#if defined ( _OPENMP )
#include <omp.h>
#endif

#if defined ( __MACH__ )
#include <mach/clock.h>
#include <mach/mach.h>
/* if OpenMP is available, use omp_get_wtime */
#include <omp.h>

#elif defined ( __linux__ ) || defined ( __GNU__ )

/* otherwise, on Linux/GNU, use clock_gettime. May require -lrt */
#include <sys/time.h>

#elif defined ( __MACH__ ) && defined ( __APPLE__ )

/* otherwise, on the Mac, use the MACH timer */
#include <mach/clock.h>
#include <mach/mach.h>

#else

/* Finally, the ANSI C11 clock() function is used if no other timer
is available. */

#endif

/* -------------------------------------------------------------------------- */

void simple_tic /* returns current time in seconds and nanoseconds */
(
double tic [2] /* tic [0]: seconds, tic [1]: nanoseconds */
Expand Down
5 changes: 3 additions & 2 deletions Demo/Source/simple_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void simple_tic /* returns current time in seconds and nanoseconds */
tic [0] = omp_get_wtime ( ) ;
tic [1] = 0 ;

#elif defined ( __linux__ )
#elif defined ( __linux__ ) || defined ( __GNU__ )

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

#elif defined ( __MACH__ )
#elif defined ( __MACH__ ) && defined ( __APPLE__ )

/* otherwise, on the Mac, use the MACH timer */
clock_serv_t cclock ;
mach_timespec_t t ;
host_get_clock_service (mach_host_self ( ), SYSTEM_CLOCK, &cclock) ;
Expand Down
14 changes: 14 additions & 0 deletions Doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Version 3.2.1, Mar 10, 2020

* GAP benchmarks in MATLAB: in GraphBLAS/GraphBLAS/GAP (all but CC).
* atomic read/write: faster atomics for icc (see Source/GB_atomics.h)
* install name for Mac: in alternative/Makefile and Tcov/Makefile
* enable -DGBCOMPACT from CMake: for faster Travis builds
* MATLAB interface: better error message in GrB.reduce
* MATLAB triangle count: added sorting heuristic in GrB.tricount.
* bug fix for GraphBLAS/Demo/simple_timer: better selection of which
timer to use; simple_timer.[ch] made consistent.
* no bug fixes needed in primary GraphBLAS library: just in Demo, test,
and alternative/Makefile.

Version 3.2.0, Feb 20, 2020

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

Version 3.1.2, Dec 16, 2019

Expand Down
Binary file modified Doc/GraphBLAS_UserGuide.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions Doc/GraphBLAS_version.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% version of SuiteSparse:GraphBLAS
\date{VERSION
3.2.0,
Feb 20, 2020}
3.2.1,
Mar 10, 2020}

3 changes: 3 additions & 0 deletions GraphBLAS/@GrB/private/mexfunctions/gbvreduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ void mexFunction
OK (GxB_Matrix_type (&atype, A)) ;
if (C != NULL)
{
CHECK_ERROR (C->is_hyper, "Cin cannot be hypersparse") ;
CHECK_ERROR (!(C->is_csc), "Cin must be stored by column") ;
CHECK_ERROR (!GB_VECTOR_OK (C), "Cin must be a column vector") ;
OK (GxB_Matrix_type (&ctype, C)) ;
}

Expand Down
65 changes: 59 additions & 6 deletions GraphBLAS/@GrB/tricount.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function s = tricount (A, check)
function s = tricount (A, arg2, arg3)
%GRB.TRICOUNT count triangles in a matrix.
% s = GrB.tricount (A) counts the number of triangles in the matrix A.
% spones (A) must be symmetric; results are undefined if spones (A) is
Expand All @@ -7,22 +7,75 @@
% To check the input matrix A, use GrB.tricount (A, 'check'). This check
% takes additional time so by default the input is not checked.
%
% See also GrB.ktruss.
% If d is a vector of length n with d(i) equal to the degree of node i,
% then s = tricount (A, d) can be used. Otherwise, tricount must compute
% the degrees first.
%
% See also GrB.ktruss, GrB.entries.
%
% ADDED: sort if warranted. See LAGraph_tricount.

[m, n] = size (A) ;
if (m ~= n)
gb_error ('A must be square') ;
end
if (nargin < 2)
check = false ;
else
check = isequal (check, 'check') ;

d = [ ] ;
check = false ;

if (nargin == 2)
if (ischar (arg2))
% s = tricount (A, 'check')
check = isequal (arg2, 'check') ;
else
% s = tricount (A, d)
d = arg2 ;
end
elseif (nargin == 3)
if (ischar (arg2))
% s = tricount (A, 'check', d)
check = isequal (arg2, 'check') ;
d = arg3 ;
else
% s = tricount (A, d, 'check')
d = arg2 ;
check = isequal (arg3, 'check') ;
end
end

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

if (isequal (class (d), 'GrB'))
d = double (d) ;
end

% determine if A should be sorted first
if (n > 1000 && GrB.entries (A) >= 10*n)
if (isempty (d))
% compute the degree of each node, if not provided on input
if (GrB.isbyrow (A))
d = double (GrB.entries (A, 'row', 'degree')) ;
else
d = double (GrB.entries (A, 'col', 'degree')) ;
end
end
% sample the degree
p = randperm (n, 1000) ;
sample = d (randperm (n, 1000)) ;
dmean = full (mean (sample)) ;
dmed = full (median (sample)) ;
% fprintf ('mean degree: %g median: %g\n', dmean, dmed) ;
if (dmean > 4 * dmed)
% sort if the average degree is very high compared to the median
% fprintf ('sorting A first\n') ;
[~, p] = sort (d, 'descend') ;
A = A (p,p) ;
clear p
end
end

% C, L, and U will have the same format as A
C = GrB (n, n, 'int64', GrB.format (A)) ;
L = tril (A, -1) ;
Expand Down
20 changes: 12 additions & 8 deletions GraphBLAS/GAP/Contents.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
% GAP: GAP benchmark methods in MATLAB (in progress)
%
% Files
% gap - run GAP benchmarks
% gap_bfs - run bfs for the GAP benchmark
% gap_pagerank - PageRank of a graph (GAP benchmark algorithm)
% gap_pr - run pagerank for the GAP benchmark
% gap_tc - run tricount for the GAP benchmark
% tric - triangle countting tests
% ttest - run triangle counting tests
% gap - run 5 GAP benchmarks (BFS, PR, BC, TC, SSSP; not CC)
% gap_bfs - run bfs for the GAP benchmark
% gap_pr - run pagerank for the GAP benchmark
% gap_pagerank - PageRank of a graph (GAP benchmark algorithm)
% gap_tc - run tricount for the GAP benchmark
% tric - triangle counting tests
% ttest - run triangle counting tests
% gap_bc - run centrality for the GAP benchmark
% gap_centrality - batch betweenness centrality of a graph, via GraphBLAS
% gap_sssp12c - single source shortest path, via delta stepping, for GAP
% gap_sssp12 - single source shortest path, via delta stepping, for GAP
% gap_sssp - run SSSP for the GAP benchmark

% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2020, All Rights Reserved.
% http://suitesparse.com See GraphBLAS/Doc/License.txt for license.
8 changes: 8 additions & 0 deletions GraphBLAS/GAP/bctest.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

s = [20 34 14 51] ;
Prob = ssget ('HB/west0067') ;
A = GrB (Prob.A, 'by row') ;
A = GrB (A, 'logical')

c = gap_centrality (s, A)

17 changes: 17 additions & 0 deletions GraphBLAS/GAP/cover.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
%%GraphBLAS GrB_INT32
% Matrix from the cover of "Graph Algorithms in the Language of Linear
% Algebra", Kepner and Gilbert. Note that cover shows A'. This is A.
7 7 12
4 1 4
1 2 2
4 3 1
6 3 5
7 3 9
1 4 7
7 4 1
2 5 5
7 5 1
3 6 1
5 6 7
2 7 8
Loading

0 comments on commit 13f961b

Please sign in to comment.