From e31610785d29f55eec2f33134d6d2500396bcade Mon Sep 17 00:00:00 2001 From: Tim Davis Date: Fri, 26 Nov 2021 22:21:01 -0600 Subject: [PATCH] test coverage for CC_FASTSV6 --- src/algorithm/LG_CC_FastSV6.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/algorithm/LG_CC_FastSV6.c b/src/algorithm/LG_CC_FastSV6.c index 43c8bdf600..bd39b87c54 100644 --- a/src/algorithm/LG_CC_FastSV6.c +++ b/src/algorithm/LG_CC_FastSV6.c @@ -198,7 +198,15 @@ int LG_CC_FastSV6 // SuiteSparse:GraphBLAS method, with GxB extensions GrB_IndexUnaryOp ramp ; GrB_Semiring min_2nd, min_2ndi ; GrB_BinaryOp min, ne, imin ; - if (n > INT32_MAX) + #ifdef COVERAGE + // Just for test coverage, use 64-bit ints for n > 100. Do not use this + // rule in production! + #define NBIG 100 + #else + // For production use: 64-bit integers if n > 2^31 + #define NBIG INT32_MAX + #endif + if (n > NBIG) { // use 64-bit integers throughout Uint = GrB_UINT64 ; @@ -223,9 +231,10 @@ int LG_CC_FastSV6 // SuiteSparse:GraphBLAS method, with GxB extensions min_2ndi = GxB_MIN_SECONDI_INT32 ; } - // FASTSV_SAMPLES: number of samples to take from each row A(i,:) + // FASTSV_SAMPLES: number of samples to take from each row A(i,:). + // Sampling is used if the average degree is > 8 and if n > 1024. #define FASTSV_SAMPLES 4 - bool sampling = (n * FASTSV_SAMPLES * 2 < nnz && n > 1024) ; + bool sampling = (nnz > n * FASTSV_SAMPLES * 2 && n > 1024) ; // determine # of threads to use int nthreads ; @@ -273,7 +282,9 @@ int LG_CC_FastSV6 // SuiteSparse:GraphBLAS method, with GxB extensions GrB_TRY (GrB_free (&y)) ; // copy parent into gp, mngp, and Px. Px is a non-opaque 64-bit copy of the - // parent GrB_Vector. If parent is uint32, GraphBLAS typecasts to uint64. + // parent GrB_Vector. The Px array is always of type GrB_Index since it + // must be used as the input array for extractTuples and as Ci for pack_CSR. + // If parent is uint32, GraphBLAS typecasts it to the uint64 Px array. GrB_TRY (GrB_Vector_extractTuples (NULL, Px, &n, parent)) ; GrB_TRY (GrB_Vector_dup (&gp, parent)) ; GrB_TRY (GrB_Vector_dup (&mngp, parent)) ;