Skip to content

Commit a9bc838

Browse files
committed
Sync v1.2 branch, get new commits
2 parents 5cf40c5 + 916c60e commit a9bc838

34 files changed

+2095
-208
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" )
247247
#if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0 )
248248
# message ( FATAL_ERROR "icc version must be at least 18.0" )
249249
#endif ( )
250+
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang" )
251+
# options for Apple Clang
252+
# FIXME
253+
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" )
254+
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread" )
250255
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" )
251256
# options for clang
252257
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 " )

experimental/algorithm/LAGr_MarkovClustering.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
GrB_free(c_f); \
4242
}
4343

44-
#define DEBUG
45-
4644
#include "LG_internal.h"
4745
#include <LAGraphX.h>
4846

@@ -205,7 +203,7 @@ int LAGr_MarkovClustering(
205203
GRB_TRY(GrB_Vector_nvals(&p_nvals, argmax_p));
206204
LG_TRY(LAGraph_Malloc((void **)&pi, p_nvals, sizeof(GrB_Index), msg));
207205
LG_TRY(LAGraph_Malloc((void **)&px, p_nvals, sizeof(GrB_Index), msg));
208-
GRB_TRY(GrB_Vector_extractTuples_INT64(pi, px, &p_nvals, argmax_p));
206+
GRB_TRY(GrB_Vector_extractTuples_INT64(pi, (int64_t *) px, &p_nvals, argmax_p));
209207

210208
// Sometimes (particularly, when the pruning threshold is high), some
211209
// columns in the steady-state T have no values, i.e., they are not
@@ -259,7 +257,7 @@ int LAGr_MarkovClustering(
259257

260258
GrB_Vector c = NULL;
261259
GRB_TRY(GrB_Vector_new(&c, GrB_INT64, n));
262-
GRB_TRY(GrB_Vector_build_INT64(c, pi, px, n, NULL));
260+
GRB_TRY(GrB_Vector_build_INT64(c, pi, (int64_t *) px, n, NULL));
263261
GrB_Vector_wait(c, GrB_MATERIALIZE);
264262

265263
LAGraph_Free((void *)&pi, NULL);

experimental/algorithm/LAGr_Modularity.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int LAGr_Modularity(
126126
GrB_Index *cI, *cX;
127127
LAGRAPH_TRY(LAGraph_Malloc((void **)&cI, n, sizeof(GrB_Index), msg));
128128
LAGRAPH_TRY(LAGraph_Malloc((void **)&cX, n, sizeof(GrB_Index), msg));
129-
GRB_TRY(GrB_Vector_extractTuples_INT64(cI, cX, &n, c));
129+
GRB_TRY(GrB_Vector_extractTuples_INT64(cI, (int64_t *) cX, &n, c));
130130
GRB_TRY(GxB_Matrix_build_Scalar(C, cX, cI, ONE_INT64, n));
131131
GrB_Matrix_wait(C, GrB_MATERIALIZE);
132132
LAGraph_Free((void **)&cI, NULL);
@@ -183,9 +183,9 @@ int LAGr_Modularity(
183183
LAGraph_Malloc((void **)&k_outX, nclusters, sizeof(GrB_Index), msg));
184184
LAGRAPH_TRY(
185185
LAGraph_Malloc((void **)&k_inX, nclusters, sizeof(GrB_Index), msg));
186-
GRB_TRY(GrB_Vector_extractTuples_INT64(NULL, lX, &nclusters, l));
187-
GRB_TRY(GrB_Vector_extractTuples_INT64(NULL, k_outX, &nclusters, k_out));
188-
GRB_TRY(GrB_Vector_extractTuples_INT64(NULL, k_inX, &nclusters, k_in));
186+
GRB_TRY(GrB_Vector_extractTuples_INT64(NULL, (int64_t *) lX, &nclusters, l));
187+
GRB_TRY(GrB_Vector_extractTuples_INT64(NULL, (int64_t *) k_outX, &nclusters, k_out));
188+
GRB_TRY(GrB_Vector_extractTuples_INT64(NULL, (int64_t *) k_inX, &nclusters, k_in));
189189

190190
GrB_Index m, out_degree_sum, in_degree_sum, L_c;
191191
GRB_TRY(GrB_reduce(&out_degree_sum, NULL, GrB_PLUS_MONOID_INT64, out_degree,

experimental/algorithm/LAGr_PartitionQuality.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
LG_FREE_WORK; \
4545
}
4646

47-
#define DEBUG 0
48-
4947
#include "LG_internal.h"
5048
#include <LAGraphX.h>
5149

@@ -89,7 +87,7 @@ int LAGr_PartitionQuality(
8987
// Delete self-edges, not relevant to these clustering metrics
9088
GRB_TRY(GrB_select(A, NULL, NULL, GrB_OFFDIAG, A, 0, NULL));
9189

92-
#if DEBUG
90+
#if 0
9391
FILE *f = fopen("./data/pp_sanitized_data.mtx", "w");
9492
LAGRAPH_TRY(LAGraph_MMWrite(A, f, NULL, msg));
9593
fclose(f);
@@ -111,7 +109,7 @@ int LAGr_PartitionQuality(
111109
GrB_Index *cI, *cX;
112110
LAGRAPH_TRY(LAGraph_Malloc((void **)&cI, n, sizeof(GrB_Index), msg));
113111
LAGRAPH_TRY(LAGraph_Malloc((void **)&cX, n, sizeof(GrB_Index), msg));
114-
GRB_TRY(GrB_Vector_extractTuples_INT64(cI, cX, &n, c));
112+
GRB_TRY(GrB_Vector_extractTuples_INT64(cI, (int64_t *) cX, &n, c));
115113
GRB_TRY(GxB_Matrix_build_Scalar(C, cX, cI, ONE_INT64, n));
116114
GrB_Matrix_wait(C, GrB_MATERIALIZE);
117115
LAGraph_Free((void **)&cI, NULL);

experimental/algorithm/LAGr_PeerPressureClustering.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
GrB_free(c_f); \
4949
}
5050

51-
#define DEBUG
52-
5351
#include "LG_internal.h"
5452
#include <LAGraphX.h>
5553

@@ -203,7 +201,7 @@ int LAGr_PeerPressureClustering(
203201
GrB_vxm(m_index, NULL, NULL, GxB_MIN_SECONDI_INT64, ones, E, NULL));
204202
// m_index_values(i) = argmax(T(:, i))
205203
GRB_TRY(
206-
GrB_Vector_extractTuples_INT64(NULL, m_index_values, &n, m_index));
204+
GrB_Vector_extractTuples_INT64(NULL, (int64_t *) m_index_values, &n, m_index));
207205
GRB_TRY(GrB_Matrix_new(&C_temp, GrB_BOOL, n, n));
208206
GRB_TRY(GrB_extract(C_temp, NULL, NULL, I, GrB_ALL, n, m_index_values,
209207
n, NULL));

experimental/algorithm/LAGr_TriangleCount_GPU.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,12 @@ void dump_matrix (GrB_Matrix C, char *filename)
125125
int64_t *I = malloc ((cnvals+1) * sizeof (int64_t)) ;
126126
int64_t *J = malloc ((cnvals+1) * sizeof (int64_t)) ;
127127
int64_t *X = malloc ((cnvals+1) * sizeof (int64_t)) ;
128-
GrB_Matrix_extractTuples_INT64 (I,J,X,&cnvals,C) ;
128+
GrB_Matrix_extractTuples_INT64 ((GrB_Index *) I,(GrB_Index *) J,
129+
X, &cnvals, C) ;
129130
FILE *f = fopen (filename, "w") ;
130131
for (int64_t k = 0 ; k < cnvals ; k++)
131132
{
132-
fprintf (f, "%ld %ld %ld\n", I [k], J [k], X [k]) ;
133+
fprintf (f, "%ld %ld %ld\n", (long) I [k], (long) J [k], (long) X [k]) ;
133134
}
134135
free (I) ;
135136
free (J) ;
@@ -421,10 +422,10 @@ int LAGr_TriangleCount_GPU
421422

422423
t = LAGraph_WallClockTime ( ) ;
423424

424-
dump_matrix (L, "L") ;
425-
dump_matrix (U, "U") ;
425+
// dump_matrix (L, "L") ;
426+
// dump_matrix (U, "U") ;
426427
GRB_TRY (GrB_mxm (C, U, NULL, semiring, U, L, GrB_DESC_ST1)) ;
427-
dump_matrix (C, "C") ;
428+
// dump_matrix (C, "C") ;
428429

429430
GRB_TRY (GrB_reduce (&ntri, NULL, monoid, C, NULL)) ;
430431
t = LAGraph_WallClockTime ( ) - t ;

experimental/algorithm/LAGraph_EstimateDiameter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ int LAGraph_EstimateDiameter
201201

202202
// set up source list for next round
203203
// get the number of peripheral nodes
204-
int64_t nperi = 0;
204+
GrB_Index nperi = 0;
205205
GRB_TRY (GrB_Vector_new (&candidateSrcs, int_type, n)) ;
206206
GRB_TRY (GrB_select(candidateSrcs, NULL, NULL, eqOp, ecc, d, NULL)) ;
207207
GRB_TRY (GrB_Vector_nvals(&nperi, candidateSrcs)) ;

experimental/algorithm/LAGraph_VertexCentrality_Triangle.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
// (this could be modified); results are undefined if this condition doesn't
2525
// hold.
2626

27-
// P. Burkhardt, "Triangle centrality," https://arxiv.org/pdf/2105.00110.pdf,
28-
// April 2021.
27+
// Paul Burkhardt. 2024. Triangle Centrality. ACM Trans. Knowl. Discov. Data
28+
// 18, 9, Article 217 (November 2024), 34 pages.
29+
// https://doi.org/10.1145/3685677
2930

3031
// Method 3 is by far the fastest.
3132

experimental/algorithm/LAGraph_argminmax.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ int argminmax
116116
GrB_Matrix_free (&D) ;
117117
GrB_Matrix_free (&G) ;
118118
GrB_Matrix_free (&y) ;
119+
return (GrB_SUCCESS) ;
119120
}
121+
120122
//------------------------------------------------------------------------------
121123
// gbargminmax: mexFunction to compute the argmin/max of each row/column of A
122124
//------------------------------------------------------------------------------

experimental/benchmark/hdip_fiedler_demo.c

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,6 @@
1111

1212
//------------------------------------------------------------------------------
1313

14-
// This main program is a simple driver for testing and benchmarking the
15-
// LAGraph_HelloWorld "algorithm", in experimental/algorithm. To use it,
16-
// compile LAGraph while in the build folder with these commands:
17-
//
18-
// cd LAGraph/build
19-
// cmake ..
20-
// make -j8
21-
//
22-
// Then run this demo with an input matrix. For example:
23-
//
24-
// ./experimental/benchmark/hellworld_demo ../data/west0067.mtx
25-
// ./experimental/benchmark/hellworld_demo < ../data/west0067.mtx
26-
// ./experimental/benchmark/hellworld_demo ../data/karate.mtx
27-
//
28-
// If you create your own algorithm and want to mimic this main program, call
29-
// it write in experimental/benchmark/whatever_demo.c (with "_demo.c" as the
30-
// end of the filename), and the cmake will find it and compile it.
31-
32-
// This main program makes use of supporting utilities in
33-
// src/benchmark/LAGraph_demo.h and src/utility/LG_internal.h.
34-
// See helloworld2_demo.c for a main program that just uses the
35-
// user-callable methods in LAGraph.h and LAGraphX.h.
36-
3714
#include "../../src/benchmark/LAGraph_demo.h"
3815
#include "LAGraphX.h"
3916
#include "LG_internal.h"
@@ -386,7 +363,7 @@ int main(int argc, char **argv)
386363
}
387364

388365
printf("\n=============================Testing karate lambda:\n");
389-
err = abs(lambda_result - 1.3297);
366+
err = fabs(lambda_result - 1.3297);
390367
if (err < 1e-4)
391368
{
392369
printf("Test passed.\n");
@@ -412,7 +389,7 @@ int main(int argc, char **argv)
412389
}
413390

414391
printf("\n=============================Testing bucky lambda:\n");
415-
err = abs(lambda_result - 0.2434);
392+
err = fabs(lambda_result - 0.2434);
416393
if (err < 1e-4)
417394
{
418395
printf("Test passed.\n");
@@ -438,7 +415,7 @@ int main(int argc, char **argv)
438415
}
439416

440417
printf("\n=============================Testing west0067 lambda:\n");
441-
err = abs(lambda_result - 6.5586);
418+
err = fabs(lambda_result - 6.5586);
442419
if (err < 1e-4)
443420
{
444421
printf("Test passed.\n");

0 commit comments

Comments
 (0)