@@ -97,31 +97,19 @@ class LS_LC_CSR_Graph : private boost::noncopyable {
9797 * Prefix Sum utilities
9898 */
9999 std::vector<uint64_t > m_pfx_sum_cache;
100- static uint64_t transmute (const VertexMetadata& vertex_meta) {
101- return vertex_meta.degree ();
102- }
103- static uint64_t scan_op (const VertexMetadata& p, const uint64_t & l) {
104- return p.degree () + l;
105- }
106- static uint64_t combiner (const uint64_t & f, const uint64_t & s) {
107- return f + s;
108- }
109- PrefixSum<VertexMetadata, uint64_t , transmute, scan_op, combiner,
110- CacheLinePaddedArr>
111- m_pfx{&m_vertices[0 ], &m_pfx_sum_cache[0 ]};
112100
113101 alignas (hardware_destructive_interference_size)
114102 std::atomic<bool > m_prefix_valid = ATOMIC_VAR_INIT (false );
115103
116- void resetPrefixSum () {
117- m_pfx_sum_cache.resize (m_vertices.size ());
118- m_pfx.src = &m_vertices[0 ];
119- m_pfx.dst = &m_pfx_sum_cache[0 ];
120- }
104+ void resetPrefixSum () { m_pfx_sum_cache.resize (m_vertices.size ()); }
121105
122106 // Compute the prefix sum using the two level method
123107 void computePrefixSum () {
124- m_pfx.computePrefixSum (m_vertices.size ());
108+ // todo: switch to parallel prefix sum when `galois::PrefixSum` is fixed
109+ std::transform_inclusive_scan (
110+ m_vertices.begin (), m_vertices.end (), m_pfx_sum_cache.begin (),
111+ std::plus<uint64_t >(),
112+ [](VertexMetadata const & v) { return v.degree (); }, 0ul );
125113 m_prefix_valid.store (true , std::memory_order_release);
126114 }
127115
0 commit comments