Skip to content

Commit 3264e04

Browse files
committed
simplification
1 parent e0ad973 commit 3264e04

1 file changed

Lines changed: 33 additions & 34 deletions

File tree

include/osp/bsp/scheduler/LocalSearch/KernighanLin_v2/comm_cost_modules/max_comm_datastructure.hpp

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -277,47 +277,46 @@ struct max_comm_datastructure {
277277

278278
// Update Parents' Outgoing Communication (Parents → Node)
279279

280-
if (from_proc != to_proc || from_step != to_step) {
281-
for (const auto &parent : graph.parents(node)) {
282-
const unsigned parent_step = active_schedule->assigned_superstep(parent);
283-
// Fast boundary check
284-
if (parent_step >= step_proc_send_.size())
285-
continue;
286-
287-
const unsigned parent_proc = active_schedule->assigned_processor(parent);
288-
const comm_weight_t comm_w_parent = graph.vertex_comm_weight(parent);
289-
290-
auto &val = node_lambda_map.get_proc_entry(parent, from_proc);
291-
const bool removed_from_proc = CommPolicy::remove_child(val, from_step);
292-
293-
// 1. Handle Removal from from_proc
294-
if (removed_from_proc) {
295-
if (from_proc != parent_proc) {
296-
const comm_weight_t cost = comm_w_parent * instance->sendCosts(parent_proc, from_proc);
297-
if (cost > 0) {
298-
CommPolicy::unattribute_communication(*this, cost, parent_step, parent_proc, from_proc,
299-
from_step, val);
300-
}
280+
for (const auto &parent : graph.parents(node)) {
281+
const unsigned parent_step = active_schedule->assigned_superstep(parent);
282+
// Fast boundary check
283+
if (parent_step >= step_proc_send_.size())
284+
continue;
285+
286+
const unsigned parent_proc = active_schedule->assigned_processor(parent);
287+
const comm_weight_t comm_w_parent = graph.vertex_comm_weight(parent);
288+
289+
auto &val = node_lambda_map.get_proc_entry(parent, from_proc);
290+
const bool removed_from_proc = CommPolicy::remove_child(val, from_step);
291+
292+
// 1. Handle Removal from from_proc
293+
if (removed_from_proc) {
294+
if (from_proc != parent_proc) {
295+
const comm_weight_t cost = comm_w_parent * instance->sendCosts(parent_proc, from_proc);
296+
if (cost > 0) {
297+
CommPolicy::unattribute_communication(*this, cost, parent_step, parent_proc, from_proc,
298+
from_step, val);
301299
}
302300
}
301+
}
302+
303+
auto &val_to = node_lambda_map.get_proc_entry(parent, to_proc);
304+
const bool added_to_proc = CommPolicy::add_child(val_to, to_step);
303305

304-
auto &val_to = node_lambda_map.get_proc_entry(parent, to_proc);
305-
const bool added_to_proc = CommPolicy::add_child(val_to, to_step);
306-
307-
// 2. Handle Addition to to_proc
308-
if (added_to_proc) {
309-
if (to_proc != parent_proc) {
310-
const comm_weight_t cost = comm_w_parent * instance->sendCosts(parent_proc, to_proc);
311-
if (cost > 0) {
312-
CommPolicy::attribute_communication(*this, cost, parent_step, parent_proc, to_proc, to_step,
313-
val_to);
314-
}
306+
// 2. Handle Addition to to_proc
307+
if (added_to_proc) {
308+
if (to_proc != parent_proc) {
309+
const comm_weight_t cost = comm_w_parent * instance->sendCosts(parent_proc, to_proc);
310+
if (cost > 0) {
311+
CommPolicy::attribute_communication(*this, cost, parent_step, parent_proc, to_proc, to_step,
312+
val_to);
315313
}
316314
}
317-
318-
mark_step(parent_step);
319315
}
316+
317+
mark_step(parent_step);
320318
}
319+
321320

322321
// Re-arrange Affected Steps
323322
for (unsigned step : affected_steps_list) {

0 commit comments

Comments
 (0)