Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Jan 5, 2025
1 parent b8961ea commit 8c47ddc
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 25 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ check_symbol_exists ( fmax "math.h" NO_LIBM )
# code coverage and build type
#-------------------------------------------------------------------------------

set (CMAKE_C_FLAGS_RELEASE "-O3 -g") # FIXME

# To compile with test coverage:
# cd build
# cmake -DCOVERAGE=1 ..
Expand Down Expand Up @@ -247,6 +249,11 @@ elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" )
#if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0 )
# message ( FATAL_ERROR "icc version must be at least 18.0" )
#endif ( )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang" )
# options for Apple Clang
# FIXME
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" )
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread" )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" )
# options for clang
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 " )
Expand Down
48 changes: 24 additions & 24 deletions experimental/test/test_BF.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ void test_BF (void)
OK (GrB_Matrix_new (&AT, GrB_FP64, ncols, nrows)) ;
OK (GrB_transpose (AT, NULL, NULL, A, NULL)) ;
double transpose_time = LAGraph_WallClockTime ( ) - tt ;
fprintf (stderr, "transpose time: %g\n", transpose_time) ;
// fprintf (stderr, "transpose time: %g\n", transpose_time) ;

//----------------------------------------------------------------------
// get the source node
//----------------------------------------------------------------------

GrB_Index s = 0 ;
fprintf (stderr, "\n==========input graph: nodes: %g edges: %g "
"source node: %g\n", (double) n, (double) nvals, (double) s) ;
// fprintf (stderr, "\n==========input graph: nodes: %g edges: %g "
// "source node: %g\n", (double) n, (double) nvals, (double) s) ;

