Skip to content

Commit

Permalink
disable push/pull for BFS_SSGrB, just to compare with vanilla BFS
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Jun 26, 2024
1 parent d71a43f commit d42df5e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/algorithm/LG_BreadthFirstSearch_SSGrB.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ int LG_BreadthFirstSearch_SSGrB

GRB_TRY (GrB_Matrix_nvals (&nvals, A)) ;

#if 0
// HACK for HPEC'24: push/pull disabled to compare with vanilla
GrB_Matrix AT = NULL ;
GrB_Vector Degree = G->out_degree ;
if (G->kind == LAGraph_ADJACENCY_UNDIRECTED ||
Expand All @@ -112,6 +114,7 @@ int LG_BreadthFirstSearch_SSGrB
// direction-optimization requires G->AT (if G is directed) and
// G->out_degree (for both undirected and directed cases)
bool push_pull = (Degree != NULL && AT != NULL) ;
#endif

// determine the semiring type
GrB_Type int_type = (n > INT32_MAX) ? GrB_INT64 : GrB_INT32 ;
Expand Down Expand Up @@ -157,31 +160,43 @@ int LG_BreadthFirstSearch_SSGrB
GRB_TRY (GrB_Vector_new (&w, GrB_INT64, n)) ;

GrB_Index nq = 1 ; // number of nodes in the current level
#if 0
// HACK for HPEC'24: push/pull disabled to compare with vanilla
double alpha = 8.0 ;
double beta1 = 8.0 ;
double beta2 = 512.0 ;
int64_t n_over_beta1 = (int64_t) (((double) n) / beta1) ;
int64_t n_over_beta2 = (int64_t) (((double) n) / beta2) ;
#endif

//--------------------------------------------------------------------------
// BFS traversal and label the nodes
//--------------------------------------------------------------------------

#if 0
// HACK for HPEC'24: push/pull disabled to compare with vanilla
bool do_push = true ; // start with push
GrB_Index last_nq = 0 ;
int64_t edges_unexplored = nvals ;
bool any_pull = false ; // true if any pull phase has been done
#endif

// {!mask} is the set of unvisited nodes
GrB_Vector mask = (compute_parent) ? pi : v ;

#if 0
for (int64_t nvisited = 1, k = 1 ; nvisited < n ; nvisited += nq, k++)
#endif
for (int64_t k = 1 ; ; k++) // HACK for HPEC'24: no push/pull
{

//----------------------------------------------------------------------
// select push vs pull
//----------------------------------------------------------------------

#if 0
// HACK for HPEC'24: push/pull disabled to compare with vanilla

if (push_pull)
{
if (do_push)
Expand Down Expand Up @@ -238,30 +253,41 @@ int LG_BreadthFirstSearch_SSGrB
}
any_pull = any_pull || (!do_push) ;
}
#endif

//----------------------------------------------------------------------
// q = kth level of the BFS
//----------------------------------------------------------------------

// mask is pi if computing parent, v if computing just level
#if 0
// HACK for HPEC'24: do push-only to compare with vanilla
if (do_push)
#endif
{
// push (saxpy-based vxm): q'{!mask} = q'*A
// HACK for HPEC'24: shall I remove this format hint?
GRB_TRY (LG_SET_FORMAT_HINT (q, LG_SPARSE)) ;
GRB_TRY (GrB_vxm (q, mask, NULL, semiring, q, A, GrB_DESC_RSC)) ;
}
#if 0
// HACK for HPEC'24: push/pull disabled to compare with vanilla

else
{
// pull (dot-product-based mxv): q{!mask} = AT*q
GRB_TRY (LG_SET_FORMAT_HINT (q, LG_BITMAP)) ;
GRB_TRY (GrB_mxv (q, mask, NULL, semiring, AT, q, GrB_DESC_RSC)) ;
}
#endif

//----------------------------------------------------------------------
// done if q is empty
//----------------------------------------------------------------------

#if 0
last_nq = nq ;
#endif
GRB_TRY (GrB_Vector_nvals (&nq, q)) ;
if (nq == 0)
{
Expand Down

0 comments on commit d42df5e

Please sign in to comment.