diff --git a/include/osp/auxiliary/datastructures/heaps/PairingHeap.hpp b/include/osp/auxiliary/datastructures/heaps/PairingHeap.hpp index 691980f3..39bb79f4 100644 --- a/include/osp/auxiliary/datastructures/heaps/PairingHeap.hpp +++ b/include/osp/auxiliary/datastructures/heaps/PairingHeap.hpp @@ -202,7 +202,8 @@ template class PairingHeap { void push(const Key &key, const Value &value) { Node *new_node = new Node{key, value}; // emplace and check for success to avoid a separate lookup with contains() - auto [it, success] = node_map.emplace(key, new_node); + const auto pair = node_map.emplace(key, new_node); + const bool &success = pair.second; if (!success) { delete new_node; // Avoid memory leak if key already exists throw std::invalid_argument("Key already exists in the heap."); diff --git a/include/osp/bsp/model/BspScheduleRecomp.hpp b/include/osp/bsp/model/BspScheduleRecomp.hpp index 622e1ba9..8e8a9cc2 100644 --- a/include/osp/bsp/model/BspScheduleRecomp.hpp +++ b/include/osp/bsp/model/BspScheduleRecomp.hpp @@ -324,8 +324,10 @@ void BspScheduleRecomp::mergeSupersteps() new_assignment.emplace_back(entry.first, new_step_idx[entry.second]); node_to_processor_and_supertep_assignment[node] = new_assignment; } - for (auto &[key, step] : commSchedule) + for (auto &key_step_pair : commSchedule) { + auto &step = key_step_pair.second; step = new_step_idx[step]; + } number_of_supersteps = current_step_idx; } diff --git a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_hyper_total_comm_cost.hpp b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_hyper_total_comm_cost.hpp index bd096b5a..6b6f25b5 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_hyper_total_comm_cost.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/kl_hyper_total_comm_cost.hpp @@ -96,7 +96,8 @@ struct kl_hyper_total_comm_cost_function { for(const auto vertex : graph->vertices()) { const unsigned vertex_proc = active_schedule->assigned_processor(vertex); const cost_t v_comm_cost = graph->vertex_comm_weight(vertex); - for (const auto [lambda_proc, mult] : node_lambda_map.iterate_proc_entries(vertex)) { + for (const auto lambdaproc_mult_pair : node_lambda_map.iterate_proc_entries(vertex)) { + const auto &lambda_proc = lambdaproc_mult_pair.first; comm_costs += v_comm_cost * instance->communicationCosts(vertex_proc, lambda_proc); } } @@ -521,7 +522,8 @@ struct kl_hyper_total_comm_cost_function { if (p == node_proc) continue; - for (const auto [lambda_proc, mult] : node_lambda_map.iterate_proc_entries(node)) { + for (const auto lambda_pair : node_lambda_map.iterate_proc_entries(node)) { + const auto &lambda_proc = lambda_pair.first; const cost_t comm_cost = change_comm_cost(instance->communicationCosts(p, lambda_proc), instance->communicationCosts(node_proc, lambda_proc), comm_gain); for (unsigned idx = node_start_idx; idx < window_bound; idx++) { affinity_table_node[p][idx] += comm_cost; 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 86d8ad5e..896a315d 100644 --- a/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_improver.hpp @@ -430,7 +430,8 @@ class kl_improver : public ImprovementScheduler { std::vector quick_moves_stack; quick_moves_stack.reserve(10 + thread_data.active_schedule_data.new_violations.size() * 2); - for (const auto& [key, value] : thread_data.active_schedule_data.new_violations) { + for (const auto& key_value_pair : thread_data.active_schedule_data.new_violations) { + const auto &key = key_value_pair.first; quick_moves_stack.push_back(key); } @@ -458,7 +459,8 @@ class kl_improver : public ImprovementScheduler { if (thread_data.active_schedule_data.new_violations.size() > 0) { bool abort = false; - for (const auto& [key, value] : thread_data.active_schedule_data.new_violations) { + for (const auto& key_value_pair : thread_data.active_schedule_data.new_violations) { + const auto &key = key_value_pair.first; if(local_lock.find(key) != local_lock.end()) { abort = true; break; @@ -545,7 +547,8 @@ class kl_improver : public ImprovementScheduler { if (new_num_violations == 0) break; if (thread_data.active_schedule_data.new_violations.size() > 0) { - for (const auto & [vertex, edge] : thread_data.active_schedule_data.new_violations) { + for (const auto & vertex_edge_pair : thread_data.active_schedule_data.new_violations) { + const auto &vertex = vertex_edge_pair.first; thread_data.affinity_table.insert(vertex); } } @@ -720,7 +723,8 @@ class kl_improver : public ImprovementScheduler { #ifdef KL_DEBUG std::cout << "recmopute max gain: {"; - for (const auto [key, value] : recompute_max_gain) { + for (const auto map_pair : recompute_max_gain) { + const auto &key = map_pair.first; std::cout << key << ", "; } std::cout << "}" << std::endl; @@ -833,7 +837,8 @@ class kl_improver : public ImprovementScheduler { inline bool blocked_edge_strategy(VertexType node, std::vector & unlock_nodes, ThreadSearchContext & thread_data) { if (thread_data.unlock_edge_backtrack_counter > 1) { - for (const auto [v,e] : thread_data.active_schedule_data.new_violations) { + for (const auto vertex_edge_pair : thread_data.active_schedule_data.new_violations) { + const auto &e = vertex_edge_pair.second; const auto source_v = source(e, *graph); const auto target_v = target(e, *graph); @@ -958,7 +963,8 @@ class kl_improver : public ImprovementScheduler { //thread_data.selection_strategy.add_neighbours_to_selection(node, thread_data.affinity_table, thread_data.start_step, thread_data.end_step); if (thread_data.active_schedule_data.new_violations.size() > 0) { - for (const auto & [vertex, edge] : thread_data.active_schedule_data.new_violations) { + for (const auto & vertex_edge_pair : thread_data.active_schedule_data.new_violations) { + const auto &vertex = vertex_edge_pair.first; thread_data.affinity_table.insert(vertex); } } diff --git a/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp b/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp index 847913f3..f8d40494 100644 --- a/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp +++ b/include/osp/dag_divider/isomorphism_divider/OrbitGraphProcessor.hpp @@ -588,7 +588,8 @@ class OrbitGraphProcessor { contraction_map_.assign(dag.num_vertices(), 0); VertexType coarse_node_idx = 0; - for (const auto &[hash, vertices] : orbits) { + for (const auto &hash_vertices_pair : orbits) { + const auto &vertices = hash_vertices_pair.second; for (const auto v : vertices) { contraction_map_[v] = coarse_node_idx; }