Skip to content

Commit

Permalink
Merge branch 'dsalwasser/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSeemaier committed Sep 16, 2024
2 parents 9eecdd9 + fd58dad commit 3518897
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
10 changes: 10 additions & 0 deletions apps/io/dist_skagen.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*******************************************************************************
* Utilities for graph generation with streaming KaGen.
*
* @file: dist_skagen.h
* @author: Daniel Salwasser
* @date: 13.07.2024
******************************************************************************/
#include "apps/io/dist_skagen.h"

#include <limits>
Expand Down Expand Up @@ -129,6 +136,9 @@ DistributedCSRGraph csr_streaming_generate(

const EdgeID num_local_edges = current_edge;
StaticArray<NodeID> wrapped_edges(num_local_edges, std::move(edges_ptr));
if constexpr (kHeapProfiling) {
heap_profiler::HeapProfiler::global().record_alloc(edges, num_local_edges * sizeof(NodeID));
}

StaticArray<GlobalEdgeID> edge_distribution(size + 1);
edge_distribution[rank] = num_local_edges;
Expand Down
7 changes: 7 additions & 0 deletions apps/io/dist_skagen.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*******************************************************************************
* Utilities for graph generation with streaming KaGen.
*
* @file: dist_skagen.h
* @author: Daniel Salwasser
* @date: 13.07.2024
******************************************************************************/
#pragma once

#include <string>
Expand Down
2 changes: 0 additions & 2 deletions kaminpar-common/datastructures/binary_heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include <utility>
#include <vector>

#include <tbb/parallel_for.h>

#include "kaminpar-common/assert.h"
#include "kaminpar-common/datastructures/scalable_vector.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,16 @@ std::unique_ptr<CoarseGraph> contract_clustering_buffered(
const EdgeID c_m = c_nodes.back();

START_HEAP_PROFILER("Coarse graph edges allocation");
RECORD("c_edges") StaticArray<NodeID> finalized_c_edges(c_m, std::move(c_edges));
RECORD("c_edge_weights")
StaticArray<EdgeWeight> finalized_c_edge_weights(c_m, std::move(c_edge_weights));
if constexpr (kHeapProfiling) {
heap_profiler::HeapProfiler::global().record_alloc(c_edges.get(), c_m * sizeof(NodeID));
heap_profiler::HeapProfiler::global().record_alloc(
c_edge_weights.get(), c_m * sizeof(EdgeWeight)
);
}

RECORD("c_edges") StaticArray<NodeID> finalized_c_edges(c_m, std::move(c_edges));
RECORD("c_edge_weights")
StaticArray<EdgeWeight> finalized_c_edge_weights(c_m, std::move(c_edge_weights));
STOP_HEAP_PROFILER();

return std::make_unique<CoarseGraphImpl>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,14 @@ std::unique_ptr<CoarseGraph> contract_clustering_unbuffered(
STOP_HEAP_PROFILER();

START_HEAP_PROFILER("Coarse graph edges allocation");
RECORD("c_edges") StaticArray<NodeID> finalized_c_edges(c_m, std::move(c_edges_ptr));
RECORD("c_edge_weights")
StaticArray<EdgeWeight> finalized_c_edge_weights(c_m, std::move(c_edge_weights_ptr));
if constexpr (kHeapProfiling) {
heap_profiler::HeapProfiler::global().record_alloc(c_edges, c_m * sizeof(NodeID));
heap_profiler::HeapProfiler::global().record_alloc(c_edge_weights, c_m * sizeof(EdgeWeight));
}

RECORD("c_edges") StaticArray<NodeID> finalized_c_edges(c_m, std::move(c_edges_ptr));
RECORD("c_edge_weights")
StaticArray<EdgeWeight> finalized_c_edge_weights(c_m, std::move(c_edge_weights_ptr));
STOP_HEAP_PROFILER();

return std::make_unique<CoarseGraphImpl>(
Expand Down
6 changes: 3 additions & 3 deletions kaminpar-shm/initial_partitioning/initial_fm_refiner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ EdgeWeight InitialFMRefiner<QueueSelectionPolicy, CutAcceptancePolicy, StoppingP
EdgeWeight current_delta = 0;
EdgeWeight accepted_delta = 0;
#if KASSERT_ENABLED(ASSERTION_LEVEL_HEAVY)
const EdgeWeight initial_edge_cut = metrics::edge_cut(p_graph);
const EdgeWeight initial_edge_cut = metrics::edge_cut_seq(p_graph);
#endif

DBG << "Starting main refinement loop with #_pq[0]=" << _queues[0].size()
Expand Down Expand Up @@ -274,7 +274,7 @@ EdgeWeight InitialFMRefiner<QueueSelectionPolicy, CutAcceptancePolicy, StoppingP
current_delta += delta;
_moves.push_back(u);
#if KASSERT_ENABLED(ASSERTION_LEVEL_HEAVY)
KASSERT(initial_edge_cut + current_delta == metrics::edge_cut(p_graph), "", assert::heavy);
KASSERT(initial_edge_cut + current_delta == metrics::edge_cut_seq(p_graph), "", assert::heavy);
#endif
_stopping_policy.update(-delta); // assumes gain, not loss
current_overload = metrics::total_overload(p_graph, *_p_ctx);
Expand Down Expand Up @@ -332,7 +332,7 @@ EdgeWeight InitialFMRefiner<QueueSelectionPolicy, CutAcceptancePolicy, StoppingP

#if KASSERT_ENABLED(ASSERTION_LEVEL_HEAVY)
KASSERT(!initially_feasible || accepted_delta <= 0);
KASSERT(metrics::edge_cut(p_graph) == initial_edge_cut + accepted_delta);
KASSERT(metrics::edge_cut_seq(p_graph) == initial_edge_cut + accepted_delta);
#endif

return accepted_delta;
Expand Down
2 changes: 1 addition & 1 deletion kaminpar-shm/partitioning/helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ PartitionedGraph bipartition(
bipartitioner.partition(timings ? &(timings->ip_timings) : nullptr).take_raw_partition();

if (partition_lifespan) {
StaticArray<BlockID> owned_bipartition(bipartition.size());
StaticArray<BlockID> owned_bipartition(bipartition.size(), static_array::noinit);
std::copy(bipartition.begin(), bipartition.end(), owned_bipartition.begin());

initial_bipartitioner_pool.put(std::move(bipartitioner));
Expand Down

0 comments on commit 3518897

Please sign in to comment.