From bb0c14dc856b78d5715c73721ab83804185646ea Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Mon, 10 Nov 2025 15:10:16 +0100 Subject: [PATCH 01/20] added compiler warning flags --- CMakeLists.txt | 9 +++++++++ .../osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp | 2 +- .../osp/graph_algorithms/directed_graph_path_util.hpp | 2 +- .../computational_dag_edge_idx_vector_impl.hpp | 8 ++++---- .../adj_list_impl/computational_dag_vector_impl.hpp | 8 ++++---- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 412ca43c..8f5f07c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,15 @@ set(COMMON_CXX_WARNING_FLAGS "-Wunused" "-Wunreachable-code" "-Wuninitialized" + "-Wshadow" + "-Wfloat-equal" + "-Wnon-virtual-dtor" + "-pedantic" + "-Wpedantic" + "-Wold-style-cast" + "-Wcast-align" + "-Wduplicated-cond" + "-Wduplicated-branches" "-Werror" ) diff --git a/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp b/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp index 4f9ed81e..2d2edec3 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp @@ -346,7 +346,7 @@ class BspLocking : public Scheduler { std::vector> procReady(params_p); std::set allReady; - std::vector nrPredecDone(N, 0); + std::vector nrPredecDone(N, 0); std::vector procFree(params_p, true); unsigned free = params_p; diff --git a/include/osp/graph_algorithms/directed_graph_path_util.hpp b/include/osp/graph_algorithms/directed_graph_path_util.hpp index 6b85d3be..ee6e972d 100644 --- a/include/osp/graph_algorithms/directed_graph_path_util.hpp +++ b/include/osp/graph_algorithms/directed_graph_path_util.hpp @@ -335,7 +335,7 @@ std::vector get_strict_poset_integer_map(unsigned const noise, double const int temp = new_top[source(edge, graph)]; if (up_or_down.at(edge)) { - if (poisson_param == 0.0) { + if (poisson_param <= 0.0) { temp += 1; } else { temp += 1 + poisson_gen(gen); diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp index 2544ef1f..103d895f 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp @@ -149,8 +149,8 @@ class computational_dag_edge_idx_vector_impl { virtual ~computational_dag_edge_idx_vector_impl() = default; - inline std::size_t num_edges() const { return edges_.size(); } - inline std::size_t num_vertices() const { return vertices_.size(); } + inline vertex_idx num_edges() const { return edges_.size(); } + inline vertex_idx num_vertices() const { return vertices_.size(); } inline auto edges() const { return edge_range_vector_impl(*this); } @@ -162,8 +162,8 @@ class computational_dag_edge_idx_vector_impl { inline const std::vector &in_edges(vertex_idx v) const { return in_edges_[v]; } inline const std::vector &out_edges(vertex_idx v) const { return out_edges_[v]; } - inline std::size_t in_degree(vertex_idx v) const { return in_edges_[v].size(); } - inline std::size_t out_degree(vertex_idx v) const { return out_edges_[v].size(); } + inline vertex_idx in_degree(vertex_idx v) const { return in_edges_[v].size(); } + inline vertex_idx out_degree(vertex_idx v) const { return out_edges_[v].size(); } inline edge_comm_weight_type edge_comm_weight(directed_edge_descriptor e) const { return edges_[e.idx].comm_weight; diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp index a54eb710..65deb91a 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp @@ -117,17 +117,17 @@ class computational_dag_vector_impl { inline auto vertices() const { return vertex_range(static_cast(vertices_.size())); } - inline std::size_t num_vertices() const { return vertices_.size(); } + inline vertex_idx num_vertices() const { return vertices_.size(); } - inline std::size_t num_edges() const { return num_edges_; } + inline vertex_idx num_edges() const { return num_edges_; } inline const std::vector &parents(const vertex_idx v) const { return in_neigbors[v]; } inline const std::vector &children(const vertex_idx v) const { return out_neigbors[v]; } - inline std::size_t in_degree(const vertex_idx v) const { return in_neigbors[v].size(); } + inline vertex_idx in_degree(const vertex_idx v) const { return in_neigbors[v].size(); } - inline std::size_t out_degree(const vertex_idx v) const { return out_neigbors[v].size(); } + inline vertex_idx out_degree(const vertex_idx v) const { return out_neigbors[v].size(); } inline vertex_work_weight_type vertex_work_weight(const vertex_idx v) const { return vertices_[v].work_weight; } From ac956c154aae67259638445e24b2f5488a262103 Mon Sep 17 00:00:00 2001 From: Raphael Steiner Date: Mon, 10 Nov 2025 15:43:53 +0100 Subject: [PATCH 02/20] virtual destructors and some float compare --- include/osp/auxiliary/Balanced_Coin_Flips.hpp | 2 ++ .../bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp | 2 +- .../osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp | 2 +- .../LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp | 2 +- .../LoadBalanceScheduler/VariancePartitioner.hpp | 2 +- .../LocalSearch/KernighanLin/kl_current_schedule.hpp | 6 ++++-- .../LocalSearch/KernighanLin_v2/kl_active_schedule.hpp | 2 +- .../scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp | 8 ++++---- include/osp/graph_algorithms/directed_graph_top_sort.hpp | 4 ++-- .../adj_list_impl/compact_sparse_graph.hpp | 4 ++-- .../osp/partitioning/partitioners/partitioning_ILP.hpp | 2 +- .../partitioning/partitioners/partitioning_ILP_base.hpp | 2 ++ .../partitioners/partitioning_ILP_replication.hpp | 2 +- 13 files changed, 23 insertions(+), 17 deletions(-) diff --git a/include/osp/auxiliary/Balanced_Coin_Flips.hpp b/include/osp/auxiliary/Balanced_Coin_Flips.hpp index d40124f1..7443719b 100644 --- a/include/osp/auxiliary/Balanced_Coin_Flips.hpp +++ b/include/osp/auxiliary/Balanced_Coin_Flips.hpp @@ -33,6 +33,8 @@ class BalancedCoinFlips { /// @brief Returns true/false in a pseudo-random balanced manner /// @return true/false virtual bool get_flip() = 0; + + virtual ~BalancedCoinFlips() = default; }; class Biased_Random : public BalancedCoinFlips { diff --git a/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp b/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp index 99bc6c3c..27489355 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp @@ -65,7 +65,7 @@ class GreedyBspScheduler : public Scheduler { heap_node(VertexType node, double score) : node(node), score(score) {} bool operator<(heap_node const &rhs) const { - return (score < rhs.score) || (score == rhs.score and node < rhs.node); + return (score < rhs.score) || (score <= rhs.score and node < rhs.node); } }; diff --git a/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp b/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp index 99b9e856..def935ee 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp @@ -115,7 +115,7 @@ class VarianceFillup : public Scheduler { struct VarianceCompare { bool operator()(const std::pair &lhs, const std::pair &rhs) const { - return ((lhs.second > rhs.second) || ((lhs.second == rhs.second) && (lhs.first < rhs.first))); + return ((lhs.second > rhs.second) || ((lhs.second >= rhs.second) && (lhs.first < rhs.first))); } }; diff --git a/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp b/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp index ed714d6e..eeff3564 100644 --- a/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp +++ b/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp @@ -31,7 +31,7 @@ class LightEdgeVariancePartitioner : public VariancePartitioner &lhs, const std::pair &rhs) const { - return ((lhs.second > rhs.second) || ((lhs.second == rhs.second) && (lhs.first < rhs.first))); + return ((lhs.second > rhs.second) || ((lhs.second >= rhs.second) && (lhs.first < rhs.first))); } }; diff --git a/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp b/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp index 97670124..cc25d064 100644 --- a/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp +++ b/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp @@ -32,7 +32,7 @@ class VariancePartitioner : public LoadBalancerBase { using VertexType = vertex_idx_t; struct VarianceCompare { bool operator()(const std::pair &lhs, const std::pair &rhs) const { - return ((lhs.second > rhs.second) || ((lhs.second == rhs.second) && (lhs.first < rhs.first))); + return ((lhs.second > rhs.second) || ((lhs.second >= rhs.second) && (lhs.first < rhs.first))); } }; diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp index 9b0de601..44358366 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp @@ -49,8 +49,8 @@ struct kl_move { to_proc(to_proc), to_step(to_step) {} bool operator<(kl_move const &rhs) const { - return (gain < rhs.gain) or (gain == rhs.gain and change_in_cost < rhs.change_in_cost) or - (gain == rhs.gain and change_in_cost == rhs.change_in_cost and node > rhs.node); + return (gain < rhs.gain) or (gain <= rhs.gain and change_in_cost < rhs.change_in_cost) or + (gain <= rhs.gain and change_in_cost <= rhs.change_in_cost and node > rhs.node); } kl_move reverse_move() const { @@ -61,6 +61,8 @@ struct kl_move { class Ikl_cost_function { public: virtual double compute_current_costs() = 0; + + virtual ~Ikl_cost_function() = default; }; template diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp index 651046de..1c828eef 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp @@ -52,7 +52,7 @@ struct kl_move_struct { } bool operator>(kl_move_struct const &rhs) const { - return (gain > rhs.gain) or (gain == rhs.gain and node < rhs.node); + return (gain > rhs.gain) or (gain >= rhs.gain and node < rhs.node); } kl_move_struct reverse_move() const { diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp index 2082e0f8..ef1c1079 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp @@ -442,7 +442,7 @@ class kl_improver : public ImprovementScheduler { kl_move best_quick_move = compute_best_move(next_node_to_move, thread_data.local_affinity_table, thread_data); local_lock.insert(next_node_to_move); - if (best_quick_move.gain == std::numeric_limits::lowest()) { + if (best_quick_move.gain <= std::numeric_limits::lowest()) { continue; } @@ -532,7 +532,7 @@ class kl_improver : public ImprovementScheduler { } local_lock.insert(best_move.node); - if (best_move.gain == std::numeric_limits::lowest()) continue; + if (best_move.gain <= std::numeric_limits::lowest()) continue; apply_move(best_move, thread_data); thread_data.affinity_table.insert(best_move.node); @@ -617,7 +617,7 @@ class kl_improver : public ImprovementScheduler { while (inner_iter < thread_data.max_inner_iterations && thread_data.max_gain_heap.size() > 0) { kl_move best_move = get_best_move(thread_data.affinity_table, thread_data.lock_manager, thread_data.max_gain_heap); // locks best_move.node and removes it from node_selection - if (best_move.gain == std::numeric_limits::lowest()) { + if (best_move.gain <= std::numeric_limits::lowest()) { break; } update_avg_gain(best_move.gain, inner_iter, thread_data.average_gain); @@ -941,7 +941,7 @@ class kl_improver : public ImprovementScheduler { compute_node_affinities(node, thread_data.local_affinity_table, thread_data); kl_move best_move = compute_best_move(node, thread_data.local_affinity_table, thread_data); - if (best_move.gain == std::numeric_limits::lowest()) { + if (best_move.gain <= std::numeric_limits::lowest()) { abort = true; break; } diff --git a/include/osp/graph_algorithms/directed_graph_top_sort.hpp b/include/osp/graph_algorithms/directed_graph_top_sort.hpp index ea8d7d80..774f4319 100644 --- a/include/osp/graph_algorithms/directed_graph_top_sort.hpp +++ b/include/osp/graph_algorithms/directed_graph_top_sort.hpp @@ -144,8 +144,8 @@ std::vector> GetTopOrderGorder(const Graph_t &graph) { auto v_cmp = [&priorities, &graph](const VertexType &lhs, const VertexType &rhs) { return (priorities[lhs] < priorities[rhs]) || - ((priorities[lhs] == priorities[rhs]) && (graph.out_degree(lhs) < graph.out_degree(rhs))) || - ((priorities[lhs] == priorities[rhs]) && (graph.out_degree(lhs) == graph.out_degree(rhs)) && + ((priorities[lhs] <= priorities[rhs]) && (graph.out_degree(lhs) < graph.out_degree(rhs))) || + ((priorities[lhs] <= priorities[rhs]) && (graph.out_degree(lhs) == graph.out_degree(rhs)) && (lhs > rhs)); }; diff --git a/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp b/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp index 821cb273..05fcd3a4 100644 --- a/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp +++ b/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp @@ -309,8 +309,8 @@ class Compact_Sparse_Graph { auto v_cmp = [&priorities, &children_tmp] (const vertex_idx &lhs, const vertex_idx &rhs) { return (priorities[lhs] < priorities[rhs]) || - ((priorities[lhs] == priorities[rhs]) && (children_tmp[lhs].size() < children_tmp[rhs].size())) || - ((priorities[lhs] == priorities[rhs]) && (children_tmp[lhs].size() == children_tmp[rhs].size()) && (lhs > rhs)); + ((priorities[lhs] <= priorities[rhs]) && (children_tmp[lhs].size() < children_tmp[rhs].size())) || + ((priorities[lhs] <= priorities[rhs]) && (children_tmp[lhs].size() == children_tmp[rhs].size()) && (lhs > rhs)); }; std::priority_queue, decltype(v_cmp)> ready_q(v_cmp); diff --git a/include/osp/partitioning/partitioners/partitioning_ILP.hpp b/include/osp/partitioning/partitioners/partitioning_ILP.hpp index 6b799c7f..8970903d 100644 --- a/include/osp/partitioning/partitioners/partitioning_ILP.hpp +++ b/include/osp/partitioning/partitioners/partitioning_ILP.hpp @@ -38,7 +38,7 @@ class HypergraphPartitioningILP : public HypergraphPartitioningILPBase& result); diff --git a/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp b/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp index 60e7378c..6f5a420f 100644 --- a/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp +++ b/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp @@ -49,6 +49,8 @@ class HypergraphPartitioningILPBase { inline unsigned getTimeLimitSeconds() const { return time_limit_seconds; } inline void setTimeLimitSeconds(unsigned limit_) { time_limit_seconds = limit_; } inline void setUseInitialSolution(bool use_) { use_initial_solution = use_; } + + virtual ~HypergraphPartitioningILPBase() = default; }; template diff --git a/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp b/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp index cda1d0ec..4ce9d436 100644 --- a/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp +++ b/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp @@ -41,7 +41,7 @@ class HypergraphPartitioningILPWithReplication : public HypergraphPartitioningIL public: - virtual ~HypergraphPartitioningILPWithReplication() = default; + virtual ~HypergraphPartitioningILPWithReplication() override = default; RETURN_STATUS computePartitioning(PartitioningWithReplication& result); From 19a7cf286d766bc8c3690e586746dcf5400b6d53 Mon Sep 17 00:00:00 2001 From: Raphael Steiner Date: Mon, 10 Nov 2025 16:33:37 +0100 Subject: [PATCH 03/20] fixed pedantic warnings --- apps/coarser_plotter.cpp | 2 +- .../StatsModules/BspSptrsvStatsModule.hpp | 2 +- .../run_bsp_recomp_scheduler.hpp | 2 +- .../StringToScheduler/run_bsp_scheduler.hpp | 2 +- .../auxiliary/io/bsp_schedule_file_writer.hpp | 8 ++--- .../auxiliary/io/partitioning_file_writer.hpp | 4 +-- .../io/pebbling_schedule_file_writer.hpp | 2 +- include/osp/auxiliary/misc.hpp | 20 +++++------ include/osp/bsp/model/BspScheduleRecomp.hpp | 2 +- .../MultiLevelHillClimbing.hpp | 4 +-- .../HeavyEdgePreProcess.hpp | 2 +- .../HillClimbing/hill_climbing.hpp | 22 ++++++------ .../hill_climbing_for_comm_schedule.hpp | 10 +++--- include/osp/coarser/Sarkar/Sarkar.hpp | 22 ++++++------ include/osp/coarser/Sarkar/SarkarMul.hpp | 10 +++--- .../coarser/StepByStep/StepByStepCoarser.hpp | 2 +- include/osp/coarser/coarser_util.hpp | 10 +++--- .../directed_graph_edge_desc_concept.hpp | 2 +- .../AbstractWavefrontDivider.hpp | 2 +- .../wavefront_divider/SequenceGenerator.hpp | 2 +- .../wavefront_divider/SequenceSplitter.hpp | 2 +- .../WavefrontStatisticsCollector.hpp | 2 +- .../computational_dag_util.hpp | 8 ++--- .../osp/graph_algorithms/cuthill_mckee.hpp | 2 +- .../graph_algorithms/directed_graph_util.hpp | 4 +-- .../graph_algorithms/subgraph_algorithms.hpp | 2 +- .../adj_list_impl/compact_sparse_graph.hpp | 34 +++++++++---------- .../compact_sparse_graph_edge_desc.hpp | 28 +++++++-------- ...computational_dag_edge_idx_vector_impl.hpp | 2 +- .../computational_dag_vector_impl.hpp | 2 +- .../boost_graphs/boost_graph.hpp | 2 +- .../osp/partitioning/model/partitioning.hpp | 2 +- .../model/partitioning_replication.hpp | 2 +- .../partitioners/partitioning_ILP.hpp | 2 +- .../partitioners/partitioning_ILP_base.hpp | 2 +- .../partitioning_ILP_replication.hpp | 2 +- tests/balanced_coin_flips.cpp | 18 +++++----- tests/boost_graph_adaptor.cpp | 2 +- tests/bsp_architecture.cpp | 2 +- tests/bsp_greedy_recomputer.cpp | 2 +- tests/bsp_instance.cpp | 2 +- tests/bsp_schedule.cpp | 6 ++-- tests/bsp_schedule_recomp.cpp | 2 +- tests/bsp_schedulers.cpp | 4 +-- tests/bsp_schedulers_mem_const.cpp | 22 ++++++------ tests/coarser.cpp | 12 +++---- tests/compact_sparse_graph.cpp | 24 ++++++------- tests/compact_sparse_graph_edge_desc.cpp | 20 +++++------ tests/cuthill_mckee.cpp | 4 +-- tests/directed_graph_algorithms.cpp | 2 +- tests/directed_graph_top_sort.cpp | 4 +-- tests/directed_graph_util.cpp | 6 ++-- tests/filereader.cpp | 14 ++++---- tests/graph_vector_edge_desc_impl.cpp | 2 +- tests/graph_vector_impl.cpp | 8 ++--- tests/hill_climbing.cpp | 4 +-- tests/hypergraph_and_partition.cpp | 2 +- tests/kl_lambda.cpp | 4 +-- tests/kl_total.cpp | 16 ++++----- tests/merkle_hash_computer.cpp | 4 +-- tests/pebbling_schedule_class.cpp | 4 +-- tests/random_graph_gen.cpp | 4 +-- tests/sptrsv.cpp | 4 +-- tests/stepbystep_coarsen_and_multilevel.cpp | 4 +-- 64 files changed, 216 insertions(+), 216 deletions(-) diff --git a/apps/coarser_plotter.cpp b/apps/coarser_plotter.cpp index 83a42bb9..d9093b97 100644 --- a/apps/coarser_plotter.cpp +++ b/apps/coarser_plotter.cpp @@ -100,4 +100,4 @@ int main(int argc, char *argv[]) { } return 0; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp b/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp index cd73d227..ebb1dbb5 100644 --- a/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp +++ b/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp @@ -66,7 +66,7 @@ bool compare_vectors(Eigen::VectorXd &v1, Eigen::VectorXd &v2) { } } return same; -}; +} template class BspSptrsvStatsModule : public IStatisticModule { diff --git a/apps/test_suite_runner/StringToScheduler/run_bsp_recomp_scheduler.hpp b/apps/test_suite_runner/StringToScheduler/run_bsp_recomp_scheduler.hpp index 959cd4c2..369c9fa6 100644 --- a/apps/test_suite_runner/StringToScheduler/run_bsp_recomp_scheduler.hpp +++ b/apps/test_suite_runner/StringToScheduler/run_bsp_recomp_scheduler.hpp @@ -65,6 +65,6 @@ RETURN_STATUS run_bsp_recomp_scheduler(const ConfigParser &parser, const boost:: throw std::invalid_argument("Parameter error: Unknown algorithm.\n"); } -}; +} } // namespace osp \ No newline at end of file diff --git a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp index d3fc8813..4ad35699 100644 --- a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp +++ b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp @@ -242,6 +242,6 @@ RETURN_STATUS run_bsp_scheduler(const ConfigParser &parser, const boost::propert auto scheduler = get_base_bsp_scheduler_by_name(parser, algorithm); return scheduler->computeSchedule(schedule); } -}; +} } // namespace osp \ No newline at end of file diff --git a/include/osp/auxiliary/io/bsp_schedule_file_writer.hpp b/include/osp/auxiliary/io/bsp_schedule_file_writer.hpp index f92633b5..11273e49 100644 --- a/include/osp/auxiliary/io/bsp_schedule_file_writer.hpp +++ b/include/osp/auxiliary/io/bsp_schedule_file_writer.hpp @@ -28,7 +28,7 @@ namespace osp { namespace file_writer { template void write_txt(std::ostream &os, const BspSchedule &schedule) { - os << "\%\% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and " + os << "%% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and " << schedule.numberOfSupersteps() << " supersteps." << std::endl; os << schedule.getInstance().numberOfVertices() << " " << schedule.getInstance().numberOfProcessors() << " " << schedule.numberOfSupersteps() << std::endl; @@ -48,7 +48,7 @@ void write_txt(const std::string &filename, const BspSchedule &schedule template void write_txt(std::ostream &os, const BspScheduleCS &schedule) { - os << "\%\% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and " + os << "%% BspSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and " << schedule.numberOfSupersteps() << " supersteps." << std::endl; os << schedule.getInstance().numberOfVertices() << " " << schedule.getInstance().numberOfProcessors() << " " << schedule.numberOfSupersteps() << " "; @@ -66,10 +66,10 @@ void write_txt(std::ostream &os, const BspScheduleCS &schedule) { } if (schedule.getCommunicationSchedule().empty()) { - os << "\%\% No communication schedule available." << std::endl; + os << "%% No communication schedule available." << std::endl; } else { - os << "\%\% Communication schedule available." << std::endl; + os << "%% Communication schedule available." << std::endl; for (const auto &[key, val] : schedule.getCommunicationSchedule()) { os << std::get<0>(key) << " " << std::get<1>(key) << " " << std::get<2>(key) << " " << val << std::endl; diff --git a/include/osp/auxiliary/io/partitioning_file_writer.hpp b/include/osp/auxiliary/io/partitioning_file_writer.hpp index 782eac31..70fac29e 100644 --- a/include/osp/auxiliary/io/partitioning_file_writer.hpp +++ b/include/osp/auxiliary/io/partitioning_file_writer.hpp @@ -30,7 +30,7 @@ void write_txt(std::ostream &os, const Partitioning &partition) { using index_type = typename hypergraph_t::vertex_idx; - os << "\%\% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts." << std::endl; + os << "%% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts." << std::endl; for(index_type node = 0; node < partition.getInstance().getHypergraph().num_vertices(); ++node) os << node << " " << partition.assignedPartition(node) << std::endl; @@ -47,7 +47,7 @@ void write_txt(std::ostream &os, const PartitioningWithReplication using index_type = typename hypergraph_t::vertex_idx; - os << "\%\% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts with replication." << std::endl; + os << "%% Partitioning for " << partition.getInstance().getNumberOfPartitions() << " parts with replication." << std::endl; for(index_type node = 0; node < partition.getInstance().getHypergraph().num_vertices(); ++node) { diff --git a/include/osp/auxiliary/io/pebbling_schedule_file_writer.hpp b/include/osp/auxiliary/io/pebbling_schedule_file_writer.hpp index 0660eb59..217c591a 100644 --- a/include/osp/auxiliary/io/pebbling_schedule_file_writer.hpp +++ b/include/osp/auxiliary/io/pebbling_schedule_file_writer.hpp @@ -29,7 +29,7 @@ void write_txt(std::ostream &os, const PebblingSchedule &schedule) { using vertex_idx = vertex_idx_t; - os << "\%\% PebblingSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and " + os << "%% PebblingSchedule for " << schedule.getInstance().numberOfProcessors() << " processors and " << schedule.numberOfSupersteps() << " supersteps." << std::endl; for(unsigned step = 0; step < schedule.numberOfSupersteps(); ++step) diff --git a/include/osp/auxiliary/misc.hpp b/include/osp/auxiliary/misc.hpp index c1640d59..7a0cd95e 100644 --- a/include/osp/auxiliary/misc.hpp +++ b/include/osp/auxiliary/misc.hpp @@ -41,7 +41,7 @@ inline int randInt(int lim) { rnd = std::rand(); return rnd % lim; -}; +} // pair of integers template @@ -84,7 +84,7 @@ inline bool isDisjoint(std::vector &intervals) { return false; return true; -}; +} // computes power of an integer template @@ -103,7 +103,7 @@ T intpow(T base, unsigned exp) { return tmp * tmp; } return base * tmp * tmp; -}; +} template unsigned uintpow(T base, unsigned exp) { @@ -121,7 +121,7 @@ unsigned uintpow(T base, unsigned exp) { return tmp * tmp; } return base * tmp * tmp; -}; +} struct contractionEdge { intPair edge; @@ -166,7 +166,7 @@ std::unordered_set get_intersection(const std::unordered_set &a, const std } } return {result.begin(), result.end()}; -}; +} // unordered set union template @@ -177,7 +177,7 @@ std::unordered_set get_union(const std::unordered_set &a, const std::unord larger.emplace(elem); } return larger; -}; +} // zip two vectors of equal length template @@ -307,7 +307,7 @@ T Get_Median(SetType ordered_set) { T val2 = *(++it); return val1 + (val2 - val1) / 2; } -}; +} /** * @brief Get lower_median of a sorted set or multiset @@ -324,7 +324,7 @@ T Get_Lower_Median(SetType ordered_set) { std::advance(it, (ordered_set.size() - 1) / 2); return *it; -}; +} /** * @brief Get top third percentile of a sorted set or multiset @@ -341,7 +341,7 @@ T Get_upper_third_percentile(SetType ordered_set) { std::advance(it, (ordered_set.size() / 3) + ((ordered_set.size() + 1) / 3)); return *it; -}; +} /** * @brief Get lower third percentile of a sorted set or multiset @@ -358,6 +358,6 @@ T Get_lower_third_percentile(SetType ordered_set) { std::advance(it, (ordered_set.size() / 3)); return *it; -}; +} } // namespace osp \ No newline at end of file diff --git a/include/osp/bsp/model/BspScheduleRecomp.hpp b/include/osp/bsp/model/BspScheduleRecomp.hpp index 2563546a..622e1ba9 100644 --- a/include/osp/bsp/model/BspScheduleRecomp.hpp +++ b/include/osp/bsp/model/BspScheduleRecomp.hpp @@ -214,7 +214,7 @@ bool BspScheduleRecomp::satisfiesConstraints() const { } return true; -}; +} template v_workw_t BspScheduleRecomp::computeWorkCosts() const { diff --git a/include/osp/bsp/scheduler/CoarsenRefineSchedulers/MultiLevelHillClimbing.hpp b/include/osp/bsp/scheduler/CoarsenRefineSchedulers/MultiLevelHillClimbing.hpp index e17393fa..949c933b 100644 --- a/include/osp/bsp/scheduler/CoarsenRefineSchedulers/MultiLevelHillClimbing.hpp +++ b/include/osp/bsp/scheduler/CoarsenRefineSchedulers/MultiLevelHillClimbing.hpp @@ -155,7 +155,7 @@ BspSchedule MultiLevelHillClimbingScheduler::Refine(const BspI std::cout << "Refined cost: " << schedule_on_full_graph.computeCosts() << std::endl; return schedule_on_full_graph; -}; +} // given an original DAG G, a schedule on the coarsified G and the contraction steps, project the coarse schedule to the entire G template @@ -173,7 +173,7 @@ BspSchedule MultiLevelHillClimbingScheduler::ComputeUncontract schedule.setAssignedSuperstep(node, coarse_schedule.assignedSuperstep(new_ids[node])); } return schedule; -}; +} template void MultiLevelHillClimbingScheduler::setLinearRefinementPoints(vertex_idx OriginalNrOfNodes, unsigned stepSize) diff --git a/include/osp/bsp/scheduler/LoadBalanceScheduler/HeavyEdgePreProcess.hpp b/include/osp/bsp/scheduler/LoadBalanceScheduler/HeavyEdgePreProcess.hpp index 255b2aa0..1ad7304d 100644 --- a/include/osp/bsp/scheduler/LoadBalanceScheduler/HeavyEdgePreProcess.hpp +++ b/include/osp/bsp/scheduler/LoadBalanceScheduler/HeavyEdgePreProcess.hpp @@ -115,6 +115,6 @@ heavy_edge_preprocess(const Graph_t &graph, const double heavy_is_x_times_median } return uf_structure.get_connected_components(); -}; +} } // namespace osp diff --git a/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp b/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp index 7966c711..61cd2295 100644 --- a/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp @@ -292,7 +292,7 @@ void HillClimbingScheduler::Init() { memory_used[schedule->assignedProcessor(node)][schedule->assignedSuperstep(node)] += schedule->getInstance().getComputationalDag().vertex_mem_weight(node); } -}; +} template void HillClimbingScheduler::updatePromisingMoves() @@ -391,7 +391,7 @@ void HillClimbingScheduler::updateNodeMovesEarlier(const vertex_idx nod else for (unsigned proc = 0; proc < schedule->getInstance().getArchitecture().numberOfProcessors(); ++proc) addMoveOption(node, proc, EARLIER); -}; +} template void HillClimbingScheduler::updateNodeMovesAt(const vertex_idx node) { @@ -406,7 +406,7 @@ void HillClimbingScheduler::updateNodeMovesAt(const vertex_idx node) { for (unsigned proc = 0; proc < schedule->getInstance().getArchitecture().numberOfProcessors(); ++proc) if (proc != schedule->assignedProcessor(node)) addMoveOption(node, proc, AT); -}; +} template void HillClimbingScheduler::updateNodeMovesLater(const vertex_idx node) { @@ -429,7 +429,7 @@ void HillClimbingScheduler::updateNodeMovesLater(const vertex_idx node) else for (unsigned proc = 0; proc < schedule->getInstance().getArchitecture().numberOfProcessors(); ++proc) addMoveOption(node, proc, LATER); -}; +} template void HillClimbingScheduler::updateNodeMoves(const vertex_idx node) { @@ -437,7 +437,7 @@ void HillClimbingScheduler::updateNodeMoves(const vertex_idx node) { updateNodeMovesEarlier(node); updateNodeMovesAt(node); updateNodeMovesLater(node); -}; +} template void HillClimbingScheduler::updateMoveOptions(vertex_idx node, int where) @@ -497,7 +497,7 @@ void HillClimbingScheduler::addMoveOption(const vertex_idx node, const moveOptions[dir].emplace_back(node, p); movePointer[dir][node][p] = --moveOptions[dir].end(); } -}; +} template void HillClimbingScheduler::eraseMoveOption(vertex_idx node, unsigned p, Direction dir) @@ -707,7 +707,7 @@ int HillClimbingScheduler::moveCostChange(const vertex_idx node, unsign changing.newCost = static_cast(static_cast(cost) + change); return change; -}; +} // Execute a chosen move, updating the schedule and the data structures template @@ -780,7 +780,7 @@ void HillClimbingScheduler::executeMove(const vertex_idx node, const un supStepListPointer[node] = (--supsteplists[newStep][newProc].end()); updateMoveOptions(node, where); -}; +} // Single hill climbing step template @@ -879,7 +879,7 @@ bool HillClimbingScheduler::Improve() { Init(); return true; -}; +} // Check if move violates mem constraints template @@ -917,7 +917,7 @@ void HillClimbingScheduler::RemoveNeedlessSupSteps() { } schedule->updateNumberOfSupersteps(); -}; +} template void HillClimbingScheduler::CreateSupstepLists() { @@ -934,6 +934,6 @@ void HillClimbingScheduler::CreateSupstepLists() { for (vertex_idx node : top_sort_view(G)) supsteplists[schedule->assignedSuperstep(node)][schedule->assignedProcessor(node)].push_back(node); -}; +} } // namespace osp \ No newline at end of file diff --git a/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing_for_comm_schedule.hpp b/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing_for_comm_schedule.hpp index 426679c8..e7f8c0fb 100644 --- a/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing_for_comm_schedule.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing_for_comm_schedule.hpp @@ -210,7 +210,7 @@ void HillClimbingForCommSteps::Init() { commCost[step][proc] = std::max(sent[step][proc], received[step][proc]); commCostPointer[step][proc] = commCostList[step].emplace(commCost[step][proc], proc).first; } -}; +} // compute cost change incurred by a potential move template @@ -249,7 +249,7 @@ int HillClimbingForCommSteps::moveCostChange(const vertex_idx node, con change += static_cast(schedule->getInstance().getArchitecture().synchronisationCosts()); return change; -}; +} // execute a move, updating the comm. schedule and the data structures template @@ -303,7 +303,7 @@ void HillClimbingForCommSteps::executeMove(vertex_idx node, unsigned p, commSchedRecLists[oldStep][p].erase(commSchedRecListPointer[node][p]); commSchedRecLists[step][p].emplace_front(node, p); commSchedRecListPointer[node][p] = commSchedRecLists[step][p].begin(); -}; +} // Single comm. schedule hill climbing step template @@ -396,7 +396,7 @@ bool HillClimbingForCommSteps::Improve() { executeMove(bestNode, bestProc, bestStep, bestDiff); return true; -}; +} template void HillClimbingForCommSteps::CreateSupstepLists() { @@ -414,7 +414,7 @@ void HillClimbingForCommSteps::CreateSupstepLists() { for (vertex_idx node : topOrder) supsteplists[schedule->assignedSuperstep(node)][schedule->assignedProcessor(node)].push_back(node); -}; +} template void HillClimbingForCommSteps::ConvertCommSchedule() diff --git a/include/osp/coarser/Sarkar/Sarkar.hpp b/include/osp/coarser/Sarkar/Sarkar.hpp index 0ee04ad2..930a1186 100644 --- a/include/osp/coarser/Sarkar/Sarkar.hpp +++ b/include/osp/coarser/Sarkar/Sarkar.hpp @@ -269,7 +269,7 @@ vertex_idx_t Sarkar::singleContraction(v_wo } return counter; -}; +} template @@ -397,7 +397,7 @@ vertex_idx_t Sarkar::allChildrenContraction } return counter; -}; +} @@ -528,7 +528,7 @@ vertex_idx_t Sarkar::allParentsContraction( } return counter; -}; +} @@ -613,7 +613,7 @@ std::vector>> Sarkar std::vector>> Sarkar::generate_vertex_expansion_map(const Graph_t_in &dag_in) { vertex_idx_t dummy; return generate_vertex_expansion_map(dag_in, dummy); -}; +} @@ -791,7 +791,7 @@ vertex_idx_t Sarkar::someChildrenContractio } return counter; -}; +} @@ -966,7 +966,7 @@ vertex_idx_t Sarkar::someParentsContraction } return counter; -}; +} @@ -1134,7 +1134,7 @@ vertex_idx_t Sarkar::levelContraction(v_wor } return counter; -}; +} template std::vector Sarkar::computeNodeHashes(const Graph_t_in &graph, const std::vector< vertex_idx_t > &vertexPoset, const std::vector< v_workw_t > &dist) const { @@ -1323,7 +1323,7 @@ vertex_idx_t Sarkar::homogeneous_buffer_mer } return counter; -}; +} @@ -1428,7 +1428,7 @@ vertex_idx_t Sarkar::out_buffer_merge(v_wor } return counter; -}; +} @@ -1533,6 +1533,6 @@ vertex_idx_t Sarkar::in_buffer_merge(v_work } return counter; -}; +} } // end namespace osp \ No newline at end of file diff --git a/include/osp/coarser/Sarkar/SarkarMul.hpp b/include/osp/coarser/Sarkar/SarkarMul.hpp index 2d2df64f..4eb91732 100644 --- a/include/osp/coarser/Sarkar/SarkarMul.hpp +++ b/include/osp/coarser/Sarkar/SarkarMul.hpp @@ -101,13 +101,13 @@ void SarkarMul::initParams() { std::sort(ml_params.commCostVec.begin(), ml_params.commCostVec.end()); updateParams(); -}; +} template void SarkarMul::updateParams() { coarser_initial.setParameters(params); coarser_secondary.setParameters(params); -}; +} template RETURN_STATUS SarkarMul::run_single_contraction_mode(vertex_idx_t &diff_vertices) { @@ -141,7 +141,7 @@ RETURN_STATUS SarkarMul::run_single_contraction_mode(ve diff_vertices = current_num_vertices - new_num_vertices; return status; -}; +} template RETURN_STATUS SarkarMul::run_contractions(v_workw_t commCost) { @@ -231,7 +231,7 @@ RETURN_STATUS SarkarMul::run_contractions(v_workw_t @@ -296,7 +296,7 @@ RETURN_STATUS SarkarMul::run_contractions() { } return status; -}; +} diff --git a/include/osp/coarser/StepByStep/StepByStepCoarser.hpp b/include/osp/coarser/StepByStep/StepByStepCoarser.hpp index 3b4a3cdf..8513c753 100644 --- a/include/osp/coarser/StepByStep/StepByStepCoarser.hpp +++ b/include/osp/coarser/StepByStep/StepByStepCoarser.hpp @@ -993,6 +993,6 @@ std::vector > StepByStepCoarser::GetIntermediateI target[node] = top_idx[target[node]]; return target; -}; +} } // namespace osp \ No newline at end of file diff --git a/include/osp/coarser/coarser_util.hpp b/include/osp/coarser/coarser_util.hpp index 1b659dd2..bfc2b69a 100644 --- a/include/osp/coarser/coarser_util.hpp +++ b/include/osp/coarser/coarser_util.hpp @@ -40,7 +40,7 @@ bool check_valid_contraction_map(const std::vector> &v return std::all_of(image.cbegin(), image.cend(), [image_size](const vertex_idx_t &vert) { return (vert >= static_cast>(0)) && (vert < image_size); }); -}; +} template struct acc_sum { @@ -383,7 +383,7 @@ bool check_valid_expansion_map(const std::vector std::vector>> @@ -402,7 +402,7 @@ invert_vertex_contraction_map(const std::vector> &vert } return expansion_map; -}; +} template std::vector> @@ -424,7 +424,7 @@ invert_vertex_expansion_map(const std::vector @@ -485,7 +485,7 @@ void reorder_expansion_map(const Graph_t_in &graph, std::vector>() != std::declval>())>> : std::conjunction, std::is_default_constructible>, std::is_copy_constructible>> {}; -; + template inline constexpr bool has_hashable_edge_desc_v = has_hashable_edge_desc::value; diff --git a/include/osp/dag_divider/wavefront_divider/AbstractWavefrontDivider.hpp b/include/osp/dag_divider/wavefront_divider/AbstractWavefrontDivider.hpp index ef02240a..eb484409 100644 --- a/include/osp/dag_divider/wavefront_divider/AbstractWavefrontDivider.hpp +++ b/include/osp/dag_divider/wavefront_divider/AbstractWavefrontDivider.hpp @@ -127,4 +127,4 @@ class AbstractWavefrontDivider : public IDagDivider { } }; -}; \ No newline at end of file +} // end namespace osp \ No newline at end of file diff --git a/include/osp/dag_divider/wavefront_divider/SequenceGenerator.hpp b/include/osp/dag_divider/wavefront_divider/SequenceGenerator.hpp index 95118459..73c978e0 100644 --- a/include/osp/dag_divider/wavefront_divider/SequenceGenerator.hpp +++ b/include/osp/dag_divider/wavefront_divider/SequenceGenerator.hpp @@ -78,4 +78,4 @@ class SequenceGenerator { const std::vector>& level_sets_; }; -}; +} // end namespace osp diff --git a/include/osp/dag_divider/wavefront_divider/SequenceSplitter.hpp b/include/osp/dag_divider/wavefront_divider/SequenceSplitter.hpp index 64e5d974..1cfc7018 100644 --- a/include/osp/dag_divider/wavefront_divider/SequenceSplitter.hpp +++ b/include/osp/dag_divider/wavefront_divider/SequenceSplitter.hpp @@ -268,4 +268,4 @@ class ThresholdScanSplitter : public SequenceSplitter { size_t min_subseq_len_; }; -}; // namespace osp +} // namespace osp diff --git a/include/osp/dag_divider/wavefront_divider/WavefrontStatisticsCollector.hpp b/include/osp/dag_divider/wavefront_divider/WavefrontStatisticsCollector.hpp index ce922c22..77622b38 100644 --- a/include/osp/dag_divider/wavefront_divider/WavefrontStatisticsCollector.hpp +++ b/include/osp/dag_divider/wavefront_divider/WavefrontStatisticsCollector.hpp @@ -119,4 +119,4 @@ class WavefrontStatisticsCollector { const std::vector> &level_sets_; }; -}; +} // end namespace osp diff --git a/include/osp/graph_algorithms/computational_dag_util.hpp b/include/osp/graph_algorithms/computational_dag_util.hpp index 12fe659a..5fba1c8a 100644 --- a/include/osp/graph_algorithms/computational_dag_util.hpp +++ b/include/osp/graph_algorithms/computational_dag_util.hpp @@ -63,7 +63,7 @@ v_workw_t sumOfVerticesWorkWeights(VertexIterator begin, VertexIterator return std::accumulate(begin, end, 0, [&](const auto sum, const vertex_idx_t &v) { return sum + graph.vertex_work_weight(v); }); -}; +} template v_workw_t sumOfVerticesWorkWeights(const Graph_t &graph) { @@ -72,13 +72,13 @@ v_workw_t sumOfVerticesWorkWeights(const Graph_t &graph) { return std::accumulate(graph.vertices().begin(), graph.vertices().end(), static_cast>(0), [&](const v_workw_t sum, const vertex_idx_t &v) { return sum + graph.vertex_work_weight(v); }); -}; +} template v_workw_t sumOfVerticesWorkWeights(const std::initializer_list> vertices_, const Graph_t &graph) { return sumOfVerticesWorkWeights(vertices_.begin(), vertices_.end(), graph); -}; +} template v_commw_t sumOfVerticesCommunicationWeights(VertexIterator begin, VertexIterator end, const Graph_t &graph) { @@ -123,7 +123,7 @@ v_commw_t sumOfVerticesCommunicationWeights(const Graph_t &graph) { return std::accumulate(graph.vertices().begin(), graph.vertices().end(), static_cast>(0), [&](const v_commw_t sum, const vertex_idx_t &v) { return sum + graph.vertex_comm_weight(v); }); -}; +} template v_commw_t sumOfVerticesCommunicationWeights(const std::initializer_list> &vertices_, diff --git a/include/osp/graph_algorithms/cuthill_mckee.hpp b/include/osp/graph_algorithms/cuthill_mckee.hpp index c869e72c..f99fc19a 100644 --- a/include/osp/graph_algorithms/cuthill_mckee.hpp +++ b/include/osp/graph_algorithms/cuthill_mckee.hpp @@ -304,4 +304,4 @@ inline std::vector> GetTopOrderCuthillMcKeeUndirected(cons } -}; // namespace osp +} // namespace osp diff --git a/include/osp/graph_algorithms/directed_graph_util.hpp b/include/osp/graph_algorithms/directed_graph_util.hpp index 058bea73..ffd6b482 100644 --- a/include/osp/graph_algorithms/directed_graph_util.hpp +++ b/include/osp/graph_algorithms/directed_graph_util.hpp @@ -461,7 +461,7 @@ std::vector> successors(const vertex_idx_t &v, co vec.push_back(suc); } return vec; -}; +} /** * @brief Returns a collection containing the ancestors of a vertex in a directed graph. @@ -480,7 +480,7 @@ std::vector> ancestors(const vertex_idx_t &v, con vec.push_back(anc); } return vec; -}; +} template bool is_acyclic(const Graph_t &graph) { diff --git a/include/osp/graph_algorithms/subgraph_algorithms.hpp b/include/osp/graph_algorithms/subgraph_algorithms.hpp index 190cc2f7..193dcaa1 100644 --- a/include/osp/graph_algorithms/subgraph_algorithms.hpp +++ b/include/osp/graph_algorithms/subgraph_algorithms.hpp @@ -272,4 +272,4 @@ std::unordered_map, vertex_idx_t> create_in return local_idx; } -}; // namespace osp +} // end namespace osp diff --git a/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp b/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp index 05fcd3a4..bedfa623 100644 --- a/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp +++ b/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp @@ -400,7 +400,7 @@ class Compact_Sparse_Graph { csc_out_edges = Compact_Children_Edges(std::move(csc_edge_children), std::move(csc_source_ptr)); csr_in_edges = Compact_Parent_Edges(std::move(csr_edge_parents), std::move(csr_target_ptr)); - }; + } template Compact_Sparse_Graph(vertex_idx num_vertices_, const edge_list_type & edges, const std::vector &ww) : Compact_Sparse_Graph(num_vertices_, edges) { @@ -681,38 +681,38 @@ class Compact_Sparse_Graph { template inline std::enable_if_t vertex_work_weight(const vertex_idx &v) const { return vert_work_weights[v]; - }; + } template inline std::enable_if_t vertex_work_weight(const vertex_idx &v) const { return static_cast(1) + in_degree(v); - }; + } template inline std::enable_if_t vertex_comm_weight(const vertex_idx &v) const { return vert_comm_weights[v]; - }; + } template inline std::enable_if_t vertex_comm_weight(const vertex_idx) const { return static_cast(0); - }; + } template inline std::enable_if_t vertex_mem_weight(const vertex_idx &v) const { return vert_mem_weights[v]; - }; + } template inline std::enable_if_t vertex_mem_weight(const vertex_idx) const { return static_cast(0); - }; + } template inline std::enable_if_t vertex_type(const vertex_idx &v) const { return vert_types[v]; - }; + } template inline std::enable_if_t vertex_type(const vertex_idx) const { return static_cast(0); - }; + } inline vertex_type_type num_vertex_types() const { return number_of_vertex_types; }; @@ -723,11 +723,11 @@ class Compact_Sparse_Graph { } else { vert_work_weights[vertex_permutation_from_original_to_internal[v]] = work_weight; } - }; + } template inline std::enable_if_t set_vertex_work_weight(const vertex_idx &v, const vertex_work_weight_type work_weight) { static_assert(use_work_weights, "To set work weight, graph type must allow work weights."); - }; + } template inline std::enable_if_t set_vertex_comm_weight(const vertex_idx &v, const vertex_comm_weight_type comm_weight) { @@ -736,11 +736,11 @@ class Compact_Sparse_Graph { } else { vert_comm_weights[vertex_permutation_from_original_to_internal[v]] = comm_weight; } - }; + } template inline std::enable_if_t set_vertex_comm_weight(const vertex_idx &v, const vertex_comm_weight_type comm_weight) { static_assert(use_comm_weights, "To set comm weight, graph type must allow comm weights."); - }; + } template inline std::enable_if_t set_vertex_mem_weight(const vertex_idx &v, const vertex_mem_weight_type mem_weight) { @@ -749,11 +749,11 @@ class Compact_Sparse_Graph { } else { vert_mem_weights[vertex_permutation_from_original_to_internal[v]] = mem_weight; } - }; + } template inline std::enable_if_t set_vertex_mem_weight(const vertex_idx &v, const vertex_mem_weight_type mem_weight) { static_assert(use_mem_weights, "To set mem weight, graph type must allow mem weights."); - }; + } template inline std::enable_if_t set_vertex_type(const vertex_idx &v, const vertex_type_type vertex_type_) { @@ -763,11 +763,11 @@ class Compact_Sparse_Graph { vert_types[vertex_permutation_from_original_to_internal[v]] = vertex_type_; } number_of_vertex_types = std::max(number_of_vertex_types, vertex_type_); - }; + } template inline std::enable_if_t set_vertex_type(const vertex_idx &v, const vertex_type_type vertex_type_) { static_assert(use_vert_types, "To set vert type, graph type must allow vertex types."); - }; + } template &> inline std::enable_if_t get_pullback_permutation() const { diff --git a/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph_edge_desc.hpp b/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph_edge_desc.hpp index 3ea563ca..ef0a2139 100644 --- a/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph_edge_desc.hpp +++ b/include/osp/graph_implementations/adj_list_impl/compact_sparse_graph_edge_desc.hpp @@ -149,63 +149,63 @@ class Compact_Sparse_Graph_EdgeDesc : public Compact_Sparse_Graph(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, const std::vector &ww) : BaseT(num_vertices_, edges, ww) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, const std::vector &&ww) : BaseT(num_vertices_, edges, std::move(ww)) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, std::vector &ww, std::vector &cw) : BaseT(num_vertices_, edges, ww, cw) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, std::vector &&ww, std::vector &&cw) : BaseT(num_vertices_, edges, std::move(ww), std::move(cw)) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, const std::vector &ww, const std::vector &cw, const std::vector &mw) : BaseT(num_vertices_, edges, ww, cw, mw) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, const std::vector &&ww, const std::vector &&cw, const std::vector &&mw) : BaseT(num_vertices_, edges, std::move(ww), std::move(cw), std::move(mw)) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, const std::vector &ww, const std::vector &cw, const std::vector &mw, const std::vector &vt) : BaseT(num_vertices_, edges, ww, cw, mw, vt) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(vertex_idx num_vertices_, const edge_list_type & edges, const std::vector &&ww, const std::vector &&cw, const std::vector &&mw, const std::vector &&vt) : BaseT(num_vertices_, edges, std::move(ww), std::move(cw), std::move(mw), std::move(vt)) { if constexpr (use_edge_comm_weights) { edge_comm_weights = std::vector(BaseT::num_edges(), static_cast(0)); } - }; + } template Compact_Sparse_Graph_EdgeDesc(const Graph_type & graph) : BaseT(graph) { @@ -220,7 +220,7 @@ class Compact_Sparse_Graph_EdgeDesc : public Compact_Sparse_Graph inline std::enable_if_t edge_comm_weight(const directed_edge_descriptor &edge) const { return edge_comm_weights[edge]; - }; + } template inline std::enable_if_t edge_comm_weight(const directed_edge_descriptor &edge) const { return static_cast(1); - }; + } template inline std::enable_if_t set_edge_comm_weight(const vertex_idx &src, const vertex_idx &tgt, const edge_comm_weight_type e_comm_weight) { @@ -261,11 +261,11 @@ class Compact_Sparse_Graph_EdgeDesc : public Compact_Sparse_Graph inline std::enable_if_t set_edge_comm_weight(const vertex_idx &src, const vertex_idx &tgt, const edge_comm_weight_type e_comm_weight) { static_assert(use_edge_comm_weights, "To set edge communication weight, graph type must allow edge communication weights."); - }; + } }; diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp index 103d895f..eb4e80cc 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp @@ -123,7 +123,7 @@ class computational_dag_edge_idx_vector_impl { static_assert(is_computational_dag_v, "Graph_t must satisfy the is_computation_dag concept"); construct_computational_dag(other, *this); - }; + } computational_dag_edge_idx_vector_impl &operator=(const computational_dag_edge_idx_vector_impl &other) = default; diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp index 65deb91a..77305763 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp @@ -88,7 +88,7 @@ class computational_dag_vector_impl { static_assert(is_computational_dag_v, "Graph_t must satisfy the is_computation_dag concept"); construct_computational_dag(other, *this); - }; + } computational_dag_vector_impl(computational_dag_vector_impl &&other) : vertices_(std::move(other.vertices_)), out_neigbors(std::move(other.out_neigbors)), diff --git a/include/osp/graph_implementations/boost_graphs/boost_graph.hpp b/include/osp/graph_implementations/boost_graphs/boost_graph.hpp index 518103ca..52557fb4 100644 --- a/include/osp/graph_implementations/boost_graphs/boost_graph.hpp +++ b/include/osp/graph_implementations/boost_graphs/boost_graph.hpp @@ -209,7 +209,7 @@ class boost_graph { graph.m_vertices.reserve(other.num_vertices()); osp::construct_computational_dag(other, *this); - }; + } inline const boost_graph_impl_t &get_boost_graph() const { return graph; } inline boost_graph_impl_t &get_boost_graph() { return graph; } diff --git a/include/osp/partitioning/model/partitioning.hpp b/include/osp/partitioning/model/partitioning.hpp index d25a28b9..e39328a1 100644 --- a/include/osp/partitioning/model/partitioning.hpp +++ b/include/osp/partitioning/model/partitioning.hpp @@ -181,6 +181,6 @@ bool Partitioning::satisfiesBalanceConstraint() const { } return true; -}; +} } // namespace osp \ No newline at end of file diff --git a/include/osp/partitioning/model/partitioning_replication.hpp b/include/osp/partitioning/model/partitioning_replication.hpp index 0efe577c..eae0b65e 100644 --- a/include/osp/partitioning/model/partitioning_replication.hpp +++ b/include/osp/partitioning/model/partitioning_replication.hpp @@ -223,6 +223,6 @@ bool PartitioningWithReplication::satisfiesBalanceConstraint() con } return true; -}; +} } // namespace osp \ No newline at end of file diff --git a/include/osp/partitioning/partitioners/partitioning_ILP.hpp b/include/osp/partitioning/partitioners/partitioning_ILP.hpp index 8970903d..0482d936 100644 --- a/include/osp/partitioning/partitioners/partitioning_ILP.hpp +++ b/include/osp/partitioning/partitioners/partitioning_ILP.hpp @@ -107,7 +107,7 @@ void HypergraphPartitioningILP::setupExtraVariablesConstraints(con for (const index_type& hyperedge : instance.getHypergraph().get_incident_hyperedges(node)) model.AddConstr(this->hyperedge_uses_partition[hyperedge][static_cast(part)] >= this->node_in_partition[node][static_cast(part)]); -}; +} // convert generic one-to-many assingment (of base class function) to one-to-one template diff --git a/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp b/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp index 6f5a420f..b5df2fb4 100644 --- a/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp +++ b/include/osp/partitioning/partitioners/partitioning_ILP_base.hpp @@ -132,7 +132,7 @@ void HypergraphPartitioningILPBase::setupFundamentalVariablesConst model.SetObjective(expr, COPT_MINIMIZE); -}; +} template std::vector > HypergraphPartitioningILPBase::readAllCoptAssignments(const PartitioningProblem &instance, Model& model) diff --git a/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp b/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp index 4ce9d436..d1e9d5c8 100644 --- a/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp +++ b/include/osp/partitioning/partitioners/partitioning_ILP_replication.hpp @@ -161,7 +161,7 @@ void HypergraphPartitioningILPWithReplication::setupExtraVariables this->node_in_partition[node][static_cast(part1)] + this->node_in_partition[node][static_cast(part2)] - 1); } -}; +} template void HypergraphPartitioningILPWithReplication::setInitialSolution(const PartitioningWithReplication &partition, Model& model) diff --git a/tests/balanced_coin_flips.cpp b/tests/balanced_coin_flips.cpp index f12078e4..dd4a2e47 100644 --- a/tests/balanced_coin_flips.cpp +++ b/tests/balanced_coin_flips.cpp @@ -34,7 +34,7 @@ bool thue_morse_gen(long unsigned int n) { n /= 2; } return bool(bin_sum%2); // (bits.count()%2); -}; +} BOOST_AUTO_TEST_CASE(Random_Biased_Coin) { std::cout << "True: " << true << " False: " << false << std::endl; @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(Random_Biased_Coin) { std::cout << Coin.get_flip(); } std::cout << std::endl << std::endl; -}; +} BOOST_AUTO_TEST_CASE(Thue__Morse) { Thue_Morse_Sequence Coin(0); @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(Thue__Morse) { BOOST_CHECK_EQUAL(Test_Coin_random.get_flip(), thue_morse_gen(ind)); // std::cout << "bye " << i << std::endl; } -}; +} BOOST_AUTO_TEST_CASE(Repeater_Coin) { @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(Repeater_Coin) { std::cout << Coin.get_flip(); } std::cout << std::endl << std::endl; -}; +} BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_1_1) { Biased_Random_with_side_bias Coin({1,1}); @@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_1_1) { std::cout << std::endl; std::cout << "True count: " << true_count << " False count: " << false_count << std::endl; std::cout << std::endl; -}; +} BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_1_0) { Biased_Random_with_side_bias Coin({1,0}); @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_1_0) { std::cout << std::endl; std::cout << "True count: " << true_count << " False count: " << false_count << std::endl; std::cout << std::endl; -}; +} BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_0_1) { @@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_0_1) { std::cout << std::endl; std::cout << "True count: " << true_count << " False count: " << false_count << std::endl; std::cout << std::endl; -}; +} BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_3_2) { @@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_3_2) { std::cout << std::endl; std::cout << "True count: " << true_count << " False count: " << false_count << std::endl; std::cout << std::endl; -}; +} BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_3_1) { Biased_Random_with_side_bias Coin({3,1}); @@ -185,4 +185,4 @@ BOOST_AUTO_TEST_CASE(Random_Biased_Coin_with_side_bias_3_1) { std::cout << std::endl; std::cout << "True count: " << true_count << " False count: " << false_count << std::endl; std::cout << std::endl; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/boost_graph_adaptor.cpp b/tests/boost_graph_adaptor.cpp index 47ae9a8b..5a1ea402 100644 --- a/tests/boost_graph_adaptor.cpp +++ b/tests/boost_graph_adaptor.cpp @@ -239,7 +239,7 @@ BOOST_AUTO_TEST_CASE(test_util_1) { BOOST_CHECK_EQUAL(has_path(7, 4, graph), false); BOOST_CHECK_EQUAL(has_path(7, 5, graph), false); BOOST_CHECK_EQUAL(has_path(7, 6, graph), false); -}; +} BOOST_AUTO_TEST_CASE(test_constr_dag) { diff --git a/tests/bsp_architecture.cpp b/tests/bsp_architecture.cpp index 1fd44124..af26e034 100644 --- a/tests/bsp_architecture.cpp +++ b/tests/bsp_architecture.cpp @@ -204,4 +204,4 @@ BOOST_AUTO_TEST_CASE(Architecture) { BOOST_CHECK_EQUAL(test.synchronisationCosts(), 2); BOOST_CHECK_EQUAL(test.sendCosts(4, 3), 1); BOOST_CHECK_EQUAL(test.isNumaArchitecture(), false); -}; +} diff --git a/tests/bsp_greedy_recomputer.cpp b/tests/bsp_greedy_recomputer.cpp index ea81a307..d411a2b5 100644 --- a/tests/bsp_greedy_recomputer.cpp +++ b/tests/bsp_greedy_recomputer.cpp @@ -93,4 +93,4 @@ BOOST_AUTO_TEST_CASE(test_recomputer) { BOOST_CHECK(schedule.satisfiesConstraints()); BOOST_CHECK(schedule.computeCosts() < schedule_init_cs2.computeCosts()); std::cout<<"Cost decrease by greedy recomp: "< "< schedule_cs(schedule_t2); sched_writer.write_schedule_cs(std::cout, schedule_cs); -}; +} BOOST_AUTO_TEST_CASE(test_bsp_schedule_cs) { @@ -329,7 +329,7 @@ BOOST_AUTO_TEST_CASE(test_bsp_schedule_cs) { BOOST_CHECK_EQUAL(schedule_cs_t2.assignedSuperstep(v), schedule.assignedSuperstep(v)); BOOST_CHECK_EQUAL(schedule_cs_t2.assignedProcessor(v), schedule.assignedProcessor(v)); } -}; +} BOOST_AUTO_TEST_CASE(test_max_bsp_schedule) { diff --git a/tests/bsp_schedule_recomp.cpp b/tests/bsp_schedule_recomp.cpp index d18ae0b6..13fa648b 100644 --- a/tests/bsp_schedule_recomp.cpp +++ b/tests/bsp_schedule_recomp.cpp @@ -71,4 +71,4 @@ BOOST_AUTO_TEST_CASE(BspScheduleRecomp_test) BOOST_CHECK(schedule_recomp_from_cs.satisfiesConstraints()); BOOST_CHECK_EQUAL(schedule_recomp_from_cs.computeCosts(), scheduleCS.computeCosts()); -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/bsp_schedulers.cpp b/tests/bsp_schedulers.cpp index 936bad69..d1fdbe4d 100644 --- a/tests/bsp_schedulers.cpp +++ b/tests/bsp_schedulers.cpp @@ -96,7 +96,7 @@ void run_test(Scheduler *test_scheduler) { BOOST_CHECK(schedule.satisfiesPrecedenceConstraints()); } } -}; +} template void run_test_2(Scheduler *test_scheduler) { @@ -145,7 +145,7 @@ void run_test_2(Scheduler *test_scheduler) { BOOST_CHECK(schedule.satisfiesPrecedenceConstraints()); } } -}; +} BOOST_AUTO_TEST_CASE(GreedyBspScheduler_test) { diff --git a/tests/bsp_schedulers_mem_const.cpp b/tests/bsp_schedulers_mem_const.cpp index 011b49c4..7e3dead3 100644 --- a/tests/bsp_schedulers_mem_const.cpp +++ b/tests/bsp_schedulers_mem_const.cpp @@ -113,7 +113,7 @@ void run_test_local_memory(Scheduler *test_scheduler) { } } } -}; +} template void run_test_persistent_transient_memory(Scheduler *test_scheduler) { @@ -172,7 +172,7 @@ void run_test_persistent_transient_memory(Scheduler *test_scheduler) { } } } -}; +} template void run_test_local_in_out_memory(Scheduler *test_scheduler) { @@ -231,7 +231,7 @@ void run_test_local_in_out_memory(Scheduler *test_scheduler) { } } } -}; +} template void run_test_local_inc_edges_memory(Scheduler *test_scheduler) { @@ -290,7 +290,7 @@ void run_test_local_inc_edges_memory(Scheduler *test_scheduler) { } } } -}; +} template void run_test_local_inc_edges_2_memory(Scheduler *test_scheduler) { @@ -349,7 +349,7 @@ void run_test_local_inc_edges_2_memory(Scheduler *test_scheduler) { } } } -}; +} BOOST_AUTO_TEST_CASE(GreedyBspScheduler_local_test) { @@ -366,7 +366,7 @@ BOOST_AUTO_TEST_CASE(GreedyBspScheduler_local_test) { GreedyBspScheduler> test_4; run_test_local_inc_edges_2_memory(&test_4); -}; +} BOOST_AUTO_TEST_CASE(GrowLocalAutoCores_local_test) { @@ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE(GrowLocalAutoCores_local_test) { GrowLocalAutoCores> test_4; run_test_local_inc_edges_2_memory(&test_4); -}; +} BOOST_AUTO_TEST_CASE(BspLocking_local_test) { @@ -400,7 +400,7 @@ BOOST_AUTO_TEST_CASE(BspLocking_local_test) { BspLocking> test_4; run_test_local_inc_edges_2_memory(&test_4); -}; +} BOOST_AUTO_TEST_CASE(variance_local_test) { @@ -408,7 +408,7 @@ BOOST_AUTO_TEST_CASE(variance_local_test) { local_memory_constraint> test; run_test_local_memory(&test); -}; +} // BOOST_AUTO_TEST_CASE(kl_local_test) { @@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(GreedyBspScheduler_persistent_transient_test) { persistent_transient_memory_constraint> test; run_test_persistent_transient_memory(&test); -}; +} BOOST_AUTO_TEST_CASE(EtfScheduler_persistent_transient_test) { @@ -438,7 +438,7 @@ BOOST_AUTO_TEST_CASE(EtfScheduler_persistent_transient_test) { persistent_transient_memory_constraint> test; run_test_persistent_transient_memory(&test); -}; +} BOOST_AUTO_TEST_CASE(VariancePartitioner_test) { diff --git a/tests/coarser.cpp b/tests/coarser.cpp index ec831a0e..a58f3706 100644 --- a/tests/coarser.cpp +++ b/tests/coarser.cpp @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(coarser_hdagg_test) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK(schedule2.satisfiesPrecedenceConstraints()); } -}; +} BOOST_AUTO_TEST_CASE(coarser_hdagg_test_diff_graph_impl) { // static_assert(std::is_base_of::value, "Class is not a scheduler!"); @@ -245,7 +245,7 @@ BOOST_AUTO_TEST_CASE(coarser_hdagg_test_diff_graph_impl) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK(schedule2.satisfiesPrecedenceConstraints()); } -}; +} BOOST_AUTO_TEST_CASE(coarser_bspschedule_test) { // static_assert(std::is_base_of::value, "Class is not a scheduler!"); @@ -322,7 +322,7 @@ BOOST_AUTO_TEST_CASE(coarser_bspschedule_test) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK(schedule2.satisfiesPrecedenceConstraints()); } -}; +} template void test_coarser_same_graph(Coarser &coarser) { @@ -395,7 +395,7 @@ void test_coarser_same_graph(Coarser &coarser) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK(schedule2.satisfiesPrecedenceConstraints()); } -}; +} BOOST_AUTO_TEST_CASE(coarser_funndel_bfs_test) { @@ -540,7 +540,7 @@ BOOST_AUTO_TEST_CASE(coarser_SquashA_test_diff_graph_impl_CSG) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK(schedule2.satisfiesPrecedenceConstraints()); } -}; +} BOOST_AUTO_TEST_CASE(coarser_SquashA_test_diff_graph_impl_CSGE) { // static_assert(std::is_base_of::value, "Class is not a scheduler!"); @@ -616,7 +616,7 @@ BOOST_AUTO_TEST_CASE(coarser_SquashA_test_diff_graph_impl_CSGE) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK(schedule2.satisfiesPrecedenceConstraints()); } -}; +} diff --git a/tests/compact_sparse_graph.cpp b/tests/compact_sparse_graph.cpp index 5f2162ad..e96db8be 100644 --- a/tests/compact_sparse_graph.cpp +++ b/tests/compact_sparse_graph.cpp @@ -29,14 +29,14 @@ BOOST_AUTO_TEST_CASE(Empty_Graph_keep_order) { BOOST_CHECK_EQUAL(graph.num_vertices(), 0); BOOST_CHECK_EQUAL(graph.num_edges(), 0); -}; +} BOOST_AUTO_TEST_CASE(Empty_Graph_reorder) { Compact_Sparse_Graph graph; BOOST_CHECK_EQUAL(graph.num_vertices(), 0); BOOST_CHECK_EQUAL(graph.num_edges(), 0); -}; +} BOOST_AUTO_TEST_CASE(No_Edges_Graph_keep_order) { const std::vector> edges({}); @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(No_Edges_Graph_keep_order) { BOOST_CHECK_EQUAL(graph.num_vertices(), 10); BOOST_CHECK_EQUAL(graph.num_edges(), 0); -}; +} BOOST_AUTO_TEST_CASE(No_Edges_Graph_reorder) { const std::vector> edges({}); @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(No_Edges_Graph_reorder) { std::iota(perm.begin(), perm.end(), 0); const std::vector &graph_perm = graph.get_pullback_permutation(); BOOST_CHECK(std::is_permutation(perm.cbegin(), perm.cend(), graph_perm.cbegin(), graph_perm.cend())); -}; +} BOOST_AUTO_TEST_CASE(LineGraph_keep_order) { const std::set> edges({{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}}); @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(LineGraph_keep_order) { for (const auto &vert : graph.vertices()) { BOOST_CHECK_EQUAL(graph.vertex_type(vert), 0); } -}; +} BOOST_AUTO_TEST_CASE(LineGraph_reorder) { @@ -228,7 +228,7 @@ BOOST_AUTO_TEST_CASE(LineGraph_reorder) { for (const auto &vert : graph.vertices()) { BOOST_CHECK_EQUAL(perm[vert], graph_perm[vert]); } -}; +} BOOST_AUTO_TEST_CASE(Graph1_keep_order) { @@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(Graph1_keep_order) { for (const auto &vert : graph.vertices()) { BOOST_CHECK_EQUAL(graph.vertex_type(vert), 0); } -}; +} BOOST_AUTO_TEST_CASE(Graph1_reorder) { const std::vector> edges({{0, 1}, {2, 3}, {6, 10}, {7, 9}, {0, 2}, {4, 6}, {1, 6}, {6, 7}, {5, 6}, {3, 7}, {1, 2}}); @@ -451,7 +451,7 @@ BOOST_AUTO_TEST_CASE(Graph1_reorder) { for (const auto &vert : graph.vertices()) { BOOST_CHECK_EQUAL(graph.vertex_type(vert), 0); } -}; +} BOOST_AUTO_TEST_CASE(Graph_edge_contruction) { @@ -1026,7 +1026,7 @@ BOOST_AUTO_TEST_CASE(Graph1_copy_keep_order) { for (const auto &vert : copy_graph.vertices()) { BOOST_CHECK_EQUAL(copy_graph.vertex_type(vert), 0); } -}; +} BOOST_AUTO_TEST_CASE(Graph1_move_keep_order) { const std::vector> edges({{0, 1}, {2, 3}, {6, 10}, {7, 9}, {0, 2}, {4, 6}, {1, 6}, {6, 7}, {5, 6}, {3, 7}, {1, 2}}); @@ -1097,7 +1097,7 @@ BOOST_AUTO_TEST_CASE(Graph1_move_keep_order) { for (const auto &vert : copy_graph.vertices()) { BOOST_CHECK_EQUAL(copy_graph.vertex_type(vert), 0); } -}; +} BOOST_AUTO_TEST_CASE(Graph1_copy_reorder) { @@ -1192,7 +1192,7 @@ BOOST_AUTO_TEST_CASE(Graph1_copy_reorder) { for (const auto &vert : graph.vertices()) { BOOST_CHECK_EQUAL(graph.vertex_type(vert), 0); } -}; +} BOOST_AUTO_TEST_CASE(Graph1_move_reorder) { @@ -1287,4 +1287,4 @@ BOOST_AUTO_TEST_CASE(Graph1_move_reorder) { for (const auto &vert : graph.vertices()) { BOOST_CHECK_EQUAL(graph.vertex_type(vert), 0); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/compact_sparse_graph_edge_desc.cpp b/tests/compact_sparse_graph_edge_desc.cpp index 2315ffa3..ffacfb45 100644 --- a/tests/compact_sparse_graph_edge_desc.cpp +++ b/tests/compact_sparse_graph_edge_desc.cpp @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(Empty_Graph_keep_order) { BOOST_CHECK_EQUAL(edge, 100); } } -}; +} BOOST_AUTO_TEST_CASE(Empty_Graph_reorder) { Compact_Sparse_Graph_EdgeDesc graph; @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(Empty_Graph_reorder) { BOOST_CHECK_EQUAL(edge, 100); } } -}; +} BOOST_AUTO_TEST_CASE(No_Edges_Graph_keep_order) { const std::vector> edges({}); @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(No_Edges_Graph_keep_order) { } BOOST_CHECK_EQUAL(vert_counter, graph.num_vertices()); -}; +} BOOST_AUTO_TEST_CASE(No_Edges_Graph_reorder) { const std::vector> edges({}); @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(No_Edges_Graph_reorder) { std::iota(perm.begin(), perm.end(), 0); const std::vector &graph_perm = graph.get_pullback_permutation(); BOOST_CHECK(std::is_permutation(perm.cbegin(), perm.cend(), graph_perm.cbegin(), graph_perm.cend())); -}; +} BOOST_AUTO_TEST_CASE(LineGraph_keep_order) { const std::vector> edges({{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}}); @@ -269,7 +269,7 @@ BOOST_AUTO_TEST_CASE(LineGraph_keep_order) { ++vert_counter; } BOOST_CHECK_EQUAL(vert_counter, graph.num_vertices()); -}; +} BOOST_AUTO_TEST_CASE(LineGraph_reorder) { @@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(LineGraph_reorder) { ++vert_counter; } BOOST_CHECK_EQUAL(vert_counter, graph.num_vertices()); -}; +} BOOST_AUTO_TEST_CASE(Graph1_keep_order) { @@ -508,7 +508,7 @@ BOOST_AUTO_TEST_CASE(Graph1_keep_order) { for (const auto &vert : graph.vertices()) { BOOST_CHECK_EQUAL(graph.vertex_type(vert), 0); } -}; +} BOOST_AUTO_TEST_CASE(Graph1_reorder) { const std::vector> edges({{0, 1}, {2, 3}, {6, 10}, {7, 9}, {0, 2}, {4, 6}, {1, 6}, {6, 7}, {5, 6}, {3, 7}, {1, 2}}); @@ -662,7 +662,7 @@ BOOST_AUTO_TEST_CASE(Graph1_reorder) { } } BOOST_CHECK_EQUAL(edge_cntr, graph.num_edges()); -}; +} BOOST_AUTO_TEST_CASE(Graph1_e_comm_keep_order) { const std::vector> edges({{0, 1}, {2, 3}, {6, 10}, {7, 9}, {0, 2}, {4, 6}, {1, 6}, {6, 7}, {5, 6}, {3, 7}, {1, 2}}); @@ -688,7 +688,7 @@ BOOST_AUTO_TEST_CASE(Graph1_e_comm_keep_order) { auto ind = std::distance(edges.cbegin(), it); BOOST_CHECK_EQUAL(edge_weights[static_cast(ind)], graph.edge_comm_weight(edge)); } -}; +} BOOST_AUTO_TEST_CASE(Graph1_e_comm_reorder) { @@ -720,4 +720,4 @@ BOOST_AUTO_TEST_CASE(Graph1_e_comm_reorder) { auto ind = std::distance(edges.cbegin(), it); BOOST_CHECK_EQUAL(edge_weights[static_cast(ind)], graph.edge_comm_weight(edge)); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/cuthill_mckee.cpp b/tests/cuthill_mckee.cpp index 9dc3e544..c6b2f019 100644 --- a/tests/cuthill_mckee.cpp +++ b/tests/cuthill_mckee.cpp @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(cuthill_mckee_1) { expected_cm_undirected = {0, 3, 1, 2, 7, 6, 4, 5, 8, 9, 10}; BOOST_CHECK_EQUAL_COLLECTIONS(cm_undirected.begin(), cm_undirected.end(), expected_cm_undirected.begin(), expected_cm_undirected.end()); -}; +} bool is_permutation(const std::vector &vec) { std::vector sorted_vec = vec; @@ -182,4 +182,4 @@ BOOST_AUTO_TEST_CASE(cuthill_mckee_2) { BOOST_CHECK(is_permutation(top_sort)); BOOST_CHECK(is_top_sort(top_sort, graph)); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/directed_graph_algorithms.cpp b/tests/directed_graph_algorithms.cpp index 01a59baf..0b246503 100644 --- a/tests/directed_graph_algorithms.cpp +++ b/tests/directed_graph_algorithms.cpp @@ -84,4 +84,4 @@ BOOST_AUTO_TEST_CASE(longest_edge_triangle_parallel) { BOOST_CHECK(deleted_edges.find(edge) != deleted_edges.cend()); } } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/directed_graph_top_sort.cpp b/tests/directed_graph_top_sort.cpp index fb013ead..0925d1ae 100644 --- a/tests/directed_graph_top_sort.cpp +++ b/tests/directed_graph_top_sort.cpp @@ -60,14 +60,14 @@ computational_dag_vector_impl_def_t constr_graph_1() { graph.add_edge(v4, v8); return graph; -}; +} BOOST_AUTO_TEST_CASE(test_util_1) { const computational_dag_vector_impl_def_t graph = constr_graph_1(); // using vertex_idx = computational_dag_vector_impl_def_t::vertex_idx; -}; +} BOOST_AUTO_TEST_CASE(ComputationalDagConstructor) { diff --git a/tests/directed_graph_util.cpp b/tests/directed_graph_util.cpp index 9b130f06..353e202c 100644 --- a/tests/directed_graph_util.cpp +++ b/tests/directed_graph_util.cpp @@ -60,7 +60,7 @@ computational_dag_vector_impl_def_t constr_graph_1() { graph.add_edge(v4, v8); return graph; -}; +} BOOST_AUTO_TEST_CASE(test_empty_graph) { @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(test_empty_graph) { BOOST_CHECK_EQUAL(is_acyclic(graph), true); BOOST_CHECK_EQUAL(is_connected(graph), true); -}; +} BOOST_AUTO_TEST_CASE(test_util_1) { @@ -420,7 +420,7 @@ BOOST_AUTO_TEST_CASE(test_util_1) { graph.add_vertex(1, 2, 3, 4); BOOST_CHECK_EQUAL(is_connected(graph), false); -}; +} BOOST_AUTO_TEST_CASE(ComputationalDagConstructor) { diff --git a/tests/filereader.cpp b/tests/filereader.cpp index 3d247d78..6e64fd63 100644 --- a/tests/filereader.cpp +++ b/tests/filereader.cpp @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(test_mtx_computational_dag_vector_impl) { BOOST_CHECK_EQUAL_COLLECTIONS(graph.parents(7).begin(), graph.parents(7).end(), p7.begin(), p7.end()); BOOST_CHECK_EQUAL_COLLECTIONS(graph.children(7).begin(), graph.children(7).end(), c7.begin(), c7.end()); -}; +} BOOST_AUTO_TEST_CASE(test_mtx_boost_graph) { @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(test_mtx_boost_graph) { BOOST_CHECK_EQUAL_COLLECTIONS(graph.parents(7).begin(), graph.parents(7).end(), p7.begin(), p7.end()); BOOST_CHECK_EQUAL_COLLECTIONS(graph.children(7).begin(), graph.children(7).end(), c7.begin(), c7.end()); -}; +} @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(test_bicgstab) { BOOST_CHECK(status); BOOST_CHECK_EQUAL(graph.num_vertices(), 54); -}; +} BOOST_AUTO_TEST_CASE(test_hdag_boost) { @@ -213,7 +213,7 @@ BOOST_AUTO_TEST_CASE(test_hdag_boost) { BOOST_CHECK(status); BOOST_CHECK_EQUAL(graph.num_vertices(), 54); -}; +} BOOST_AUTO_TEST_CASE(test_arch_smpl) { @@ -296,7 +296,7 @@ BOOST_AUTO_TEST_CASE(test_k_means) { BOOST_CHECK_EQUAL(graph2.vertex_work_weight(v), work[v]); BOOST_CHECK_EQUAL(graph2.vertex_comm_weight(v), comm[v]); } -}; +} BOOST_AUTO_TEST_CASE(test_dot_graph) { @@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(test_dot_graph) { } -}; +} BOOST_AUTO_TEST_CASE(test_dot_graph_boost) { @@ -364,4 +364,4 @@ BOOST_AUTO_TEST_CASE(test_dot_graph_boost) { } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/graph_vector_edge_desc_impl.cpp b/tests/graph_vector_edge_desc_impl.cpp index f2eef94d..d079bf1a 100644 --- a/tests/graph_vector_edge_desc_impl.cpp +++ b/tests/graph_vector_edge_desc_impl.cpp @@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(test_util_1) { BOOST_CHECK_EQUAL(long_edges.size(), 0); -}; +} BOOST_AUTO_TEST_CASE(test_constr_dag) { diff --git a/tests/graph_vector_impl.cpp b/tests/graph_vector_impl.cpp index 9a77a3ec..9e2131e7 100644 --- a/tests/graph_vector_impl.cpp +++ b/tests/graph_vector_impl.cpp @@ -56,7 +56,7 @@ computational_dag_vector_impl_def_t constr_graph_1() { graph.add_edge(v4, v8); return graph; -}; +} BOOST_AUTO_TEST_CASE(test_empty_dag) { @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(test_empty_dag) { idx++; } BOOST_CHECK_EQUAL(idx, 0); -}; +} BOOST_AUTO_TEST_CASE(test_dag) { @@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE(test_dag) { } BOOST_CHECK_EQUAL(count, 9); -}; +} BOOST_AUTO_TEST_CASE(test_constr_dag) { @@ -257,4 +257,4 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { count++; } BOOST_CHECK_EQUAL(count, 9); -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/hill_climbing.cpp b/tests/hill_climbing.cpp index de4d8117..7a108ba9 100644 --- a/tests/hill_climbing.cpp +++ b/tests/hill_climbing.cpp @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(hill_climbing) { scheduler.improveScheduleWithStepLimit(schedule4, 5); BOOST_CHECK_EQUAL(schedule4.satisfiesPrecedenceConstraints(), true); -}; +} BOOST_AUTO_TEST_CASE(hill_climbing_for_comm_schedule) { @@ -125,4 +125,4 @@ BOOST_AUTO_TEST_CASE(hill_climbing_for_comm_schedule) { hc_cs.improveSchedule(schedule2); BOOST_CHECK_EQUAL(schedule2.hasValidCommSchedule(), true); -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/hypergraph_and_partition.cpp b/tests/hypergraph_and_partition.cpp index 4f804a2a..10e4cb4a 100644 --- a/tests/hypergraph_and_partition.cpp +++ b/tests/hypergraph_and_partition.cpp @@ -211,4 +211,4 @@ BOOST_AUTO_TEST_CASE(Hypergraph_and_Partition_test) { std::cout< "< filenames_graph = large_spaa_graphs(); diff --git a/tests/kl_total.cpp b/tests/kl_total.cpp index 6204e112..5d3d1486 100644 --- a/tests/kl_total.cpp +++ b/tests/kl_total.cpp @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(kl_improver_smoke_test) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK_EQUAL(schedule.satisfiesPrecedenceConstraints(), true); -}; +} BOOST_AUTO_TEST_CASE(kl_improver_on_test_graphs) { @@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE(kl_improver_superstep_removal_test) { BOOST_CHECK(status == RETURN_STATUS::OSP_SUCCESS || status == RETURN_STATUS::BEST_FOUND); BOOST_CHECK(schedule.satisfiesPrecedenceConstraints()); BOOST_CHECK_LT(schedule.numberOfSupersteps(), original_steps); -}; +} BOOST_AUTO_TEST_CASE(kl_improver_inner_loop_test) { @@ -325,7 +325,7 @@ BOOST_AUTO_TEST_CASE(kl_improver_inner_loop_test) { BOOST_CHECK_CLOSE(kl.get_comm_cost_f().compute_schedule_cost_test(), kl.get_current_cost(), 0.00001); -}; +} BOOST_AUTO_TEST_CASE(kl_improver_inner_loop_penalty_test) { @@ -412,7 +412,7 @@ BOOST_AUTO_TEST_CASE(kl_improver_inner_loop_penalty_test) { BOOST_CHECK_CLOSE(kl.get_comm_cost_f().compute_schedule_cost_test(), kl.get_current_cost(), 0.00001); -}; +} BOOST_AUTO_TEST_CASE(kl_improver_violation_handling_test) { @@ -464,7 +464,7 @@ BOOST_AUTO_TEST_CASE(kl_improver_violation_handling_test) { kl_improver.improveSchedule(schedule); BOOST_CHECK(schedule.satisfiesPrecedenceConstraints()); -}; +} BOOST_AUTO_TEST_CASE(kl_base_1) { @@ -560,7 +560,7 @@ BOOST_AUTO_TEST_CASE(kl_base_1) { kl_move move_5(v1, 7.0, 1, 0, 0, 0); kl.apply_move_test(move_5); BOOST_CHECK_EQUAL(kl.is_feasible(), true); -}; +} BOOST_AUTO_TEST_CASE(kl_base_2) { @@ -725,7 +725,7 @@ BOOST_AUTO_TEST_CASE(kl_base_2) { BOOST_CHECK_CLOSE(affinity[v8][1][0], 8.0, 0.00001); BOOST_CHECK_CLOSE(affinity[v8][1][1], 1.0, 0.00001); -}; +} BOOST_AUTO_TEST_CASE(kl_base_3) { @@ -842,7 +842,7 @@ BOOST_AUTO_TEST_CASE(kl_base_3) { BOOST_CHECK_CLOSE(affinity[v8][1][0], 8.0, 0.00001); BOOST_CHECK_CLOSE(affinity[v8][1][1], 1.0, 0.00001); -}; +} // BOOST_AUTO_TEST_CASE(kl_improver_incremental_update_test) { diff --git a/tests/merkle_hash_computer.cpp b/tests/merkle_hash_computer.cpp index dce41f2b..29b26b62 100644 --- a/tests/merkle_hash_computer.cpp +++ b/tests/merkle_hash_computer.cpp @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(BspScheduleRecomp_test) BOOST_CHECK(m_hash.get_vertex_hash(3) != m_hash.get_vertex_hash(12)); BOOST_CHECK(m_hash.get_vertex_hash(53) != m_hash.get_vertex_hash(29)); -}; +} BOOST_AUTO_TEST_CASE(MerkleHashComputer_test_fw_bw_precomp) { @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(MerkleHashComputer_test_fw_bw_precomp) BOOST_CHECK_EQUAL(num, graph.num_vertices()); -}; +} using graph = computational_dag_vector_impl_def_t; diff --git a/tests/pebbling_schedule_class.cpp b/tests/pebbling_schedule_class.cpp index 653731e2..ce180370 100644 --- a/tests/pebbling_schedule_class.cpp +++ b/tests/pebbling_schedule_class.cpp @@ -121,7 +121,7 @@ void run_test(Scheduler *test_scheduler) { BOOST_CHECK(memSchedule6.isValid()); } } -}; +} BOOST_AUTO_TEST_CASE(GreedyBspScheduler_test) { @@ -168,4 +168,4 @@ BOOST_AUTO_TEST_CASE(test_pebbling_schedule_writer) { std::cout << "Writing pebbling schedule" << std::endl; file_writer::write_txt(std::cout, memSchedule); -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/random_graph_gen.cpp b/tests/random_graph_gen.cpp index 6a8ac8d1..7f3a1b01 100644 --- a/tests/random_graph_gen.cpp +++ b/tests/random_graph_gen.cpp @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(Erdos_Renyi_graph_test) { BOOST_CHECK_EQUAL(graph.num_vertices(), graph_sizes[i]); BOOST_CHECK_EQUAL(is_acyclic(graph), true); } -}; +} BOOST_AUTO_TEST_CASE(near_diag_random_graph_test) { @@ -60,4 +60,4 @@ BOOST_AUTO_TEST_CASE(near_diag_random_graph_test) { BOOST_CHECK_EQUAL(graph.num_vertices(), graph_sizes[i]); BOOST_CHECK_EQUAL(is_acyclic(graph), true); } -}; +} diff --git a/tests/sptrsv.cpp b/tests/sptrsv.cpp index ad5db2d2..f6dc8e17 100644 --- a/tests/sptrsv.cpp +++ b/tests/sptrsv.cpp @@ -59,7 +59,7 @@ bool compare_vectors(Eigen::VectorXd &v1, Eigen::VectorXd &v2) { } } return same; -}; +} BOOST_AUTO_TEST_CASE(test_eigen_sptrsv) { using SM_csr = Eigen::SparseMatrix; @@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(test_eigen_sptrsv) { sim.permute_x_vector(perm); BOOST_CHECK(compare_vectors(L_x_ref,L_x_osp)); -}; +} diff --git a/tests/stepbystep_coarsen_and_multilevel.cpp b/tests/stepbystep_coarsen_and_multilevel.cpp index 5f1d48ce..bfc4931f 100644 --- a/tests/stepbystep_coarsen_and_multilevel.cpp +++ b/tests/stepbystep_coarsen_and_multilevel.cpp @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(StepByStepCoarser_test) { coarser.coarsenForPebbling(DAG, coarsened_dag2, new_vertex_id); old_vertex_ids = coarser_util::invert_vertex_contraction_map(new_vertex_id); -}; +} BOOST_AUTO_TEST_CASE(Multilevel_test) { @@ -113,4 +113,4 @@ BOOST_AUTO_TEST_CASE(Multilevel_test) { BOOST_CHECK_EQUAL(RETURN_STATUS::OSP_SUCCESS, result); BOOST_CHECK(schedule2.satisfiesPrecedenceConstraints()); -}; \ No newline at end of file +} \ No newline at end of file From bd6d0a7761500597171e44203f0f52121b56771f Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Mon, 10 Nov 2025 16:19:50 +0100 Subject: [PATCH 04/20] wshadow --- CMakeLists.txt | 16 +++---- .../graph_generator/gen_Erdos-Renyi_graph.cpp | 4 +- .../gen_near_diag_random_graph.cpp | 8 ++-- .../StatsModules/BspSptrsvStatsModule.hpp | 4 +- .../osp/auxiliary/sptrsv_simulator/sptrsv.hpp | 18 +++---- .../GreedySchedulers/GreedyBspScheduler.hpp | 2 +- .../KernighanLin/kl_current_schedule.hpp | 8 ++-- .../comm_cost_modules/kl_total_comm_cost.hpp | 1 - .../KernighanLin_v2/kl_active_schedule.hpp | 10 ++-- include/osp/coarser/BspScheduleCoarser.hpp | 2 +- include/osp/coarser/Sarkar/Sarkar.hpp | 8 ++-- .../coarser/StepByStep/StepByStepCoarser.hpp | 8 ++-- .../ConnectedComponentScheduler.hpp | 2 +- .../OrbitGraphProcessor.hpp | 18 +++---- ...computational_dag_edge_idx_vector_impl.hpp | 6 +-- include/osp/partitioning/model/hypergraph.hpp | 20 ++++---- include/osp/pebbling/PebblingSchedule.hpp | 6 +-- tests/compact_sparse_graph.cpp | 48 +++++++++---------- tests/compact_sparse_graph_edge_desc.cpp | 16 +++---- 19 files changed, 102 insertions(+), 103 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f5f07c3..fd831fec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,14 +40,14 @@ set(COMMON_CXX_WARNING_FLAGS "-Wunreachable-code" "-Wuninitialized" "-Wshadow" - "-Wfloat-equal" - "-Wnon-virtual-dtor" - "-pedantic" - "-Wpedantic" - "-Wold-style-cast" - "-Wcast-align" - "-Wduplicated-cond" - "-Wduplicated-branches" + # "-Wfloat-equal" + # "-Wnon-virtual-dtor" + # "-pedantic" + # "-Wpedantic" + # "-Wold-style-cast" + # "-Wcast-align" + # "-Wduplicated-cond" + # "-Wduplicated-branches" "-Werror" ) diff --git a/apps/graph_generator/gen_Erdos-Renyi_graph.cpp b/apps/graph_generator/gen_Erdos-Renyi_graph.cpp index 84f67ad8..5a429624 100644 --- a/apps/graph_generator/gen_Erdos-Renyi_graph.cpp +++ b/apps/graph_generator/gen_Erdos-Renyi_graph.cpp @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) { std::uniform_real_distribution unif_log(-std::log(upper_bound), std::log(upper_bound)); std::default_random_engine re; - for (size_t i = 0; i < num_graphs; i++) { + for (size_t j = 0; j < num_graphs; j++) { // Generating the graph ComputationalDag graph; erdos_renyi_graph_gen(graph, num_vert, chance); @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) { } graph_name += graph_edge_size; - graph_name += std::to_string(i); + graph_name += std::to_string(j); graph_name += ".mtx"; diff --git a/apps/graph_generator/gen_near_diag_random_graph.cpp b/apps/graph_generator/gen_near_diag_random_graph.cpp index 3ce7bdf4..20b9029f 100644 --- a/apps/graph_generator/gen_near_diag_random_graph.cpp +++ b/apps/graph_generator/gen_near_diag_random_graph.cpp @@ -105,12 +105,12 @@ int main(int argc, char *argv[]) { graph_write << header; graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_edges() + graph.num_vertices()) + "\n"; - for (VertexType i = 0; i < num_vert; i++) { + for (VertexType j = 0; j < num_vert; j++) { double val = (1 - 2 * randInt(2)) * std::exp(unif_log(re)); - graph_write << std::to_string(i + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) + "\n"; - for (const auto &chld : graph.children(i)) { + graph_write << std::to_string(j + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) + "\n"; + for (const auto &chld : graph.children(j)) { val = unif(re); - graph_write << std::to_string(chld + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) + + graph_write << std::to_string(chld + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) + "\n"; } } diff --git a/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp b/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp index ebb1dbb5..8839ba39 100644 --- a/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp +++ b/apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp @@ -71,8 +71,8 @@ bool compare_vectors(Eigen::VectorXd &v1, Eigen::VectorXd &v2) { template class BspSptrsvStatsModule : public IStatisticModule { public: - explicit BspSptrsvStatsModule(SCHEDULE_NODE_PERMUTATION_MODES mode = NO_PERMUTE) - : mode(mode) {} + explicit BspSptrsvStatsModule(SCHEDULE_NODE_PERMUTATION_MODES _mode = NO_PERMUTE) + : mode(_mode) {} std::vector get_metric_headers() const override { diff --git a/include/osp/auxiliary/sptrsv_simulator/sptrsv.hpp b/include/osp/auxiliary/sptrsv_simulator/sptrsv.hpp index d363b5e7..175f5335 100644 --- a/include/osp/auxiliary/sptrsv_simulator/sptrsv.hpp +++ b/include/osp/auxiliary/sptrsv_simulator/sptrsv.hpp @@ -396,13 +396,13 @@ class Sptrsv { const size_t proc = static_cast(omp_get_thread_num()); const uVertType upper_limit = step_proc_ptr[step][proc] + step_proc_num[step][proc]; - for (uVertType row_idx = step_proc_ptr[step][proc]; row_idx < upper_limit; row_idx++) { + for (uVertType _row_idx = step_proc_ptr[step][proc]; _row_idx < upper_limit; _row_idx++) { - for (uVertType i = row_ptr[row_idx]; i < row_ptr[row_idx + 1] - 1; i++) { - x[row_idx] -= val[i] * x[col_idx[i]]; + for (uVertType i = row_ptr[_row_idx]; i < row_ptr[_row_idx + 1] - 1; i++) { + x[_row_idx] -= val[i] * x[col_idx[i]]; } - x[row_idx] /= val[row_ptr[row_idx + 1] - 1]; + x[_row_idx] /= val[row_ptr[_row_idx + 1] - 1]; } #pragma omp barrier @@ -417,13 +417,13 @@ class Sptrsv { const size_t proc = static_cast(omp_get_thread_num()); const uVertType upper_limit = step_proc_ptr[step][proc] + step_proc_num[step][proc]; - for (uVertType row_idx = step_proc_ptr[step][proc]; row_idx < upper_limit; row_idx++) { - x[row_idx] = b[row_idx]; - for (uVertType i = row_ptr[row_idx]; i < row_ptr[row_idx + 1] - 1; i++) { - x[row_idx] -= val[i] * x[col_idx[i]]; + for (uVertType _row_idx = step_proc_ptr[step][proc]; _row_idx < upper_limit; _row_idx++) { + x[_row_idx] = b[_row_idx]; + for (uVertType i = row_ptr[_row_idx]; i < row_ptr[_row_idx + 1] - 1; i++) { + x[_row_idx] -= val[i] * x[col_idx[i]]; } - x[row_idx] /= val[row_ptr[row_idx + 1] - 1]; + x[_row_idx] /= val[row_ptr[_row_idx + 1] - 1]; } #pragma omp barrier diff --git a/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp b/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp index 27489355..24cc2501 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp @@ -62,7 +62,7 @@ class GreedyBspScheduler : public Scheduler { double score; heap_node() : node(0), score(0) {} - heap_node(VertexType node, double score) : node(node), score(score) {} + heap_node(VertexType node_arg, double score_arg) : node(node_arg), score(score_arg) {} bool operator<(heap_node const &rhs) const { return (score < rhs.score) || (score <= rhs.score and node < rhs.node); diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp index 44358366..af5bfd19 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_current_schedule.hpp @@ -43,10 +43,10 @@ struct kl_move { unsigned to_step; kl_move() : node(0), gain(0), change_in_cost(0), from_proc(0), from_step(0), to_proc(0), to_step(0) {} - kl_move(vertex_idx_t node, double gain, double change_cost, unsigned from_proc, unsigned from_step, - unsigned to_proc, unsigned to_step) - : node(node), gain(gain), change_in_cost(change_cost), from_proc(from_proc), from_step(from_step), - to_proc(to_proc), to_step(to_step) {} + kl_move(vertex_idx_t _node, double _gain, double _change_cost, unsigned _from_proc, unsigned _from_step, + unsigned _to_proc, unsigned _to_step) + : node(_node), gain(_gain), change_in_cost(_change_cost), from_proc(_from_proc), from_step(_from_step), + to_proc(_to_proc), to_step(_to_step) {} bool operator<(kl_move const &rhs) const { return (gain < rhs.gain) or (gain <= rhs.gain and change_in_cost < rhs.change_in_cost) or diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_total_comm_cost.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_total_comm_cost.hpp index b6542330..7d0d61ea 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_total_comm_cost.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_total_comm_cost.hpp @@ -301,7 +301,6 @@ struct kl_total_comm_cost_function { const cost_t comm_gain = graph->vertex_comm_weight(source) * comm_multiplier; unsigned idx = start_idx(source_step, start_step); - const unsigned window_bound = end_idx(source_step, end_step); for (; idx < window_bound; idx++) { for (const unsigned p : proc_range->compatible_processors_vertex(source)) { const cost_t x = change_comm_cost(instance->communicationCosts(p, move.to_proc), to_proc_source_comm_cost, comm_gain); diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp index 1c828eef..6fe460f8 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_active_schedule.hpp @@ -42,10 +42,10 @@ struct kl_move_struct { unsigned to_step; kl_move_struct() : node(0), gain(0), from_proc(0), from_step(0), to_proc(0), to_step(0) {} - kl_move_struct(vertex_idx_t node, cost_t gain, unsigned from_proc, unsigned from_step, - unsigned to_proc, unsigned to_step) - : node(node), gain(gain), from_proc(from_proc), from_step(from_step), - to_proc(to_proc), to_step(to_step) {} + kl_move_struct(vertex_idx_t _node, cost_t _gain, unsigned _from_proc, unsigned _from_step, + unsigned _to_proc, unsigned _to_step) + : node(_node), gain(_gain), from_proc(_from_proc), from_step(_from_step), + to_proc(_to_proc), to_step(_to_step) {} bool operator<(kl_move_struct const &rhs) const { return (gain < rhs.gain) or (gain == rhs.gain and node > rhs.node); @@ -95,7 +95,7 @@ struct kl_active_schedule_work_datastructures { unsigned proc; weight_proc() : work(0), proc(0) {} - weight_proc(work_weight_t work, unsigned proc) : work(work), proc(proc) {} + weight_proc(work_weight_t _work, unsigned _proc) : work(_work), proc(_proc) {} bool operator<(weight_proc const &rhs) const { return (work > rhs.work) or (work == rhs.work and proc < rhs.proc); diff --git a/include/osp/coarser/BspScheduleCoarser.hpp b/include/osp/coarser/BspScheduleCoarser.hpp index 92dc305a..64684b7a 100644 --- a/include/osp/coarser/BspScheduleCoarser.hpp +++ b/include/osp/coarser/BspScheduleCoarser.hpp @@ -38,7 +38,7 @@ class BspScheduleCoarser : public CoarserGenContractionMap *schedule; public: - BspScheduleCoarser(const BspSchedule &schedule) : schedule(&schedule) {} + BspScheduleCoarser(const BspSchedule &_schedule) : schedule(&_schedule) {} /** * @brief Destructor for the Coarser class. diff --git a/include/osp/coarser/Sarkar/Sarkar.hpp b/include/osp/coarser/Sarkar/Sarkar.hpp index 930a1186..2cd925fe 100644 --- a/include/osp/coarser/Sarkar/Sarkar.hpp +++ b/include/osp/coarser/Sarkar/Sarkar.hpp @@ -720,8 +720,8 @@ vertex_idx_t Sarkar::someChildrenContractio } } - for (std::size_t i = 1; i < contractionEnsemble.size(); i++) { - for (const VertexType &chld : graph.children(contractionEnsemble[i])) { + for (std::size_t j = 1; j < contractionEnsemble.size(); j++) { + for (const VertexType &chld : graph.children(contractionEnsemble[j])) { maxChildDist = std::max(maxChildDist, botDist[chld] + commCost); } } @@ -895,8 +895,8 @@ vertex_idx_t Sarkar::someParentsContraction } } - for (std::size_t i = 1; i < contractionEnsemble.size(); i++) { - for (const VertexType &par : graph.parents(contractionEnsemble[i])) { + for (std::size_t j = 1; j < contractionEnsemble.size(); j++) { + for (const VertexType &par : graph.parents(contractionEnsemble[j])) { maxParentDist = std::max(maxParentDist, topDist[par] + commCost); } } diff --git a/include/osp/coarser/StepByStep/StepByStepCoarser.hpp b/include/osp/coarser/StepByStep/StepByStepCoarser.hpp index 8513c753..b5d77937 100644 --- a/include/osp/coarser/StepByStep/StepByStepCoarser.hpp +++ b/include/osp/coarser/StepByStep/StepByStepCoarser.hpp @@ -387,9 +387,9 @@ std::set > StepByStepCoarser::getContractableChil } while (!Queue.empty()) { - const vertex_idx node = Queue.front(); + const vertex_idx node_local = Queue.front(); Queue.pop_front(); - for (vertex_idx succ : G_coarse.children(node)) { + for (vertex_idx succ : G_coarse.children(node_local)) { succ_contractable.erase(succ); @@ -426,9 +426,9 @@ std::set > StepByStepCoarser::getContractablePare } while (!Queue.empty()) { - const vertex_idx node = Queue.front(); + const vertex_idx node_local = Queue.front(); Queue.pop_front(); - for (vertex_idx pred : G_coarse.parents(node)) { + for (vertex_idx pred : G_coarse.parents(node_local)) { pred_contractable.erase(pred); diff --git a/include/osp/dag_divider/ConnectedComponentScheduler.hpp b/include/osp/dag_divider/ConnectedComponentScheduler.hpp index b3e190a2..1100309e 100644 --- a/include/osp/dag_divider/ConnectedComponentScheduler.hpp +++ b/include/osp/dag_divider/ConnectedComponentScheduler.hpp @@ -31,7 +31,7 @@ class ConnectedComponentScheduler : public Scheduler { Scheduler *scheduler; public: - ConnectedComponentScheduler(Scheduler &scheduler) : scheduler(&scheduler) {} + ConnectedComponentScheduler(Scheduler &_scheduler) : scheduler(&_scheduler) {} std::string getScheduleName() const override { return "SubDagScheduler"; } diff --git a/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp b/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp index f1b35993..a6b75e58 100644 --- a/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp +++ b/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp @@ -78,7 +78,7 @@ class OrbitGraphProcessor { size_t min_symmetry_ = 2; // min symmetry threshold v_workw_t work_threshold_ = 0; v_workw_t critical_path_threshold_ = 0; - bool merge_different_node_types = true; + bool merge_different_node_types_ = true; double lock_orbit_ratio = 0.2; struct PairHasher { @@ -208,7 +208,7 @@ class OrbitGraphProcessor { if constexpr (has_typed_vertices_v) { - if (not merge_different_node_types) { + if (not merge_different_node_types_) { if (current_coarse_graph.vertex_type(u) != current_coarse_graph.vertex_type(v)) { if constexpr (verbose) { std::cout << " - Merge of " << u << " and " << v << " not viable (different node types)\n"; @@ -559,7 +559,7 @@ class OrbitGraphProcessor { * @param threshold The symmetry threshold. */ void set_symmetry_threshold(size_t threshold) { symmetry_threshold_ = threshold; } - void setMergeDifferentNodeTypes(bool flag) { merge_different_node_types = flag; } + void setMergeDifferentNodeTypes(bool flag) { merge_different_node_types_ = flag; } void set_work_threshold(v_workw_t work_threshold) { work_threshold_ = work_threshold; } void setCriticalPathThreshold(v_workw_t critical_path_threshold) { critical_path_threshold_ = critical_path_threshold; } void setLockRatio(double lock_ratio) { lock_orbit_ratio = lock_ratio; } @@ -634,8 +634,8 @@ class OrbitGraphProcessor { if constexpr (verbose) { std::cout << "Attempting to merge different node types.\n"; } - contract_edges(original_dag, current_coarse_graph, current_groups, current_contraction_map, false, merge_different_node_types); - contract_edges(original_dag, current_coarse_graph, current_groups, current_contraction_map, true, merge_different_node_types); + contract_edges(original_dag, current_coarse_graph, current_groups, current_contraction_map, false, merge_different_node_types_); + contract_edges(original_dag, current_coarse_graph, current_groups, current_contraction_map, true, merge_different_node_types_); if constexpr (verbose) { @@ -646,7 +646,7 @@ class OrbitGraphProcessor { non_viable_crit_path_edges_cache_.clear(); non_viable_edges_cache_.clear(); - contract_edges(original_dag, current_coarse_graph, current_groups, current_contraction_map, true, merge_different_node_types, work_threshold_); + contract_edges(original_dag, current_coarse_graph, current_groups, current_contraction_map, true, merge_different_node_types_, work_threshold_); // --- Finalize --- final_coarse_graph_ = std::move(current_coarse_graph); @@ -694,11 +694,11 @@ class OrbitGraphProcessor { const bool is_last_loop = (current_symmetry / 2) < min_symmetry_; contract_edges_adpative_sym(original_dag, current_coarse_graph, current_groups, current_contraction_map, false, is_last_loop); - if (merge_different_node_types) - contract_edges_adpative_sym(original_dag, current_coarse_graph, current_groups, current_contraction_map, merge_different_node_types, is_last_loop); + if (merge_different_node_types_) + contract_edges_adpative_sym(original_dag, current_coarse_graph, current_groups, current_contraction_map, merge_different_node_types_, is_last_loop); non_viable_crit_path_edges_cache_.clear(); - contract_edges_adpative_sym(original_dag, current_coarse_graph, current_groups, current_contraction_map, merge_different_node_types, is_last_loop, critical_path_threshold_); + contract_edges_adpative_sym(original_dag, current_coarse_graph, current_groups, current_contraction_map, merge_different_node_types_, is_last_loop, critical_path_threshold_); for (const auto& v : current_coarse_graph.vertices()) { if (current_coarse_graph.vertex_work_weight(v) > lock_threshold) { diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp index eb4e80cc..d45f5a11 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp @@ -39,8 +39,8 @@ struct directed_edge_descriptor_impl { directed_edge_descriptor_impl(directed_edge_descriptor_impl &&other) = default; directed_edge_descriptor_impl &operator=(const directed_edge_descriptor_impl &other) = default; directed_edge_descriptor_impl &operator=(directed_edge_descriptor_impl &&other) = default; - directed_edge_descriptor_impl(std::size_t source, std::size_t target, std::size_t idx) - : idx(idx), source(source), target(target) {} + directed_edge_descriptor_impl(std::size_t source_arg, std::size_t target_arg, std::size_t idx_arg) + : idx(idx_arg), source(source_arg), target(target_arg) {} ~directed_edge_descriptor_impl() = default; bool operator==(const directed_edge_descriptor_impl &other) const { @@ -55,7 +55,7 @@ struct cdag_edge_impl { using cdag_edge_comm_weight_type = edge_comm_weight_t; - cdag_edge_impl(edge_comm_weight_t comm_weight = 1) : comm_weight(comm_weight) {} + cdag_edge_impl(edge_comm_weight_t comm_weight_arg = 1) : comm_weight(comm_weight_arg) {} edge_comm_weight_t comm_weight; }; diff --git a/include/osp/partitioning/model/hypergraph.hpp b/include/osp/partitioning/model/hypergraph.hpp index 715f6ac8..39ca79b2 100644 --- a/include/osp/partitioning/model/hypergraph.hpp +++ b/include/osp/partitioning/model/hypergraph.hpp @@ -85,9 +85,9 @@ class Hypergraph { using Hypergraph_def_t = Hypergraph; template -void Hypergraph::add_pin(index_type vertex_idx, index_type hyperedge_idx) +void Hypergraph::add_pin(index_type vertex, index_type hyperedge_idx) { - if(vertex_idx >= Num_vertices) + if(vertex >= Num_vertices) { throw std::invalid_argument("Invalid Argument while adding pin: vertex index out of range."); } @@ -96,8 +96,8 @@ void Hypergraph::add_pin(index_ty throw std::invalid_argument("Invalid Argument while adding pin: hyperedge index out of range."); } else{ - incident_hyperedges_to_vertex[vertex_idx].push_back(hyperedge_idx); - vertices_in_hyperedge[hyperedge_idx].push_back(vertex_idx); + incident_hyperedges_to_vertex[vertex].push_back(hyperedge_idx); + vertices_in_hyperedge[hyperedge_idx].push_back(vertex); ++Num_pins; } } @@ -131,21 +131,21 @@ void Hypergraph::add_hyperedge(co } template -void Hypergraph::set_vertex_work_weight(index_type vertex_idx, workw_type weight) +void Hypergraph::set_vertex_work_weight(index_type vertex, workw_type weight) { - if(vertex_idx >= Num_vertices) + if(vertex >= Num_vertices) throw std::invalid_argument("Invalid Argument while setting vertex weight: vertex index out of range."); else - vertex_work_weights[vertex_idx] = weight; + vertex_work_weights[vertex] = weight; } template -void Hypergraph::set_vertex_memory_weight(index_type vertex_idx, memw_type weight) +void Hypergraph::set_vertex_memory_weight(index_type vertex, memw_type weight) { - if(vertex_idx >= Num_vertices) + if(vertex >= Num_vertices) throw std::invalid_argument("Invalid Argument while setting vertex weight: vertex index out of range."); else - vertex_memory_weights[vertex_idx] = weight; + vertex_memory_weights[vertex] = weight; } template diff --git a/include/osp/pebbling/PebblingSchedule.hpp b/include/osp/pebbling/PebblingSchedule.hpp index 53405c0d..7a89153c 100644 --- a/include/osp/pebbling/PebblingSchedule.hpp +++ b/include/osp/pebbling/PebblingSchedule.hpp @@ -1490,7 +1490,7 @@ void PebblingSchedule::removeEvictStepsFromEnd() --stepIndex; auto &computeStep = compute_steps_for_proc_superstep[proc][step][stepIndex]; - std::vector remaining; + std::vector remaining_2; for(vertex_idx to_remove : computeStep.nodes_evicted_after) { mem_used[proc] += instance->getComputationalDag().vertex_mem_weight(to_remove); @@ -1501,9 +1501,9 @@ void PebblingSchedule::removeEvictStepsFromEnd() bottleneck[proc] -= instance->getComputationalDag().vertex_mem_weight(to_remove); } else - remaining.push_back(to_remove); + remaining_2.push_back(to_remove); } - computeStep.nodes_evicted_after = remaining; + computeStep.nodes_evicted_after = remaining_2; bottleneck[proc] = std::min(bottleneck[proc], instance->getArchitecture().memoryBound(proc) - mem_used[proc]); mem_used[proc] -= instance->getComputationalDag().vertex_mem_weight(computeStep.node); diff --git a/tests/compact_sparse_graph.cpp b/tests/compact_sparse_graph.cpp index e96db8be..f567827d 100644 --- a/tests/compact_sparse_graph.cpp +++ b/tests/compact_sparse_graph.cpp @@ -239,12 +239,12 @@ BOOST_AUTO_TEST_CASE(Graph1_keep_order) { BOOST_CHECK_EQUAL(graph.num_vertices(), 11); BOOST_CHECK_EQUAL(graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(graph.num_vertices(), cntr_0); std::vector> out_edges({ {1, 2}, @@ -344,12 +344,12 @@ BOOST_AUTO_TEST_CASE(Graph1_reorder) { BOOST_CHECK_EQUAL(graph.num_vertices(), 11); BOOST_CHECK_EQUAL(graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(graph.num_vertices(), cntr_0); std::vector perm(11, 0); std::iota(perm.begin(), perm.end(), 0); @@ -966,12 +966,12 @@ BOOST_AUTO_TEST_CASE(Graph1_copy_keep_order) { BOOST_CHECK_EQUAL(copy_graph.num_vertices(), 11); BOOST_CHECK_EQUAL(copy_graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : copy_graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(copy_graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(copy_graph.num_vertices(), cntr_0); std::vector> out_edges({ {1, 2}, @@ -1037,12 +1037,12 @@ BOOST_AUTO_TEST_CASE(Graph1_move_keep_order) { BOOST_CHECK_EQUAL(copy_graph.num_vertices(), 11); BOOST_CHECK_EQUAL(copy_graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : copy_graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(copy_graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(copy_graph.num_vertices(), cntr_0); std::vector> out_edges({ {1, 2}, @@ -1109,12 +1109,12 @@ BOOST_AUTO_TEST_CASE(Graph1_copy_reorder) { BOOST_CHECK_EQUAL(graph.num_vertices(), 11); BOOST_CHECK_EQUAL(graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(graph.num_vertices(), cntr_0); std::vector perm(11, 0); std::iota(perm.begin(), perm.end(), 0); @@ -1204,12 +1204,12 @@ BOOST_AUTO_TEST_CASE(Graph1_move_reorder) { BOOST_CHECK_EQUAL(graph.num_vertices(), 11); BOOST_CHECK_EQUAL(graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(graph.num_vertices(), cntr_0); std::vector perm(11, 0); std::iota(perm.begin(), perm.end(), 0); diff --git a/tests/compact_sparse_graph_edge_desc.cpp b/tests/compact_sparse_graph_edge_desc.cpp index ffacfb45..1bf8d9bb 100644 --- a/tests/compact_sparse_graph_edge_desc.cpp +++ b/tests/compact_sparse_graph_edge_desc.cpp @@ -396,12 +396,12 @@ BOOST_AUTO_TEST_CASE(Graph1_keep_order) { BOOST_CHECK_EQUAL(graph.num_vertices(), 11); BOOST_CHECK_EQUAL(graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(graph.num_vertices(), cntr_0); std::vector> out_edges({ {1, 2}, @@ -518,12 +518,12 @@ BOOST_AUTO_TEST_CASE(Graph1_reorder) { BOOST_CHECK_EQUAL(graph.num_vertices(), 11); BOOST_CHECK_EQUAL(graph.num_edges(), 11); - std::size_t cntr = 0; + std::size_t cntr_0 = 0; for (const auto &vert : graph.vertices()) { - BOOST_CHECK_EQUAL(vert, cntr); - ++cntr; + BOOST_CHECK_EQUAL(vert, cntr_0); + ++cntr_0; } - BOOST_CHECK_EQUAL(graph.num_vertices(), cntr); + BOOST_CHECK_EQUAL(graph.num_vertices(), cntr_0); std::vector perm(11, 0); std::iota(perm.begin(), perm.end(), 0); From 6c3c07ec433973c0b4775aaf175b6e31b391343a Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Mon, 10 Nov 2025 16:54:45 +0100 Subject: [PATCH 05/20] wfloat-equal --- CMakeLists.txt | 4 ++-- .../LocalSearch/KernighanLin/kl_base.hpp | 4 ++-- .../KernighanLin_v2/kl_improver.hpp | 20 ++++++++++++------- .../EftSubgraphScheduler.hpp | 10 +++++----- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd831fec..7f80584a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,8 @@ set(COMMON_CXX_WARNING_FLAGS "-Wunreachable-code" "-Wuninitialized" "-Wshadow" - # "-Wfloat-equal" - # "-Wnon-virtual-dtor" + "-Wfloat-equal" + "-Wnon-virtual-dtor" # "-pedantic" # "-Wpedantic" # "-Wold-style-cast" diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp index 70f1acfb..85018607 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp @@ -437,7 +437,7 @@ class kl_base : public ImprovementScheduler, public Ikl_cost_function { node_best_proc = proc; rand_count = 0; - } else if (node_max_gain == proc_max) { + } else if (node_max_gain <= proc_max) { if (rand() % (2 + rand_count) == 0) { node_max_gain = proc_max; @@ -750,7 +750,7 @@ class kl_base : public ImprovementScheduler, public Ikl_cost_function { node_best_proc = proc; rand_count = 0; - } else if (node_max_gain == proc_max) { + } else if (node_max_gain <= proc_max) { if (rand() % (2 + rand_count) == 0) { node_max_gain = proc_max; diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp index ef1c1079..2fa0fdb1 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp @@ -94,6 +94,8 @@ class kl_improver : public ImprovementScheduler { constexpr static bool enable_quick_moves = true; constexpr static bool enable_preresolving_violations = true; + const double EPSILON = 1e-9; + using memw_t = v_memw_t; using commw_t = v_commw_t; using work_weight_t = v_workw_t; @@ -284,10 +286,11 @@ class kl_improver : public ImprovementScheduler { const bool new_is_sole_max_processor = (active_schedule.get_step_max_work_processor_count()[node_step] == 1) && (new_max_weight == new_step_proc_work); const cost_t new_node_proc_affinity = new_is_sole_max_processor ? std::min(vertex_weight, new_max_weight - new_second_max_weight) : 0.0; - if (new_node_proc_affinity != prev_node_proc_affinity) { + const cost_t diff = new_node_proc_affinity - prev_node_proc_affinity; + if (std::abs(diff) > EPSILON) { update_info.full_update = true; - affinity_table_node[node_proc][window_size] += (new_node_proc_affinity - prev_node_proc_affinity); - } + affinity_table_node[node_proc][window_size] += diff; // Use the pre-calculated diff + } if ((prev_max_work != new_max_weight) || update_info.full_update) { update_info.update_entire_from_step = true; @@ -1208,10 +1211,11 @@ void kl_improver EPSILON; if (update_node_proc_affinity) { full_update = true; - affinity_table_node[node_proc][window_size] += (new_node_proc_affinity - prev_node_proc_affinity); + affinity_table_node[node_proc][window_size] += diff; } if ((prev_move_step_max_work != new_max_weight) || update_node_proc_affinity) { @@ -1450,7 +1454,8 @@ void kl_improver EPSILON) || (max_proc != node_move.to_proc) || (max_step != node_move.to_step)) { node_move.gain = max_gain; node_move.to_proc = max_proc; node_move.to_step = max_step; @@ -1503,7 +1508,8 @@ void kl_improver EPSILON) || (max_proc != node_move.to_proc) || (max_step != node_move.to_step)) { node_move.gain = max_gain; node_move.to_proc = max_proc; node_move.to_step = max_step; diff --git a/include/osp/dag_divider/isomorphism_divider/EftSubgraphScheduler.hpp b/include/osp/dag_divider/isomorphism_divider/EftSubgraphScheduler.hpp index 7b4bd4ca..46fa8241 100644 --- a/include/osp/dag_divider/isomorphism_divider/EftSubgraphScheduler.hpp +++ b/include/osp/dag_divider/isomorphism_divider/EftSubgraphScheduler.hpp @@ -74,7 +74,7 @@ class EftSubgraphScheduler { job_id_t in_degree_current = 0; JobStatus status = JobStatus::WAITING; - double upward_rank = 0.0; + v_workw_t upward_rank = 0.0; // --- Execution Tracking Members --- std::vector assigned_workers; @@ -137,13 +137,13 @@ class EftSubgraphScheduler { const auto reverse_top_order = GetTopOrderReverse(graph); for (const auto& vertex : reverse_top_order) { - double max_successor_rank = 0.0; + v_workw_t max_successor_rank = 0.0; for (const auto& child : graph.children(vertex)) { max_successor_rank = std::max(max_successor_rank, jobs_.at(child).upward_rank); } Job& job = jobs_.at(vertex); - job.upward_rank = static_cast(graph.vertex_work_weight(vertex)) + max_successor_rank; + job.upward_rank = graph.vertex_work_weight(vertex) + max_successor_rank; } } @@ -175,7 +175,7 @@ class EftSubgraphScheduler { } std::vector jobs_to_start; - double total_runnable_priority = 0.0; + v_workw_t total_runnable_priority = 0.0; // Iterate through ready jobs and assign minimum resources if available. for (const Job* job_ptr : ready_jobs_) { @@ -214,7 +214,7 @@ class EftSubgraphScheduler { const unsigned current_total_assigned = std::accumulate(job.assigned_workers.begin(), job.assigned_workers.end(), 0u); const unsigned max_additional_workers = (job.max_num_procs > current_total_assigned) ? (job.max_num_procs - current_total_assigned) : 0; - const double proportion = (total_runnable_priority > 0) ? (job.upward_rank / total_runnable_priority) : (1.0 / static_cast(jobs_to_start.size())); + const double proportion = (total_runnable_priority > 0) ? (static_cast(job.upward_rank) / static_cast(total_runnable_priority)) : (1.0 / static_cast(jobs_to_start.size())); const unsigned proportional_share = static_cast(static_cast(remaining_workers_pool[type_idx]) * proportion); const unsigned num_proportional_chunks = (job.multiplicity > 0) ? proportional_share / job.multiplicity : 0; const unsigned num_available_chunks = (job.multiplicity > 0) ? available_workers[type_idx] / job.multiplicity : 0; From 2984efe85d038fb76f6e9c19541f1c22333afae6 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Mon, 10 Nov 2025 17:11:36 +0100 Subject: [PATCH 06/20] compiler flags --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f80584a..31b100b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,12 @@ set(COMMON_CXX_WARNING_FLAGS "-Wshadow" "-Wfloat-equal" "-Wnon-virtual-dtor" - # "-pedantic" - # "-Wpedantic" + "-pedantic" + "-Wpedantic" # "-Wold-style-cast" - # "-Wcast-align" - # "-Wduplicated-cond" - # "-Wduplicated-branches" + "-Wcast-align" + "-Wduplicated-cond" + "-Wduplicated-branches" "-Werror" ) From 3859cef41620091866f8d0a7935cd75710c180da Mon Sep 17 00:00:00 2001 From: Raphael Steiner Date: Mon, 10 Nov 2025 17:27:00 +0100 Subject: [PATCH 07/20] changed old style c conversion to modern cpp --- apps/graph_analyser.cpp | 6 +- .../gen_near_diag_random_graph.cpp | 4 +- include/osp/bsp/model/BspArchitecture.hpp | 2 +- .../scheduler/GreedySchedulers/BspLocking.hpp | 4 +- .../GreedySchedulers/GreedyBspScheduler.hpp | 18 +-- .../GreedySchedulers/VarianceFillup.hpp | 6 +- .../IlpSchedulers/CoptFullScheduler.hpp | 4 +- .../LightEdgeVariancePartitioner.hpp | 2 +- .../LoadBalanceScheduler/LoadBalancerBase.hpp | 2 +- .../VariancePartitioner.hpp | 2 +- .../LocalSearch/KernighanLin/kl_base.hpp | 4 +- .../KernighanLin/kl_total_comm.hpp | 122 +++++++++--------- .../LocalSearch/KernighanLin/kl_total_cut.hpp | 62 ++++----- include/osp/coarser/MultilevelCoarser.hpp | 2 +- .../ConnectedComponentScheduler.hpp | 4 +- include/osp/pebbling/PebblingSchedule.hpp | 2 +- 16 files changed, 123 insertions(+), 123 deletions(-) diff --git a/apps/graph_analyser.cpp b/apps/graph_analyser.cpp index 7540e1d1..25106519 100644 --- a/apps/graph_analyser.cpp +++ b/apps/graph_analyser.cpp @@ -58,7 +58,7 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) { Get_Median(edge_lengths); if (graph.num_edges() != 0) { - avg_edge_length = (float)sum_edge_length / (float)graph.num_edges(); + avg_edge_length = static_cast(sum_edge_length) / static_cast(graph.num_edges()); } // Longest Path @@ -72,7 +72,7 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) { // wavefront[top_level[i]] = 1; // } } - float avg_wavefront = (float)graph.num_vertices() / (float)longest_path; + float avg_wavefront = static_cast(graph.num_vertices()) / static_cast(longest_path); // Average bottom distance std::vector bot_level = get_bottom_node_distance(graph); @@ -80,7 +80,7 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) { for (size_t i = 0; i < bot_level.size(); i++) { bot_level_sum += bot_level[i]; } - float avg_bot_level = (float)bot_level_sum / (float)bot_level.size(); + float avg_bot_level = static_cast(bot_level_sum) / static_cast(bot_level.size()); // // Number of Triangles // size_t number_triangles = 0; diff --git a/apps/graph_generator/gen_near_diag_random_graph.cpp b/apps/graph_generator/gen_near_diag_random_graph.cpp index 20b9029f..30e4fb2e 100644 --- a/apps/graph_generator/gen_near_diag_random_graph.cpp +++ b/apps/graph_generator/gen_near_diag_random_graph.cpp @@ -64,8 +64,8 @@ int main(int argc, char *argv[]) { // Generating graph name std::string graph_name = "RandomBand_"; - graph_name += "p" + std::to_string((int)(100 * prob)) + "_"; - graph_name += "b" + std::to_string((int)bandwidth) + "_"; + graph_name += "p" + std::to_string(static_cast(100 * prob)) + "_"; + graph_name += "b" + std::to_string(static_cast(bandwidth)) + "_"; std::string graph_size_name; if (graph.num_vertices() < 1000) { graph_size_name = std::to_string(graph.num_vertices()) + "_"; diff --git a/include/osp/bsp/model/BspArchitecture.hpp b/include/osp/bsp/model/BspArchitecture.hpp index 5cc32c3d..72762ce1 100644 --- a/include/osp/bsp/model/BspArchitecture.hpp +++ b/include/osp/bsp/model/BspArchitecture.hpp @@ -299,7 +299,7 @@ class BspArchitecture { for (unsigned i = 0; i < number_processors; ++i) for (unsigned j = 0; j < number_processors; ++j) avg += static_cast(send_costs[i][j]); - avg = avg * (double)communication_costs / (double)number_processors / (double)number_processors; + avg = avg * static_cast(communication_costs) / static_cast(number_processors) / static_cast(number_processors); if (avg > static_cast(std::numeric_limits::max())) { throw std::invalid_argument("avg comm exceeds the limit (something is very wrong)"); diff --git a/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp b/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp index 2d2edec3..6446800e 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp @@ -598,8 +598,8 @@ class BspLocking : public Scheduler { if (free > params_p * max_percent_idle_processors && ((!increase_parallelism_in_new_superstep) || get_nr_parallelizable_nodes(instance, nr_ready_nodes_per_type, nr_procs_per_type) >= - std::min(std::min(params_p, (unsigned)(1.2 * (params_p - free))), - params_p - free + ((unsigned)(0.5 * free))))) { + std::min(std::min(params_p, static_cast(1.2 * (params_p - free))), + params_p - free + (static_cast(0.5 * free))))) { endSupStep = true; } } diff --git a/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp b/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp index 24cc2501..be196e28 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/GreedyBspScheduler.hpp @@ -87,8 +87,8 @@ class GreedyBspScheduler : public Scheduler { for (const auto &pred : instance.getComputationalDag().parents(node)) { if (procInHyperedge[pred][proc]) { - score += (double)instance.getComputationalDag().vertex_comm_weight(pred) / - (double)instance.getComputationalDag().out_degree(pred); + score += static_cast(instance.getComputationalDag().vertex_comm_weight(pred)) / + static_cast(instance.getComputationalDag().out_degree(pred)); } } return score; @@ -473,8 +473,8 @@ class GreedyBspScheduler : public Scheduler { if (child != nextNode && procReady[nextProc].find(child) != procReady[nextProc].end()) { (*node_proc_heap_handles[nextProc][child]).score += - (double)instance.getComputationalDag().vertex_comm_weight(pred) / - (double)instance.getComputationalDag().out_degree(pred); + static_cast(instance.getComputationalDag().vertex_comm_weight(pred)) / + static_cast(instance.getComputationalDag().out_degree(pred)); max_proc_score_heap[nextProc].update(node_proc_heap_handles[nextProc][child]); } @@ -482,8 +482,8 @@ class GreedyBspScheduler : public Scheduler { instance.isCompatible(child, nextProc)) { (*node_all_proc_heap_handles[nextProc][child]).score += - (double)instance.getComputationalDag().vertex_comm_weight(pred) / - (double)instance.getComputationalDag().out_degree(pred); + static_cast(instance.getComputationalDag().vertex_comm_weight(pred)) / + static_cast(instance.getComputationalDag().out_degree(pred)); max_all_proc_score_heap[nextProc].update(node_all_proc_heap_handles[nextProc][child]); } } @@ -498,11 +498,11 @@ class GreedyBspScheduler : public Scheduler { } } - if (free > static_cast((float)params_p * max_percent_idle_processors) && + if (free > static_cast(static_cast(params_p) * max_percent_idle_processors) && ((!increase_parallelism_in_new_superstep) || get_nr_parallelizable_nodes(instance, nr_ready_nodes_per_type, nr_procs_per_type) >= - std::min(std::min(params_p, (unsigned)(1.2 * (params_p - free))), - params_p - free + ((unsigned)(0.5 * free))))) { + std::min(std::min(params_p, static_cast(1.2 * (params_p - free))), + params_p - free + (static_cast(0.5 * free))))) { endSupStep = true; } } diff --git a/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp b/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp index def935ee..ff245d1d 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp @@ -81,7 +81,7 @@ class VarianceFillup : public Scheduler { } temp = std::log(temp) / 2 + max_priority; - double node_weight = std::log((double)std::max(graph.vertex_work_weight(*r_iter), static_cast>(1))); + double node_weight = std::log( static_cast( std::max(graph.vertex_work_weight(*r_iter), static_cast>(1)) ) ); double larger_val = node_weight > temp ? node_weight : temp; work_variance[*r_iter] = @@ -475,8 +475,8 @@ class VarianceFillup : public Scheduler { if (free > params_p * max_percent_idle_processors && ((!increase_parallelism_in_new_superstep) || get_nr_parallelizable_nodes(instance, nr_ready_nodes_per_type, nr_procs_per_type) >= - std::min(std::min(params_p, (unsigned)(1.2 * (params_p - free))), - params_p - free + ((unsigned)(0.5 * free))))) + std::min(std::min(params_p, static_cast(1.2 * (params_p - free))), + params_p - free + (static_cast(0.5 * free))))) endSupStep = true; } diff --git a/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp b/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp index 4f9866e7..f1109b93 100644 --- a/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp +++ b/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp @@ -595,7 +595,7 @@ class CoptFullScheduler : public Scheduler { expr += node_to_processor_superstep_var[node][processor][static_cast(step)]; } } - model.AddConstr(expr <= (double)(instance.numberOfVertices() * instance.numberOfProcessors()) * + model.AddConstr(expr <= static_cast(instance.numberOfVertices() * instance.numberOfProcessors()) * superstep_used_var.GetVar(static_cast(step))); } @@ -646,7 +646,7 @@ class CoptFullScheduler : public Scheduler { } model.AddConstr(expr >= - (double)instance.getComputationalDag().in_degree(node) * + static_cast(instance.getComputationalDag().in_degree(node)) * node_to_processor_superstep_var[node][processor][static_cast(step)]); } } diff --git a/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp b/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp index eeff3564..49c9030e 100644 --- a/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp +++ b/include/osp/bsp/scheduler/LoadBalanceScheduler/LightEdgeVariancePartitioner.hpp @@ -183,7 +183,7 @@ class LightEdgeVariancePartitioner : public VariancePartitioner - base::max_priority_difference_percent * (float)total_work / (float)n_processors) { + base::max_priority_difference_percent * static_cast(total_work) / static_cast(n_processors)) { endsuperstep = true; // std::cout << "\nCall for new superstep - difference.\n"; } diff --git a/include/osp/bsp/scheduler/LoadBalanceScheduler/LoadBalancerBase.hpp b/include/osp/bsp/scheduler/LoadBalanceScheduler/LoadBalancerBase.hpp index 0dfe2718..26e45fa8 100644 --- a/include/osp/bsp/scheduler/LoadBalanceScheduler/LoadBalancerBase.hpp +++ b/include/osp/bsp/scheduler/LoadBalanceScheduler/LoadBalancerBase.hpp @@ -66,7 +66,7 @@ class LoadBalancerBase : public Scheduler { work_till_now += part_work; } - float percentage_complete = (float)work_till_now / (float)total_work; + float percentage_complete = static_cast(work_till_now) / static_cast(total_work); float value = Interpolation_t()(percentage_complete, slack); diff --git a/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp b/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp index cc25d064..089cf4d4 100644 --- a/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp +++ b/include/osp/bsp/scheduler/LoadBalanceScheduler/VariancePartitioner.hpp @@ -193,7 +193,7 @@ class VariancePartitioner : public LoadBalancerBase { } if (num_unable_to_partition_node_loop == 0 && (max_priority - min_priority) > - max_priority_difference_percent * (float)total_work / (float)n_processors) { + max_priority_difference_percent * static_cast(total_work) / static_cast(n_processors)) { endsuperstep = true; // std::cout << "\nCall for new superstep - difference.\n"; } diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp index 85018607..d3616ae5 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp @@ -998,7 +998,7 @@ class kl_base : public ImprovementScheduler, public Ikl_cost_function { std::sample(current_schedule.set_schedule.step_processor_vertices[step_selection_counter][max_step].begin(), current_schedule.set_schedule.step_processor_vertices[step_selection_counter][max_step].end(), std::inserter(node_selection, node_selection.end()), - (unsigned)std::round(parameters.selection_threshold * .66), gen); + static_cast(std::round(parameters.selection_threshold * .66)), gen); } if (current_schedule.set_schedule.step_processor_vertices[step_selection_counter][second_max_step].size() < @@ -1014,7 +1014,7 @@ class kl_base : public ImprovementScheduler, public Ikl_cost_function { current_schedule.set_schedule.step_processor_vertices[step_selection_counter][second_max_step].begin(), current_schedule.set_schedule.step_processor_vertices[step_selection_counter][second_max_step].end(), std::inserter(node_selection, node_selection.end()), - (unsigned)std::round(parameters.selection_threshold * .33), gen); + static_cast(std::round(parameters.selection_threshold * .33)), gen); } if (do_not_select_super_locked_nodes) { diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_comm.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_comm.hpp index 894b0655..912650bb 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_comm.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_comm.hpp @@ -61,8 +61,8 @@ class kl_total_comm : public kl_total::current_schedule.vector_schedule.assignedProcessor(target))) { kl_total::node_gains[node][current_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(node)) + kl_total::reward; } } @@ -90,8 +90,8 @@ class kl_total_comm : public kl_total::current_schedule.vector_schedule.assignedProcessor(source))) { kl_total::node_gains[node][current_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(source)) + kl_total::reward; } } @@ -107,8 +107,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(node) * + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(node)) * kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -134,8 +134,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(node) * + const double gain = static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(node)) * kl_total::current_schedule.instance->communicationCosts( current_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -152,21 +152,21 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(node)) + kl_total::reward; kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(node)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(target) < current_step) { kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(node)) + kl_total::reward; } @@ -175,7 +175,7 @@ class kl_total_comm : public kl_total::current_schedule.instance->communicationCosts(new_proc, + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, target_proc)) * @@ -199,8 +199,8 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(node)) + kl_total::reward; } } @@ -214,8 +214,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(source) * + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(source)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -243,8 +243,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(source) * + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(source)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -260,21 +260,21 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(source)) + kl_total::reward; kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(source)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(source) == current_step + 1) { kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(source)) + kl_total::reward; } @@ -282,7 +282,7 @@ class kl_total_comm : public kl_total::current_schedule.instance->communicationCosts(new_proc, + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, source_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, source_proc)) * @@ -307,8 +307,8 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .vertex_comm_weight(source)) + kl_total::reward; } } @@ -346,8 +346,8 @@ class kl_total_comm : public kl_total::current_schedule.vector_schedule.assignedProcessor(target_v))) { kl_total::node_gains[node][current_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(out_edge)) + kl_total::reward; } } @@ -381,8 +381,8 @@ class kl_total_comm : public kl_total::current_schedule.vector_schedule.assignedProcessor(source_v))) { kl_total::node_gains[node][current_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(in_edge)) + kl_total::reward; } } @@ -401,8 +401,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(out_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(out_edge)) * kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -428,8 +428,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(out_edge) * + const double gain = static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(out_edge)) * kl_total::current_schedule.instance->communicationCosts( current_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -446,20 +446,20 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(out_edge)) + kl_total::reward; kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(out_edge)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(target_v) == current_step - 1) { kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(out_edge)) + kl_total::reward; } @@ -468,7 +468,7 @@ class kl_total_comm : public kl_total::current_schedule.instance->communicationCosts(new_proc, + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, target_proc)) * @@ -492,8 +492,8 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(out_edge)) + kl_total::reward; } } @@ -508,8 +508,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(in_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(in_edge)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -536,8 +536,8 @@ class kl_total_comm : public kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(in_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(in_edge)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -553,21 +553,21 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(in_edge)) + kl_total::reward; kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(in_edge)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(source_v) == current_step + 1) { kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(in_edge)) + kl_total::reward; } @@ -575,7 +575,7 @@ class kl_total_comm : public kl_total::current_schedule.instance->communicationCosts(new_proc, + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, source_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, source_proc)) * @@ -600,8 +600,8 @@ class kl_total_comm : public kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag() - .edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag() + .edge_comm_weight(in_edge)) + kl_total::reward; } } @@ -641,7 +641,7 @@ class kl_total_comm : public kl_total::current_schedule.current_cost = work_costs + comm_costs * kl_total::current_schedule.comm_multiplier + - ((double)kl_total::current_schedule.num_steps() - 1) * + (static_cast(kl_total::current_schedule.num_steps()) - 1) * kl_total::current_schedule.instance->synchronisationCosts(); return kl_total::current_schedule.current_cost; diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_cut.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_cut.hpp index bd4d54f2..eea392dc 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_cut.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_cut.hpp @@ -162,7 +162,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node)) * kl_total::current_schedule.instance->communicationCosts(current_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -181,17 +181,17 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(target) == current_step) { kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node)) + kl_total::reward; kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(target) < current_step) { kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node)) + kl_total::reward; } @@ -200,7 +200,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) - + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, target_proc)) * kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node) * kl_total::current_schedule.comm_multiplier; @@ -219,7 +219,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(target) == current_step) { kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(node)) + kl_total::reward; } } @@ -232,7 +232,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(source) == current_step) { const double loss = - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -259,7 +259,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -278,17 +278,17 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(source) == current_step) { kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source)) + kl_total::reward; kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(source) == current_step + 1) { kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source)) + kl_total::reward; } @@ -296,7 +296,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->communicationCosts(new_proc, source_proc) - + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, source_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, source_proc)) * kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source) * kl_total::current_schedule.comm_multiplier; @@ -316,7 +316,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(source) == current_step) { kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().vertex_comm_weight(source)) + kl_total::reward; } } @@ -331,7 +331,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedProcessor(target_v); const double loss = - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) * kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -366,7 +366,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedProcessor(target_v))) { kl_total::node_gains[node][current_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) + kl_total::reward; } } @@ -376,7 +376,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedProcessor(source_v); const double loss = - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) * kl_total::current_schedule.instance->communicationCosts(new_proc, source_proc) * kl_total::current_schedule.comm_multiplier; @@ -411,7 +411,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedProcessor(source_v))) { kl_total::node_gains[node][current_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) + kl_total::reward; + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) + kl_total::reward; } } } else { @@ -428,7 +428,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(target_v) == current_step) { const double loss = - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) * kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -454,7 +454,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) * kl_total::current_schedule.instance->communicationCosts(current_proc, target_proc) * kl_total::current_schedule.comm_multiplier; @@ -473,16 +473,16 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(target_v) == current_step) { kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) + kl_total::reward; kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(target_v) == current_step - 1) { kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) + kl_total::reward; } @@ -491,7 +491,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) - + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, target_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, target_proc)) * kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) * kl_total::current_schedule.comm_multiplier; @@ -510,7 +510,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(target_v) == current_step) { kl_total::node_gains[node][new_proc][0] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(out_edge)) + kl_total::reward; } } @@ -525,7 +525,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(source_v) == current_step) { const double loss = - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -551,7 +551,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) * + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) * kl_total::current_schedule.instance->communicationCosts(current_proc, new_proc) * kl_total::current_schedule.comm_multiplier; @@ -570,17 +570,17 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(source_v) == current_step) { kl_total::node_gains[node][new_proc][1] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) + kl_total::reward; kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) + kl_total::reward; } else if (kl_total::current_schedule.vector_schedule.assignedSuperstep(source_v) == current_step + 1) { kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) + kl_total::reward; } @@ -588,7 +588,7 @@ class kl_total_cut : public kl_total::current_schedule.instance->communicationCosts(new_proc, source_proc) - + static_cast(kl_total::current_schedule.instance->communicationCosts(new_proc, source_proc) - kl_total::current_schedule.instance->communicationCosts(current_proc, source_proc)) * kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) * kl_total::current_schedule.comm_multiplier; @@ -608,7 +608,7 @@ class kl_total_cut : public kl_total::current_schedule.vector_schedule.assignedSuperstep(source_v) == current_step) { kl_total::node_gains[node][new_proc][2] += - (double)kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge) + + static_cast(kl_total::current_schedule.instance->getComputationalDag().edge_comm_weight(in_edge)) + kl_total::reward; } } diff --git a/include/osp/coarser/MultilevelCoarser.hpp b/include/osp/coarser/MultilevelCoarser.hpp index 5f39048d..bbd090e4 100644 --- a/include/osp/coarser/MultilevelCoarser.hpp +++ b/include/osp/coarser/MultilevelCoarser.hpp @@ -115,7 +115,7 @@ void MultilevelCoarser::compactify_dag_history() { size_t dag_indx_second = dag_history.size() - 1; size_t map_indx_second = contraction_maps.size() - 1; - if ( ((double) dag_history[dag_indx_first-1]->num_vertices() / (double) dag_history[dag_indx_second-1]->num_vertices()) > 1.25 ) return; + if ( (static_cast( dag_history[dag_indx_first-1]->num_vertices() ) / static_cast( dag_history[dag_indx_second-1]->num_vertices() )) > 1.25 ) return; // Compute combined contraction_map diff --git a/include/osp/dag_divider/ConnectedComponentScheduler.hpp b/include/osp/dag_divider/ConnectedComponentScheduler.hpp index 1100309e..a25a1ab6 100644 --- a/include/osp/dag_divider/ConnectedComponentScheduler.hpp +++ b/include/osp/dag_divider/ConnectedComponentScheduler.hpp @@ -57,8 +57,8 @@ class ConnectedComponentScheduler : public Scheduler { BspInstance sub_instance(sub_dag, instance.getArchitecture()); BspArchitecture &sub_architecture = sub_instance.getArchitecture(); - const double sub_dag_work_weight_percent = (double)sub_dag_work_weight / (double)total_work_weight; - const unsigned sub_dag_processors = (unsigned)(sub_dag_work_weight_percent * sub_architecture.numberOfProcessors()); + const double sub_dag_work_weight_percent = static_cast(sub_dag_work_weight) / static_cast(total_work_weight); + const unsigned sub_dag_processors = static_cast(sub_dag_work_weight_percent * sub_architecture.numberOfProcessors()); sub_architecture.setNumberOfProcessors(sub_dag_processors); diff --git a/include/osp/pebbling/PebblingSchedule.hpp b/include/osp/pebbling/PebblingSchedule.hpp index 7a89153c..008e3fa8 100644 --- a/include/osp/pebbling/PebblingSchedule.hpp +++ b/include/osp/pebbling/PebblingSchedule.hpp @@ -651,7 +651,7 @@ void PebblingSchedule::SplitSupersteps(const BspSchedule &sche end_current = start_idx + 1; else end_current = std::min(start_idx + 2* (end_lower_bound - start_idx), - (unsigned) top_orders[proc][step].size()-1); + static_cast( top_orders[proc][step].size() ) - 1); } else end_current = end_lower_bound + (end_upper_bound - end_lower_bound + 1) / 2; From 20c6186543536c6e8376a7ddb680d2c1d2e0d2c3 Mon Sep 17 00:00:00 2001 From: Raphael Steiner Date: Mon, 10 Nov 2025 17:36:00 +0100 Subject: [PATCH 08/20] small warning fixes --- CMakeLists.txt | 2 +- .../WavefrontComponentScheduler.hpp | 4 +- .../MerkleHashComputer.hpp | 4 +- tests/merkle_hash_computer.cpp | 40 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31b100b6..8f5f07c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ set(COMMON_CXX_WARNING_FLAGS "-Wnon-virtual-dtor" "-pedantic" "-Wpedantic" - # "-Wold-style-cast" + "-Wold-style-cast" "-Wcast-align" "-Wduplicated-cond" "-Wduplicated-branches" diff --git a/include/osp/dag_divider/WavefrontComponentScheduler.hpp b/include/osp/dag_divider/WavefrontComponentScheduler.hpp index 145abb81..8c7e2845 100644 --- a/include/osp/dag_divider/WavefrontComponentScheduler.hpp +++ b/include/osp/dag_divider/WavefrontComponentScheduler.hpp @@ -27,8 +27,8 @@ namespace osp { template class WavefrontComponentScheduler : public AbstractWavefrontScheduler { public: - WavefrontComponentScheduler(IDagDivider &div, Scheduler &scheduler) - : AbstractWavefrontScheduler(div, scheduler) {} + WavefrontComponentScheduler(IDagDivider &div, Scheduler &scheduler_) + : AbstractWavefrontScheduler(div, scheduler_) {} std::string getScheduleName() const override { return "WavefrontComponentScheduler"; } diff --git a/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp b/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp index 3a2d0feb..772fbc9d 100644 --- a/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp +++ b/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp @@ -108,8 +108,8 @@ class MerkleHashComputer : public HashComputer> { public: template - MerkleHashComputer(const Graph_t &graph, Args &&...args) : HashComputer(), node_hash_func(std::forward(args)...) { - compute_hashes(graph); + MerkleHashComputer(const Graph_t &graph_, Args &&...args) : HashComputer(), node_hash_func(std::forward(args)...) { + compute_hashes(graph_); } virtual ~MerkleHashComputer() override = default; diff --git a/tests/merkle_hash_computer.cpp b/tests/merkle_hash_computer.cpp index 29b26b62..01fc7915 100644 --- a/tests/merkle_hash_computer.cpp +++ b/tests/merkle_hash_computer.cpp @@ -68,16 +68,16 @@ BOOST_AUTO_TEST_CASE(BspScheduleRecomp_test) BOOST_AUTO_TEST_CASE(MerkleHashComputer_test_fw_bw_precomp) { using graph_t = computational_dag_vector_impl_def_t; - graph_t graph; + graph_t graph_test; const auto project_root = get_project_root(); - file_reader::readComputationalDagHyperdagFormatDB((project_root / "data/spaa/tiny/instance_bicgstab.hdag").string(), graph); + file_reader::readComputationalDagHyperdagFormatDB((project_root / "data/spaa/tiny/instance_bicgstab.hdag").string(), graph_test); - std::vector precom_node_hashes(graph.num_vertices(), 5); + std::vector precom_node_hashes(graph_test.num_vertices(), 5); - MerkleHashComputer> m_hash(graph, graph, precom_node_hashes); + MerkleHashComputer> m_hash(graph_test, graph_test, precom_node_hashes); - BOOST_CHECK_EQUAL(m_hash.get_vertex_hashes().size(), graph.num_vertices()); + BOOST_CHECK_EQUAL(m_hash.get_vertex_hashes().size(), graph_test.num_vertices()); size_t num = 0; for (const auto& pair : m_hash.get_orbits()) { @@ -90,43 +90,43 @@ BOOST_AUTO_TEST_CASE(MerkleHashComputer_test_fw_bw_precomp) std::cout << std::endl; } - BOOST_CHECK_EQUAL(num, graph.num_vertices()); + BOOST_CHECK_EQUAL(num, graph_test.num_vertices()); } -using graph = computational_dag_vector_impl_def_t; -using VertexType = vertex_idx_t; +using graphType = computational_dag_vector_impl_def_t; +using VertexType = vertex_idx_t; BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_IdenticalGraphsAreIsomorphic) { - graph dag1; + graphType dag1; const auto v1 = dag1.add_vertex(0, 10, 1); const auto v2 = dag1.add_vertex(1, 20, 1); const auto v3 = dag1.add_vertex(0, 30, 1); dag1.add_edge(v1, v2); dag1.add_edge(v2, v3); - graph dag2; + graphType dag2; const auto vA = dag2.add_vertex(0, 10, 1); const auto vB = dag2.add_vertex(1, 20, 1); const auto vC = dag2.add_vertex(0, 30, 1); dag2.add_edge(vA, vB); dag2.add_edge(vB, vC); - bool test = are_isomorphic_by_merkle_hash, true>(dag1, dag2); + bool test = are_isomorphic_by_merkle_hash, true>(dag1, dag2); BOOST_CHECK(test); - test = are_isomorphic_by_merkle_hash, false>(dag1, dag2); + test = are_isomorphic_by_merkle_hash, false>(dag1, dag2); BOOST_CHECK(test); } // Test case 2: Graphs with different numbers of vertices should not be isomorphic. BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_DifferentVertexCount) { - graph dag1; + graphType dag1; dag1.add_vertex(0, 10, 1); dag1.add_vertex(1, 20, 1); - graph dag2; + graphType dag2; dag2.add_vertex(0, 10, 1); BOOST_CHECK_EQUAL(are_isomorphic_by_merkle_hash(dag1, dag2), false); @@ -134,14 +134,14 @@ BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_DifferentVertexCount) { // Test case 3: Graphs with the same size but different structures should not be isomorphic. BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_SameSizeDifferentStructure) { - graph dag1; // A -> B -> C + graphType dag1; // A -> B -> C const auto v1_1 = dag1.add_vertex(0, 1, 1); const auto v1_2 = dag1.add_vertex(0, 1, 1); const auto v1_3 = dag1.add_vertex(0, 1, 1); dag1.add_edge(v1_1, v1_2); dag1.add_edge(v1_2, v1_3); - graph dag2; // A -> B, A -> C + graphType dag2; // A -> B, A -> C const auto v2_1 = dag2.add_vertex(0, 1, 1); const auto v2_2 = dag2.add_vertex(0, 1, 1); const auto v2_3 = dag2.add_vertex(0, 1, 1); @@ -153,14 +153,14 @@ BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_SameSizeDifferentStructure) { // Test case 4: Structurally identical graphs with different vertex labeling should be isomorphic. BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_IsomorphicWithDifferentLabels) { - graph dag1; + graphType dag1; const auto v1_1 = dag1.add_vertex(0, 1, 1); // Source const auto v1_2 = dag1.add_vertex(0, 1, 1); const auto v1_3 = dag1.add_vertex(0, 1, 1); // Sink dag1.add_edge(v1_1, v1_2); dag1.add_edge(v1_2, v1_3); - graph dag2; + graphType dag2; // Same structure as dag1, but vertices are added in a different order. const auto v2_3 = dag2.add_vertex(0, 1, 1); // Sink const auto v2_1 = dag2.add_vertex(0, 1, 1); // Source @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_IsomorphicWithDifferentLabels) { // Test case 5: A more complex example based on your provided DAG. BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_ComplexIsomorphicGraphs) { - graph dag1; + graphType dag1; { const auto v1 = dag1.add_vertex(2, 9, 2); const auto v2 = dag1.add_vertex(3, 8, 4); const auto v3 = dag1.add_vertex(4, 7, 3); const auto v4 = dag1.add_vertex(5, 6, 2); @@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(MerkleIsomorphismTest_ComplexIsomorphicGraphs) { dag1.add_edge(v3, v6); dag1.add_edge(v5, v8); dag1.add_edge(v4, v8); } - graph dag2; + graphType dag2; { // Same structure, different vertex variable names and creation order. const auto n8 = dag2.add_vertex(9, 2, 1); From e01468ac6cd2186a4c57b1a85562e2932436cdb5 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Mon, 10 Nov 2025 17:54:08 +0100 Subject: [PATCH 09/20] added test that breaks things --- .../IsomorphicSubgraphScheduler.hpp | 4 +- .../computational_dag_vector_impl.hpp | 4 +- tests/CMakeLists.txt | 2 + tests/graph_vector_adapter.cpp | 95 +++++++++++++++++++ 4 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 tests/graph_vector_adapter.cpp diff --git a/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp b/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp index f6a00715..cb91a559 100644 --- a/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp +++ b/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp @@ -478,7 +478,7 @@ class IsomorphicSubgraphScheduler { // Map (superstep, processor) -> relative partition ID std::map, vertex_idx_t> sp_proc_to_relative_partition; vertex_idx_t num_partitions_per_subgraph = 0; - for (size_t j = 0; j < rep_subgraph_vertices_sorted.size(); ++j) { + for (vertex_idx_t j = 0; j < rep_subgraph_vertices_sorted.size(); ++j) { const auto sp_pair = std::make_pair(bsp_schedule.assignedSuperstep(j), bsp_schedule.assignedProcessor(j)); if (sp_proc_to_relative_partition.find(sp_pair) == sp_proc_to_relative_partition.end()) { sp_proc_to_relative_partition[sp_pair] = num_partitions_per_subgraph++; @@ -489,7 +489,7 @@ class IsomorphicSubgraphScheduler { MerkleHashComputer rep_hasher(representative_instance.getComputationalDag()); // Replicate the schedule pattern for ALL subgraphs in the group --- - for (size_t i = 0; i < group.subgraphs.size(); ++i) { + for (vertex_idx_t i = 0; i < group.subgraphs.size(); ++i) { auto current_subgraph_vertices_sorted = group.subgraphs[i]; std::sort(current_subgraph_vertices_sorted.begin(), current_subgraph_vertices_sorted.end()); diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp index 77305763..e8f3d70d 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp @@ -117,7 +117,7 @@ class computational_dag_vector_impl { inline auto vertices() const { return vertex_range(static_cast(vertices_.size())); } - inline vertex_idx num_vertices() const { return vertices_.size(); } + inline vertex_idx num_vertices() const { return static_cast(vertices_.size()); } inline vertex_idx num_edges() const { return num_edges_; } @@ -194,7 +194,7 @@ class computational_dag_vector_impl { std::vector> out_neigbors; std::vector> in_neigbors; - std::size_t num_edges_ = 0; + vertex_idx num_edges_ = 0; unsigned num_vertex_types_ = 0; }; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 68ec6afe..c3ad3221 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -28,6 +28,8 @@ _add_test( graph_vector_edge_desc_impl ) _add_test( boost_graph_adaptor ) +_add_test( graph_vector_adapter ) + _add_test ( connected_components_part ) _add_test( compact_sparse_graph ) diff --git a/tests/graph_vector_adapter.cpp b/tests/graph_vector_adapter.cpp new file mode 100644 index 00000000..ac4de281 --- /dev/null +++ b/tests/graph_vector_adapter.cpp @@ -0,0 +1,95 @@ +/* +Copyright 2024 Huawei Technologies Co., Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +@author Toni Boehnlein, Benjamin Lozes, Pal Andras Papp, Raphael S. Steiner +*/ + +#define BOOST_TEST_MODULE ApproxEdgeReduction + +#include +#include +#include + +#include "osp/graph_algorithms/directed_graph_util.hpp" +#include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp" +#include "osp/graph_implementations/adj_list_impl/dag_vector_adapter.hpp" +#include "osp/graph_implementations/boost_graphs/boost_graph.hpp" +#include "osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp" +#include "osp/bsp/scheduler/Serial.hpp" +#include "osp/bsp/scheduler/GreedySchedulers/GreedyMetaScheduler.hpp" +#include "osp/bsp/scheduler/GreedySchedulers/GreedyChildren.hpp" +#include "osp/bsp/scheduler/GreedySchedulers/GrowLocalAutoCores.hpp" +#include "osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_include_mt.hpp" +#include "osp/coarser/coarser_util.hpp" +#include "osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp" +#include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp" +#include "osp/coarser/Sarkar/Sarkar.hpp" +#include "osp/coarser/Sarkar/SarkarMul.hpp" + +using namespace osp; + + +BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { + + std::vector vertices{0, 1, 2, 3, 4, 5, 6, 7}; + + std::vector> out_neighbors{{1, 2, 3}, {4, 6}, {4, 5}, {7}, {7}, {}, {}, {}}; + + std::vector> in_neighbors{{}, {0}, {0}, {0}, {1, 2}, {2}, {1}, {4, 3}}; + + using v_impl = cdag_vertex_impl; + using graph_t = dag_vector_adapter; + using graph_constr_t = computational_dag_vector_impl; + + graph_t graph(out_neighbors, in_neighbors); + + BspInstance instance; + instance.getComputationalDag() = graph; + + // Set up the scheduler + GrowLocalAutoCores growlocal; + BspLocking locking; + GreedyChildren children; + kl_total_lambda_comm_improver kl(42); + kl.setSuperstepRemoveStrengthParameter(2.0); + kl.setTimeQualityParameter(5.0); + ComboScheduler growlocal_kl(growlocal, kl); + ComboScheduler locking_kl(locking, kl); + ComboScheduler children_kl(children, kl); + + GreedyMetaScheduler scheduler; + // scheduler.addScheduler(growlocal_kl); + scheduler.addScheduler(locking_kl); + scheduler.addScheduler(children_kl); + scheduler.addSerialScheduler(); + + IsomorphicSubgraphScheduler iso_scheduler(scheduler); + + auto partition = iso_scheduler.compute_partition(instance); + + graph_t corase_graph; + coarser_util::construct_coarse_dag(instance.getComputationalDag(), corase_graph, partition); + bool acyc = is_acyclic(corase_graph); + BOOST_CHECK(acyc); + + SarkarMul coarser; + + graph_constr_t coarse_dag; + std::vector reverse_vertex_map; + coarser.coarsenDag(graph, coarse_dag, reverse_vertex_map); + + acyc = is_acyclic(coarse_dag); + BOOST_CHECK(acyc); +} \ No newline at end of file From b59be37ef71f45c45a0725dd15e2e9d7edf5b9fa Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Tue, 11 Nov 2025 12:53:42 +0100 Subject: [PATCH 10/20] update --- include/osp/bsp/model/BspInstance.hpp | 2 +- include/osp/coarser/coarser_util.hpp | 2 +- .../isomorphism_divider/MerkleHashComputer.hpp | 2 +- .../computational_dag_edge_idx_vector_impl.hpp | 8 ++++---- .../adj_list_impl/computational_dag_vector_impl.hpp | 4 ++-- .../adj_list_impl/dag_vector_adapter.hpp | 4 ++-- tests/graph_vector_adapter.cpp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/osp/bsp/model/BspInstance.hpp b/include/osp/bsp/model/BspInstance.hpp index 7840a207..f59a1e64 100644 --- a/include/osp/bsp/model/BspInstance.hpp +++ b/include/osp/bsp/model/BspInstance.hpp @@ -150,7 +150,7 @@ class BspInstance { */ inline Graph_t &getComputationalDag() { return cdag; } - inline std::size_t numberOfVertices() const { return cdag.num_vertices(); } + inline vertex_idx_t numberOfVertices() const { return cdag.num_vertices(); } inline auto vertices() const { return cdag.vertices(); } diff --git a/include/osp/coarser/coarser_util.hpp b/include/osp/coarser/coarser_util.hpp index bfc2b69a..e3e7fa79 100644 --- a/include/osp/coarser/coarser_util.hpp +++ b/include/osp/coarser/coarser_util.hpp @@ -419,7 +419,7 @@ invert_vertex_expansion_map(const std::vector> vertex_contraction_map(num_vert); for (std::size_t i = 0; i < vertex_expansion_map.size(); i++) { for (const vertex_idx_t &vert : vertex_expansion_map[i]) { - vertex_contraction_map[vert] = i; + vertex_contraction_map[vert] = static_cast>(i); } } diff --git a/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp b/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp index 772fbc9d..61a85e9e 100644 --- a/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp +++ b/include/osp/dag_divider/isomorphism_divider/MerkleHashComputer.hpp @@ -62,7 +62,7 @@ class MerkleHashComputer : public HashComputer> { std::sort(parent_child_hashes.begin(),parent_child_hashes.end()); std::size_t hash = node_hash_func(v); - for (const VertexType& pc_hash : parent_child_hashes) { + for (const auto& pc_hash : parent_child_hashes) { hash_combine(hash, pc_hash); } diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp index d45f5a11..44e2c3e4 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp @@ -149,8 +149,8 @@ class computational_dag_edge_idx_vector_impl { virtual ~computational_dag_edge_idx_vector_impl() = default; - inline vertex_idx num_edges() const { return edges_.size(); } - inline vertex_idx num_vertices() const { return vertices_.size(); } + inline vertex_idx num_edges() const { return static_cast(edges_.size()); } + inline vertex_idx num_vertices() const { return static_cast(vertices_.size()); } inline auto edges() const { return edge_range_vector_impl(*this); } @@ -162,8 +162,8 @@ class computational_dag_edge_idx_vector_impl { inline const std::vector &in_edges(vertex_idx v) const { return in_edges_[v]; } inline const std::vector &out_edges(vertex_idx v) const { return out_edges_[v]; } - inline vertex_idx in_degree(vertex_idx v) const { return in_edges_[v].size(); } - inline vertex_idx out_degree(vertex_idx v) const { return out_edges_[v].size(); } + inline vertex_idx in_degree(vertex_idx v) const { return static_cast(in_edges_[v].size()); } + inline vertex_idx out_degree(vertex_idx v) const { return static_cast(out_edges_[v].size()); } inline edge_comm_weight_type edge_comm_weight(directed_edge_descriptor e) const { return edges_[e.idx].comm_weight; diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp index e8f3d70d..fa38bc6c 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp @@ -125,9 +125,9 @@ class computational_dag_vector_impl { inline const std::vector &children(const vertex_idx v) const { return out_neigbors[v]; } - inline vertex_idx in_degree(const vertex_idx v) const { return in_neigbors[v].size(); } + inline vertex_idx in_degree(const vertex_idx v) const { return static_cast(in_neigbors[v].size()); } - inline vertex_idx out_degree(const vertex_idx v) const { return out_neigbors[v].size(); } + inline vertex_idx out_degree(const vertex_idx v) const { return static_cast(out_neigbors[v].size()); } inline vertex_work_weight_type vertex_work_weight(const vertex_idx v) const { return vertices_[v].work_weight; } diff --git a/include/osp/graph_implementations/adj_list_impl/dag_vector_adapter.hpp b/include/osp/graph_implementations/adj_list_impl/dag_vector_adapter.hpp index 8dbe6ca2..4651ff9d 100644 --- a/include/osp/graph_implementations/adj_list_impl/dag_vector_adapter.hpp +++ b/include/osp/graph_implementations/adj_list_impl/dag_vector_adapter.hpp @@ -137,9 +137,9 @@ class dag_vector_adapter { inline auto children(const vertex_idx v) const { return vector_cast_view(out_neigbors->at(v)); } - inline std::size_t in_degree(const vertex_idx v) const { return in_neigbors->at(v).size(); } + inline vertex_idx in_degree(const vertex_idx v) const { return static_cast(in_neigbors->at(v).size()); } - inline std::size_t out_degree(const vertex_idx v) const { return out_neigbors->at(v).size(); } + inline vertex_idx out_degree(const vertex_idx v) const { return static_cast(out_neigbors->at(v).size()); } inline vertex_work_weight_type vertex_work_weight(const vertex_idx v) const { return vertices_[v].work_weight; } diff --git a/tests/graph_vector_adapter.cpp b/tests/graph_vector_adapter.cpp index ac4de281..3fd6aedc 100644 --- a/tests/graph_vector_adapter.cpp +++ b/tests/graph_vector_adapter.cpp @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { auto partition = iso_scheduler.compute_partition(instance); - graph_t corase_graph; + graph_constr_t corase_graph; coarser_util::construct_coarse_dag(instance.getComputationalDag(), corase_graph, partition); bool acyc = is_acyclic(corase_graph); BOOST_CHECK(acyc); From 2bde9e94ede71c434337d6abc9d20ef2474e99c7 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Tue, 11 Nov 2025 13:04:20 +0100 Subject: [PATCH 11/20] update --- .../osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_util.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_util.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_util.hpp index 23d7cf86..24337f05 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_util.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_util.hpp @@ -196,7 +196,7 @@ struct adaptive_affinity_table { if (insert_location >= selected_nodes.size()) { const size_t old_size = selected_nodes.size(); - const size_t new_size = std::min(old_size * 2, graph->num_vertices()); + const size_t new_size = std::min(old_size * 2, static_cast(graph->num_vertices())); selected_nodes.resize(new_size); affinity_table.resize(new_size); From 69f80eb734f259ec8d3ade7d17f87625fa8a9e6c Mon Sep 17 00:00:00 2001 From: Raphael Steiner Date: Tue, 11 Nov 2025 13:10:26 +0100 Subject: [PATCH 12/20] removed Compact Sparse Graph warnings --- include/osp/coarser/Sarkar/Sarkar.hpp | 4 ++-- include/osp/graph_algorithms/directed_graph_top_sort.hpp | 2 +- tests/graph_vector_adapter.cpp | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/osp/coarser/Sarkar/Sarkar.hpp b/include/osp/coarser/Sarkar/Sarkar.hpp index 2cd925fe..2c441571 100644 --- a/include/osp/coarser/Sarkar/Sarkar.hpp +++ b/include/osp/coarser/Sarkar/Sarkar.hpp @@ -381,7 +381,7 @@ vertex_idx_t Sarkar::allChildrenContraction } expansionMapOutput.emplace_back( std::move(part) ); - counter += graph.out_degree(groupHead); + counter += static_cast>( graph.out_degree(groupHead) ); if (counter > maxCorseningNum) { minSave = vertSave; } @@ -512,7 +512,7 @@ vertex_idx_t Sarkar::allParentsContraction( } expansionMapOutput.emplace_back( std::move(part) ); - counter += graph.in_degree(groupFoot); + counter += static_cast>( graph.in_degree(groupFoot) ); if (counter > maxCorseningNum) { minSave = vertSave; } diff --git a/include/osp/graph_algorithms/directed_graph_top_sort.hpp b/include/osp/graph_algorithms/directed_graph_top_sort.hpp index 774f4319..0ebc6994 100644 --- a/include/osp/graph_algorithms/directed_graph_top_sort.hpp +++ b/include/osp/graph_algorithms/directed_graph_top_sort.hpp @@ -264,7 +264,7 @@ struct top_sort_iterator { if (is_source(v, graph)) { next.push(v); } else { - predecessors_count[v] = graph.in_degree(v); + predecessors_count[v] = static_cast>( graph.in_degree(v) ); } } current_vertex = next.pop_next(); diff --git a/tests/graph_vector_adapter.cpp b/tests/graph_vector_adapter.cpp index 3fd6aedc..ac812a3b 100644 --- a/tests/graph_vector_adapter.cpp +++ b/tests/graph_vector_adapter.cpp @@ -26,6 +26,7 @@ limitations under the License. #include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp" #include "osp/graph_implementations/adj_list_impl/dag_vector_adapter.hpp" #include "osp/graph_implementations/boost_graphs/boost_graph.hpp" +#include "osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp" #include "osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp" #include "osp/bsp/scheduler/Serial.hpp" #include "osp/bsp/scheduler/GreedySchedulers/GreedyMetaScheduler.hpp" @@ -52,6 +53,7 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { using v_impl = cdag_vertex_impl; using graph_t = dag_vector_adapter; using graph_constr_t = computational_dag_vector_impl; + using CoarseGraphType = Compact_Sparse_Graph, std::size_t, v_workw_t, v_workw_t, v_workw_t, v_type_t>; graph_t graph(out_neighbors, in_neighbors); @@ -68,7 +70,7 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { ComboScheduler growlocal_kl(growlocal, kl); ComboScheduler locking_kl(locking, kl); ComboScheduler children_kl(children, kl); - + GreedyMetaScheduler scheduler; // scheduler.addScheduler(growlocal_kl); scheduler.addScheduler(locking_kl); @@ -84,9 +86,9 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { bool acyc = is_acyclic(corase_graph); BOOST_CHECK(acyc); - SarkarMul coarser; + SarkarMul coarser; - graph_constr_t coarse_dag; + CoarseGraphType coarse_dag; std::vector reverse_vertex_map; coarser.coarsenDag(graph, coarse_dag, reverse_vertex_map); From d510fbce21cf4bfdebdc57b9e63fa515765d71db Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Tue, 11 Nov 2025 13:28:31 +0100 Subject: [PATCH 13/20] update --- include/osp/auxiliary/permute.hpp | 4 ++-- include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/osp/auxiliary/permute.hpp b/include/osp/auxiliary/permute.hpp index b78a8e07..5676a4f2 100644 --- a/include/osp/auxiliary/permute.hpp +++ b/include/osp/auxiliary/permute.hpp @@ -40,7 +40,7 @@ void permute_inplace(std::vector &vec, std::vector &perm) { } return true; }()); - assert((void *)&vec != (void *)&perm); + assert(reinterpret_cast(&vec) != reinterpret_cast(&perm)); for (Ind i = 0; i < perm.size(); ++i) { while (perm[i] != i) { @@ -66,7 +66,7 @@ void inverse_permute_inplace(std::vector &vec, std::vector &perm) { } return true; }()); - assert((void *)&vec != (void *)&perm); + assert(reinterpret_cast(&vec) != reinterpret_cast(&perm)); for (Ind i = 0; i < perm.size(); ++i) { diff --git a/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp b/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp index 86b070b6..9d737aab 100644 --- a/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp +++ b/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp @@ -122,7 +122,7 @@ RETURN_STATUS MultilevelCoarseAndSchedule::improve_acti template RETURN_STATUS MultilevelCoarseAndSchedule::expand_active_schedule() { - assert((active_graph > 0L) && ( (long unsigned) active_graph < ml_coarser->dag_history.size())); + assert((active_graph > 0L) && ( static_cast(active_graph) < ml_coarser->dag_history.size())); std::unique_ptr< BspInstance > expanded_instance = std::make_unique< BspInstance >( *(ml_coarser->dag_history.at( static_cast(active_graph) - 1 )), original_inst->getArchitecture()); std::unique_ptr< BspSchedule > expanded_schedule = std::make_unique< BspSchedule >( *expanded_instance ); @@ -175,7 +175,7 @@ RETURN_STATUS MultilevelCoarseAndSchedule::expand_activ template RETURN_STATUS MultilevelCoarseAndSchedule::run_expansions(BspSchedule& schedule) { - assert(active_graph >= 0L && (long unsigned) active_graph == ml_coarser->dag_history.size() - 1); + assert(active_graph >= 0L && static_cast(active_graph) == ml_coarser->dag_history.size() - 1); RETURN_STATUS status = RETURN_STATUS::OSP_SUCCESS; From 0899958c67e175b615d55800f5377117287d5d6b Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Tue, 11 Nov 2025 13:48:34 +0100 Subject: [PATCH 14/20] added work weights --- tests/graph_vector_adapter.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/graph_vector_adapter.cpp b/tests/graph_vector_adapter.cpp index ac812a3b..cf11d6d4 100644 --- a/tests/graph_vector_adapter.cpp +++ b/tests/graph_vector_adapter.cpp @@ -44,8 +44,6 @@ using namespace osp; BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { - std::vector vertices{0, 1, 2, 3, 4, 5, 6, 7}; - std::vector> out_neighbors{{1, 2, 3}, {4, 6}, {4, 5}, {7}, {7}, {}, {}, {}}; std::vector> in_neighbors{{}, {0}, {0}, {0}, {1, 2}, {2}, {1}, {4, 3}}; @@ -57,9 +55,20 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { graph_t graph(out_neighbors, in_neighbors); + for (auto v : graph.vertices()) { + graph.set_vertex_work_weight(v, 10); + } + BspInstance instance; instance.getComputationalDag() = graph; - + + instance.getArchitecture().setProcessorsWithTypes({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}); + instance.setDiagonalCompatibilityMatrix(2); + instance.setSynchronisationCosts(1000); + instance.setCommunicationCosts(1); + + + // Set up the scheduler GrowLocalAutoCores growlocal; BspLocking locking; From 55e8e57e4782bfa7d86ddaed290fe8dca6cd5157 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Tue, 11 Nov 2025 14:12:20 +0100 Subject: [PATCH 15/20] type fix graph implementation --- ...computational_dag_edge_idx_vector_impl.hpp | 41 +++++++++++-------- tests/graph_vector_adapter.cpp | 4 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp index 44e2c3e4..d1ac5c5f 100644 --- a/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp +++ b/include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp @@ -27,27 +27,30 @@ limitations under the License. namespace osp { +template struct directed_edge_descriptor_impl { - std::size_t idx; + using vertex_idx = typename v_impl::vertex_idx_type; - std::size_t source; - std::size_t target; + vertex_idx idx; + + vertex_idx source; + vertex_idx target; directed_edge_descriptor_impl() : idx(0), source(0), target(0) {} - directed_edge_descriptor_impl(const directed_edge_descriptor_impl &other) = default; - directed_edge_descriptor_impl(directed_edge_descriptor_impl &&other) = default; - directed_edge_descriptor_impl &operator=(const directed_edge_descriptor_impl &other) = default; - directed_edge_descriptor_impl &operator=(directed_edge_descriptor_impl &&other) = default; - directed_edge_descriptor_impl(std::size_t source_arg, std::size_t target_arg, std::size_t idx_arg) + directed_edge_descriptor_impl(const directed_edge_descriptor_impl &other) = default; + directed_edge_descriptor_impl(directed_edge_descriptor_impl &&other) = default; + directed_edge_descriptor_impl &operator=(const directed_edge_descriptor_impl &other) = default; + directed_edge_descriptor_impl &operator=(directed_edge_descriptor_impl &&other) = default; + directed_edge_descriptor_impl(vertex_idx source_arg, vertex_idx target_arg, vertex_idx idx_arg) : idx(idx_arg), source(source_arg), target(target_arg) {} ~directed_edge_descriptor_impl() = default; - bool operator==(const directed_edge_descriptor_impl &other) const { + bool operator==(const directed_edge_descriptor_impl &other) const { return idx == other.idx && source == other.source && target == other.target; } - bool operator!=(const directed_edge_descriptor_impl &other) const { return !(*this == other); } + bool operator!=(const directed_edge_descriptor_impl &other) const { return !(*this == other); } }; template @@ -66,11 +69,11 @@ template class computational_dag_edge_idx_vector_impl { public: // graph_traits specialization - using vertex_idx = std::size_t; - using directed_edge_descriptor = directed_edge_descriptor_impl; + using vertex_idx = typename v_impl::vertex_idx_type; + using directed_edge_descriptor = directed_edge_descriptor_impl; - using out_edges_iterator_t = std::vector::const_iterator; - using in_edges_iterator_t = std::vector::const_iterator; + using out_edges_iterator_t = typename std::vector::const_iterator; + using in_edges_iterator_t = typename std::vector::const_iterator; // cdag_traits specialization using vertex_work_weight_type = typename v_impl::work_weight_type; @@ -287,10 +290,12 @@ static_assert( } // namespace osp -template<> -struct std::hash { - std::size_t operator()(const osp::directed_edge_descriptor_impl &p) const noexcept { - auto h1 = std::hash{}(p.source); +template +struct std::hash> { + using vertex_idx = typename v_impl::vertex_idx_type; + + std::size_t operator()(const osp::directed_edge_descriptor_impl &p) const noexcept { + auto h1 = std::hash{}(p.source); osp::hash_combine(h1, p.target); return h1; diff --git a/tests/graph_vector_adapter.cpp b/tests/graph_vector_adapter.cpp index cf11d6d4..23aa248f 100644 --- a/tests/graph_vector_adapter.cpp +++ b/tests/graph_vector_adapter.cpp @@ -24,6 +24,7 @@ limitations under the License. #include "osp/graph_algorithms/directed_graph_util.hpp" #include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp" +#include "osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp" #include "osp/graph_implementations/adj_list_impl/dag_vector_adapter.hpp" #include "osp/graph_implementations/boost_graphs/boost_graph.hpp" #include "osp/graph_implementations/adj_list_impl/compact_sparse_graph.hpp" @@ -50,7 +51,8 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { using v_impl = cdag_vertex_impl; using graph_t = dag_vector_adapter; - using graph_constr_t = computational_dag_vector_impl; + //using graph_constr_t = computational_dag_vector_impl; + using graph_constr_t = computational_dag_edge_idx_vector_impl; using CoarseGraphType = Compact_Sparse_Graph, std::size_t, v_workw_t, v_workw_t, v_workw_t, v_type_t>; graph_t graph(out_neighbors, in_neighbors); From 64e8df547966d20bae16cb81367d74e4e3af32b4 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Tue, 11 Nov 2025 15:33:58 +0100 Subject: [PATCH 16/20] pr comments --- .../LocalSearch/KernighanLin/kl_base.hpp | 2 +- .../KernighanLin_v2/kl_improver.hpp | 3 +- .../IsomorphicSubgraphScheduler.hpp | 4 +- tests/graph_vector_adapter.cpp | 67 ++++++++++++++++++- 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp index d3616ae5..e49a92cb 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin/kl_base.hpp @@ -437,7 +437,7 @@ class kl_base : public ImprovementScheduler, public Ikl_cost_function { node_best_proc = proc; rand_count = 0; - } else if (node_max_gain <= proc_max) { + } else if (node_max_gain <= proc_max) { // only == if (rand() % (2 + rand_count) == 0) { node_max_gain = proc_max; diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp index 2fa0fdb1..86d8ad5e 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp @@ -93,8 +93,7 @@ class kl_improver : public ImprovementScheduler { constexpr static unsigned window_range = 2 * window_size + 1; constexpr static bool enable_quick_moves = true; constexpr static bool enable_preresolving_violations = true; - - const double EPSILON = 1e-9; + constexpr static double EPSILON = 1e-9; using memw_t = v_memw_t; using commw_t = v_commw_t; diff --git a/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp b/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp index cb91a559..272bdee4 100644 --- a/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp +++ b/include/osp/dag_divider/isomorphism_divider/IsomorphicSubgraphScheduler.hpp @@ -478,7 +478,7 @@ class IsomorphicSubgraphScheduler { // Map (superstep, processor) -> relative partition ID std::map, vertex_idx_t> sp_proc_to_relative_partition; vertex_idx_t num_partitions_per_subgraph = 0; - for (vertex_idx_t j = 0; j < rep_subgraph_vertices_sorted.size(); ++j) { + for (vertex_idx_t j = 0; j < static_cast>(rep_subgraph_vertices_sorted.size()); ++j) { const auto sp_pair = std::make_pair(bsp_schedule.assignedSuperstep(j), bsp_schedule.assignedProcessor(j)); if (sp_proc_to_relative_partition.find(sp_pair) == sp_proc_to_relative_partition.end()) { sp_proc_to_relative_partition[sp_pair] = num_partitions_per_subgraph++; @@ -489,7 +489,7 @@ class IsomorphicSubgraphScheduler { MerkleHashComputer rep_hasher(representative_instance.getComputationalDag()); // Replicate the schedule pattern for ALL subgraphs in the group --- - for (vertex_idx_t i = 0; i < group.subgraphs.size(); ++i) { + for (vertex_idx_t i = 0; i < static_cast>(group.subgraphs.size()); ++i) { auto current_subgraph_vertices_sorted = group.subgraphs[i]; std::sort(current_subgraph_vertices_sorted.begin(), current_subgraph_vertices_sorted.end()); diff --git a/tests/graph_vector_adapter.cpp b/tests/graph_vector_adapter.cpp index 23aa248f..e96a6be6 100644 --- a/tests/graph_vector_adapter.cpp +++ b/tests/graph_vector_adapter.cpp @@ -43,7 +43,7 @@ limitations under the License. using namespace osp; -BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { +BOOST_AUTO_TEST_CASE(test_dag_vector_adapter_edge) { std::vector> out_neighbors{{1, 2, 3}, {4, 6}, {4, 5}, {7}, {7}, {}, {}, {}}; @@ -51,7 +51,6 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { using v_impl = cdag_vertex_impl; using graph_t = dag_vector_adapter; - //using graph_constr_t = computational_dag_vector_impl; using graph_constr_t = computational_dag_edge_idx_vector_impl; using CoarseGraphType = Compact_Sparse_Graph, std::size_t, v_workw_t, v_workw_t, v_workw_t, v_type_t>; @@ -83,7 +82,69 @@ BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { ComboScheduler children_kl(children, kl); GreedyMetaScheduler scheduler; - // scheduler.addScheduler(growlocal_kl); + scheduler.addScheduler(locking_kl); + scheduler.addScheduler(children_kl); + scheduler.addSerialScheduler(); + + IsomorphicSubgraphScheduler iso_scheduler(scheduler); + + auto partition = iso_scheduler.compute_partition(instance); + + graph_constr_t corase_graph; + coarser_util::construct_coarse_dag(instance.getComputationalDag(), corase_graph, partition); + bool acyc = is_acyclic(corase_graph); + BOOST_CHECK(acyc); + + SarkarMul coarser; + + CoarseGraphType coarse_dag; + std::vector reverse_vertex_map; + coarser.coarsenDag(graph, coarse_dag, reverse_vertex_map); + + acyc = is_acyclic(coarse_dag); + BOOST_CHECK(acyc); +} + + +BOOST_AUTO_TEST_CASE(test_dag_vector_adapter) { + + std::vector> out_neighbors{{1, 2, 3}, {4, 6}, {4, 5}, {7}, {7}, {}, {}, {}}; + + std::vector> in_neighbors{{}, {0}, {0}, {0}, {1, 2}, {2}, {1}, {4, 3}}; + + using v_impl = cdag_vertex_impl; + using graph_t = dag_vector_adapter; + using graph_constr_t = computational_dag_vector_impl; + using CoarseGraphType = Compact_Sparse_Graph, std::size_t, v_workw_t, v_workw_t, v_workw_t, v_type_t>; + + graph_t graph(out_neighbors, in_neighbors); + + for (auto v : graph.vertices()) { + graph.set_vertex_work_weight(v, 10); + } + + BspInstance instance; + instance.getComputationalDag() = graph; + + instance.getArchitecture().setProcessorsWithTypes({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}); + instance.setDiagonalCompatibilityMatrix(2); + instance.setSynchronisationCosts(1000); + instance.setCommunicationCosts(1); + + + + // Set up the scheduler + GrowLocalAutoCores growlocal; + BspLocking locking; + GreedyChildren children; + kl_total_lambda_comm_improver kl(42); + kl.setSuperstepRemoveStrengthParameter(2.0); + kl.setTimeQualityParameter(5.0); + ComboScheduler growlocal_kl(growlocal, kl); + ComboScheduler locking_kl(locking, kl); + ComboScheduler children_kl(children, kl); + + GreedyMetaScheduler scheduler; scheduler.addScheduler(locking_kl); scheduler.addScheduler(children_kl); scheduler.addSerialScheduler(); From e194457443ba4e952d5ff412592ad903c29a259e Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Tue, 11 Nov 2025 17:28:04 +0100 Subject: [PATCH 17/20] fun with (more) flags --- CMakeLists.txt | 52 ++++++++++++++++--- include/osp/auxiliary/io/arch_file_reader.hpp | 3 ++ include/osp/coarser/Sarkar/Sarkar.hpp | 6 +++ tests/CMakeLists.txt | 2 +- 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f5f07c3..84c5327a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,24 +31,62 @@ add_subdirectory(.githooks) # --- Compile Options Configuration --- # Common compile options including strict warnings and error-on-warning set(COMMON_CXX_WARNING_FLAGS - "-Wall" - "-Wextra" "-Wfatal-errors" "-Wconversion" "-Wsign-conversion" - "-Wunused" "-Wunreachable-code" "-Wuninitialized" - "-Wshadow" - "-Wfloat-equal" - "-Wnon-virtual-dtor" "-pedantic" "-Wpedantic" "-Wold-style-cast" "-Wcast-align" + "-Werror" + "-Wall" + "-Wextra" + "-Wundef" + "-Wunused" + "-Wcast-qual" + "-Wpointer-arith" + "-Wdate-time" + "-Wfloat-equal" + "-Wformat=2" + "-Wshadow" + "-Wsign-compare" + "-Wunused-macros" + "-Wvla" + "-Wdisabled-optimization" + "-Wempty-body" + "-Wignored-qualifiers" + "-Wtype-limits" + "-Wshift-negative-value" + "-Wswitch-default" + "-Woverloaded-virtual" + "-Wnon-virtual-dtor" + "-Wshift-overflow=2" + "-Wshift-count-overflow" + "-Wwrite-strings" + "-Wmissing-format-attribute" + "-Wformat-nonliteral" "-Wduplicated-cond" + "-Wtrampolines" + "-Wsized-deallocation" + "-Wlogical-op" + "-Wsuggest-attribute=format" "-Wduplicated-branches" - "-Werror" + "-Wmissing-include-dirs" + "-Wformat-signedness" + "-Wreturn-local-addr" + "-Wredundant-decls" + "-Wfloat-conversion" + "-fno-common" + "-fno-strict-aliasing" + "-Wno-return-type" + "-Wno-array-bounds" + "-Wno-maybe-uninitialized" + "-Wno-unused-but-set-variable" + "-Wno-unused-variable" + "-Wno-unused-parameter" + "-Wno-unused-result" ) # --- Project-specific Compile Flags --- diff --git a/include/osp/auxiliary/io/arch_file_reader.hpp b/include/osp/auxiliary/io/arch_file_reader.hpp index 93ca36a4..4e100ba8 100644 --- a/include/osp/auxiliary/io/arch_file_reader.hpp +++ b/include/osp/auxiliary/io/arch_file_reader.hpp @@ -73,6 +73,9 @@ bool readBspArchitecture(std::ifstream &infile, BspArchitecture &archit architecture.setMemoryConstraintType(MEMORY_CONSTRAINT_TYPE::PERSISTENT_AND_TRANSIENT); architecture.setMemoryBound(static_cast(M)); break; + default: + std::cerr << "Invalid memory type.\n"; + return false; } } else if (mem_type == -1) { std::cout << "No memory type specified. Assuming \"NONE\".\n"; diff --git a/include/osp/coarser/Sarkar/Sarkar.hpp b/include/osp/coarser/Sarkar/Sarkar.hpp index 2c441571..3612825a 100644 --- a/include/osp/coarser/Sarkar/Sarkar.hpp +++ b/include/osp/coarser/Sarkar/Sarkar.hpp @@ -608,6 +608,12 @@ std::vector>> Sarkar Date: Tue, 11 Nov 2025 17:59:31 +0100 Subject: [PATCH 18/20] Wsign-compare --- include/osp/bsp/model/BspSchedule.hpp | 8 ++++---- include/osp/bsp/model/VectorSchedule.hpp | 4 ++-- include/osp/bsp/scheduler/Serial.hpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/osp/bsp/model/BspSchedule.hpp b/include/osp/bsp/model/BspSchedule.hpp index 21dc4646..dba4f0d7 100644 --- a/include/osp/bsp/model/BspSchedule.hpp +++ b/include/osp/bsp/model/BspSchedule.hpp @@ -237,7 +237,7 @@ class BspSchedule : public IBspSchedule, public IBspScheduleEvalnumberOfVertices(); ++i) { + for (vertex_idx_t i = 0; i < instance->numberOfVertices(); ++i) { if (node_to_superstep_assignment[i] >= number_of_supersteps) { number_of_supersteps = node_to_superstep_assignment[i] + 1; } @@ -327,7 +327,7 @@ class BspSchedule : public IBspSchedule, public IBspScheduleEvalnumberOfVertices(); ++i) { + for (vertex_idx_t i = 0; i < instance->numberOfVertices(); ++i) { if (vec[i] >= number_of_supersteps) { number_of_supersteps = vec[i] + 1; @@ -550,8 +550,8 @@ class BspSchedule : public IBspSchedule, public IBspScheduleEvalnumberOfVertices() || - node_to_superstep_assignment.size() != instance->numberOfVertices()) { + if (static_cast>(node_to_processor_assignment.size()) != instance->numberOfVertices() || + static_cast>(node_to_superstep_assignment.size()) != instance->numberOfVertices()) { return false; } diff --git a/include/osp/bsp/model/VectorSchedule.hpp b/include/osp/bsp/model/VectorSchedule.hpp index d3895900..a81cc3e5 100644 --- a/include/osp/bsp/model/VectorSchedule.hpp +++ b/include/osp/bsp/model/VectorSchedule.hpp @@ -58,7 +58,7 @@ class VectorSchedule : public IBspSchedule { node_to_superstep_assignment = std::vector(schedule.getInstance().numberOfVertices(), schedule.numberOfSupersteps()); - for (unsigned i = 0; i < schedule.getInstance().numberOfVertices(); i++) { + for (vertex_idx_t i = 0; i < schedule.getInstance().numberOfVertices(); i++) { node_to_processor_assignment[i] = schedule.assignedProcessor(i); node_to_superstep_assignment[i] = schedule.assignedSuperstep(i); @@ -78,7 +78,7 @@ class VectorSchedule : public IBspSchedule { std::vector(instance->numberOfVertices(), instance->numberOfProcessors()); node_to_superstep_assignment = std::vector(instance->numberOfVertices(), number_of_supersteps); - for (unsigned i = 0; i < instance->numberOfVertices(); i++) { + for (vertex_idx_t i = 0; i < instance->numberOfVertices(); i++) { node_to_processor_assignment[i] = other.assignedProcessor(i); node_to_superstep_assignment[i] = other.assignedSuperstep(i); } diff --git a/include/osp/bsp/scheduler/Serial.hpp b/include/osp/bsp/scheduler/Serial.hpp index 4ecf3345..2cf2bc58 100644 --- a/include/osp/bsp/scheduler/Serial.hpp +++ b/include/osp/bsp/scheduler/Serial.hpp @@ -101,7 +101,7 @@ class Serial : public Scheduler { } } - size_t scheduled_nodes_count = 0; + vertex_idx_t scheduled_nodes_count = 0; unsigned current_superstep = 0; while (scheduled_nodes_count < num_vertices) { From 1603fccfe48fed721b2492670defc2551aa281b8 Mon Sep 17 00:00:00 2001 From: Raphael Steiner Date: Wed, 12 Nov 2025 08:49:50 +0100 Subject: [PATCH 19/20] Sarkar Default fix --- include/osp/coarser/Sarkar/Sarkar.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/osp/coarser/Sarkar/Sarkar.hpp b/include/osp/coarser/Sarkar/Sarkar.hpp index 3612825a..c3deca2c 100644 --- a/include/osp/coarser/Sarkar/Sarkar.hpp +++ b/include/osp/coarser/Sarkar/Sarkar.hpp @@ -609,9 +609,12 @@ std::vector>> Sarkar Date: Wed, 12 Nov 2025 08:51:13 +0100 Subject: [PATCH 20/20] old cast style fix --- include/osp/coarser/Sarkar/Sarkar.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osp/coarser/Sarkar/Sarkar.hpp b/include/osp/coarser/Sarkar/Sarkar.hpp index c3deca2c..7845b049 100644 --- a/include/osp/coarser/Sarkar/Sarkar.hpp +++ b/include/osp/coarser/Sarkar/Sarkar.hpp @@ -545,7 +545,7 @@ template std::vector>> Sarkar::generate_vertex_expansion_map(const Graph_t_in &dag_in, vertex_idx_t &diff) { std::vector>> expansionMap; - // std::cout << "Mode: " << (int) params.mode << "\n"; + // std::cout << "Mode: " << static_cast(params.mode) << "\n"; switch (params.mode) {