Skip to content

Commit

Permalink
use work stealing in compaction (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerzinn authored Apr 14, 2024
1 parent 2785392 commit 0b435d8
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions libgalois/include/galois/graphs/LS_LC_CSR_Graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,20 @@ class LS_LC_CSR_Graph : private boost::noncopyable {
using std::swap;

// move from buffer 0 to buffer 1
galois::do_all(galois::iterate(vertices().begin(), vertices().end()),
[&](VertexTopologyID vertex_id) {
VertexMetadata& vertex_meta = m_vertices[vertex_id];

if (vertex_meta.buffer == 0) {
this->addEdgesTopologyOnly<false>(vertex_id, {});
}

// we are about to swap the buffers, so all vertices will
// be in buffer 0
vertex_meta.buffer = 0;
});
galois::do_all(
galois::iterate(vertices().begin(), vertices().end()),
[&](VertexTopologyID vertex_id) {
VertexMetadata& vertex_meta = m_vertices[vertex_id];

if (vertex_meta.buffer == 0) {
this->addEdgesTopologyOnly<false>(vertex_id, {});
}

// we are about to swap the buffers, so all vertices will
// be in buffer 0
vertex_meta.buffer = 0;
},
galois::steal());

// At this point, there are no more live edges in buffer 0.
m_edges_lock.lock();
Expand Down

0 comments on commit 0b435d8

Please sign in to comment.