Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/osp/auxiliary/datastructures/heaps/PairingHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ template <typename Key, typename Value, typename Compare> 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.");
Expand Down
4 changes: 3 additions & 1 deletion include/osp/bsp/model/BspScheduleRecomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,10 @@ void BspScheduleRecomp<Graph_t>::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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ class kl_improver : public ImprovementScheduler<Graph_t> {
std::vector<VertexType> 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);
}

Expand Down Expand Up @@ -458,7 +459,8 @@ class kl_improver : public ImprovementScheduler<Graph_t> {
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;
Expand Down Expand Up @@ -545,7 +547,8 @@ class kl_improver : public ImprovementScheduler<Graph_t> {
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);
}
}
Expand Down Expand Up @@ -720,7 +723,8 @@ class kl_improver : public ImprovementScheduler<Graph_t> {

#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;
Expand Down Expand Up @@ -833,7 +837,8 @@ class kl_improver : public ImprovementScheduler<Graph_t> {

inline bool blocked_edge_strategy(VertexType node, std::vector<VertexType> & 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);

Expand Down Expand Up @@ -958,7 +963,8 @@ class kl_improver : public ImprovementScheduler<Graph_t> {
//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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down