From fedefa2eccc6ba47a9762304b8770dbf5e16da49 Mon Sep 17 00:00:00 2001 From: Daniel Seemaier Date: Wed, 25 Sep 2024 09:42:39 +0200 Subject: [PATCH] fix(common): is_span() return'd wrong value when using the overcommit tag --- kaminpar-common/datastructures/static_array.h | 2 +- .../initial_partitioning/initial_coarsener.cc | 2 +- .../sequential_graph_hierarchy.cc | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/kaminpar-common/datastructures/static_array.h b/kaminpar-common/datastructures/static_array.h index 9303b4b0..64f2a586 100644 --- a/kaminpar-common/datastructures/static_array.h +++ b/kaminpar-common/datastructures/static_array.h @@ -197,7 +197,7 @@ template class StaticArray { } [[nodiscard]] bool is_span() const { - return _owned_data.get() == nullptr; + return _owned_data.get() == nullptr && _overcommited_data.get() == nullptr; } // diff --git a/kaminpar-shm/initial_partitioning/initial_coarsener.cc b/kaminpar-shm/initial_partitioning/initial_coarsener.cc index cf01e97b..dc58d469 100644 --- a/kaminpar-shm/initial_partitioning/initial_coarsener.cc +++ b/kaminpar-shm/initial_partitioning/initial_coarsener.cc @@ -246,7 +246,7 @@ InitialCoarsener::ContractionResult InitialCoarsener::contract_current_clusterin std::fill(_cluster_sizes.begin(), _cluster_sizes.begin() + n, 0); std::fill(_leader_node_mapping.begin(), _leader_node_mapping.begin() + n, 0); - // Note:_clustering does not need to be cleared + // Note: _clustering does not need to be cleared _timings.contract_ms += timer.elapsed(); diff --git a/kaminpar-shm/initial_partitioning/sequential_graph_hierarchy.cc b/kaminpar-shm/initial_partitioning/sequential_graph_hierarchy.cc index 96a4188d..7f982872 100644 --- a/kaminpar-shm/initial_partitioning/sequential_graph_hierarchy.cc +++ b/kaminpar-shm/initial_partitioning/sequential_graph_hierarchy.cc @@ -24,6 +24,23 @@ void SequentialGraphHierarchy::init(const CSRGraph &graph) { void SequentialGraphHierarchy::push(CSRGraph &&c_graph, StaticArray &&c_mapping) { KASSERT(current().n() == c_mapping.size()); + KASSERT( + !c_graph.raw_nodes().is_span(), + "span-based coarse graph should not be used with the sequential graph hierarchy" + ); + KASSERT( + !c_graph.raw_edges().is_span(), + "span-based coarse graph should not be used with the sequential graph hierarchy" + ); + KASSERT( + !c_graph.raw_node_weights().is_span(), + "span-based coarse graph should not be used with the sequential graph hierarchy" + ); + KASSERT( + !c_graph.raw_edge_weights().is_span(), + "span-based coarse graph should not be used with the sequential graph hierarchy" + ); + _coarse_mappings.push_back(std::move(c_mapping)); _coarse_graphs.push_back(std::move(c_graph)); }