Skip to content

Commit

Permalink
replace memcpy with loop in LAGraph FastSV methods
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Oct 28, 2023
1 parent 0cfb8c4 commit 16f137a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
13 changes: 11 additions & 2 deletions LAGraph/experimental/algorithm/LG_CC_FastSV5.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,17 @@ int LG_CC_FastSV5 // SuiteSparse:GraphBLAS method, with GxB extensions
GrB_Index offset = 0 ;
for (tid = 0 ; tid < nthreads ; tid++)
{
memcpy (Tj + offset, Tj + Tp [range [tid]],
sizeof (GrB_Index) * count [tid]) ;

// memcpy (Tj + offset, Tj + Tp [range [tid]],
// sizeof (GrB_Index) * count [tid]) ;

GrB_Index *Tj_dest = Tj + offset ;
GrB_Index *Tj_src = Tj + Tp [range [tid]] ;
for (int64_t k = 0 ; k < count [tid] ; k++)
{
Tj_dest [k] = Tj_src [k] ;
}

offset += count [tid] ;
count [tid] = offset - count [tid] ;
}
Expand Down
12 changes: 10 additions & 2 deletions LAGraph/src/algorithm/LG_CC_FastSV6.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,16 @@ printf ("did prune T\n") ; fflush (stdout) ; fflush (stderr) ;
nvals = 0 ;
for (tid = 0 ; tid < nthreads ; tid++)
{
memcpy (Tj + nvals, Tj + Tp [range [tid]],
sizeof (GrB_Index) * count [tid]) ;

// memcpy (Tj + nvals, Tj + Tp [range [tid]],
// sizeof (GrB_Index) * count [tid]) ;
GrB_Index *Tj_dest = Tj + nvals ;
GrB_Index *Tj_src = Tj + Tp [range [tid]] ;
for (int64_t k = 0 ; k < count [tid] ; k++)
{
Tj_dest [k] = Tj_src [k] ;
}

nvals += count [tid] ;
count [tid] = nvals - count [tid] ;
}
Expand Down

0 comments on commit 16f137a

Please sign in to comment.