//----------------------------------------------------------------------
// run 1 or 2 trials (2 negative weight cycles)
Expand Down Expand Up @@ -192,8 +192,8 @@ void test_BF (void)
// stop the timer
t5 = LAGraph_WallClockTime ( ) - t5 ;
t5 = t5 / ntrials;
fprintf (stderr, "BF_full1 time: %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t5, 1e-6*((double) nvals) / t5) ;
// fprintf (stderr, "BF_full1 time: %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t5, 1e-6*((double) nvals) / t5) ;

//------------------------------------------------------------------
// run LAGraph_BF_full1a before setting the diagonal to 0
Expand All @@ -214,8 +214,8 @@ void test_BF (void)
// stop the timer
t5a = LAGraph_WallClockTime ( ) - t5a ;
t5a = t5a / ntrials;
fprintf (stderr, "BF_full1a time: %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t5a, 1e-6*((double) nvals) / t5a) ;
// fprintf (stderr, "BF_full1a time: %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t5a, 1e-6*((double) nvals) / t5a) ;

//------------------------------------------------------------------
// run LAGraph_BF_full2 before setting the diagonal to 0
Expand All @@ -236,8 +236,8 @@ void test_BF (void)
// stop the timer
t6 = LAGraph_WallClockTime ( ) - t6 ;
t6 = t6 / ntrials;
fprintf (stderr, "BF_full2 time: %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t6, 1e-6*((double) nvals) / t6) ;
// fprintf (stderr, "BF_full2 time: %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t6, 1e-6*((double) nvals) / t6) ;

//------------------------------------------------------------------
// run the LAGraph_BF_full on node s
Expand All @@ -259,9 +259,9 @@ void test_BF (void)
// stop the timer
t1 = LAGraph_WallClockTime ( ) - t1 ;
t1 = t1 / ntrials;
fprintf (stderr, "BF_full time: %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t1, 1e-6*((double) nvals) / t1) ;
fprintf (stderr, "t(BF_full1) / t(BF_full): %g\n", t5/t1) ;
// fprintf (stderr, "BF_full time: %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t1, 1e-6*((double) nvals) / t1) ;
// fprintf (stderr, "t(BF_full1) / t(BF_full): %g\n", t5/t1) ;

//------------------------------------------------------------------
// run the BF on node s with LAGraph_BF_basic
Expand All @@ -280,9 +280,9 @@ void test_BF (void)
// stop the timer
t2 = LAGraph_WallClockTime ( ) - t2 ;
t2 = t2 / ntrials;
fprintf (stderr, "BF_basic time: %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t2, 1e-6*((double) nvals) / t2) ;
fprintf (stderr, "speedup of BF_basic: %g\n", t1/t2) ;
// fprintf (stderr, "BF_basic time: %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t2, 1e-6*((double) nvals) / t2) ;
// fprintf (stderr, "speedup of BF_basic: %g\n", t1/t2) ;

//------------------------------------------------------------------
// run the BF on node s with LAGraph_pure_c
Expand All @@ -303,9 +303,9 @@ void test_BF (void)
// stop the timer
t3 = LAGraph_WallClockTime ( ) - t3 ;
t3 = t3 / ntrials;
fprintf (stderr, "BF_pure_c_double : %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t3, 1e-6*((double) nvals) / t3) ;
fprintf (stderr, "speedup of BF_pure_c: %g\n", t1/t3) ;
// fprintf (stderr, "BF_pure_c_double : %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t3, 1e-6*((double) nvals) / t3) ;
// fprintf (stderr, "speedup of BF_pure_c: %g\n", t1/t3) ;

if (has_integer_weights)
{
Expand Down Expand Up @@ -337,9 +337,9 @@ void test_BF (void)
// stop the timer
t4 = LAGraph_WallClockTime ( ) - t4 ;
t4 = t4 / ntrials;
fprintf (stderr, "BF_full_mxv time: %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t4, 1e-6*((double) nvals) / t4) ;
fprintf (stderr, "speedup of BF_full_mxv: %g\n", t1/t4) ;
// fprintf (stderr, "BF_full_mxv time: %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t4, 1e-6*((double) nvals) / t4) ;
// fprintf (stderr, "speedup of BF_full_mxv: %g\n", t1/t4) ;

//------------------------------------------------------------------
// run the BF on node s with LAGraph_BF_basic_mxv
Expand All @@ -358,9 +358,9 @@ void test_BF (void)
// stop the timer
t7 = LAGraph_WallClockTime ( ) - t7 ;
t7 = t7 / ntrials;
fprintf (stderr, "BF_basic_mxv time: %12.6e (sec), rate:"
" %g (1e6 edges/sec)\n", t7, 1e-6*((double) nvals) / t7) ;
fprintf (stderr, "speedup of BF_basic_mxv: %g\n", t1/t7) ;
// fprintf (stderr, "BF_basic_mxv time: %12.6e (sec), rate:"
// " %g (1e6 edges/sec)\n", t7, 1e-6*((double) nvals) / t7) ;
// fprintf (stderr, "speedup of BF_basic_mxv: %g\n", t1/t7) ;

//------------------------------------------------------------------
// run the BF on node s with LAGraph_BF_basic_pushpull
Expand Down
2 changes: 2 additions & 0 deletions experimental/test/test_SquareClustering.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ bool is_close (double a, double b)
void test_SquareClustering (void)
{
LAGraph_Init (msg) ;
GrB_set (GrB_GLOBAL, true, GxB_BURBLE) ;


GrB_Matrix A = NULL ;
LAGraph_Graph G = NULL ;
Expand Down
4 changes: 3 additions & 1 deletion experimental/test/test_cdlp.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ void test_cdlp (void)

// compute the communities with LAGraph_cdlp
OK (LAGraph_cdlp (&c, G, 100, msg)) ;

GrB_Index n ;
OK (GrB_Vector_size (&n, c)) ;
LAGraph_PrintLevel pr = (n <= 100) ? LAGraph_COMPLETE : LAGraph_SHORT ;
printf ("\ncdlp (computed result):\n") ;
OK (LAGraph_Vector_Print (c, pr, stdout, msg)) ;

// compute with another method
GrB_Vector cgood = NULL ;
OK (LAGraph_cdlp_withsort(&cgood, G, 100, msg)) ;
OK (GrB_wait (cgood, GrB_MATERIALIZE)) ;
Expand Down

0 comments on commit 8c47ddc

Please sign in to comment.