Skip to content

Commit d0c1d57

Browse files
Synchronisation costs only added
1 parent 8369713 commit d0c1d57

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/osp/bsp/model/MaxBspSchedule.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ class MaxBspSchedule : public BspSchedule<Graph_t> {
112112
const std::vector<v_commw_t<Graph_t>> max_comm_per_step = this->compute_max_comm_per_step_helper(rec, send);
113113
const std::vector<v_workw_t<Graph_t>> max_work_per_step = this->compute_max_work_per_step_helper();
114114

115-
v_workw_t<Graph_t> costs = 0;
116-
for (unsigned step = 0; step < this->number_of_supersteps; step++) {
117-
const auto step_comm_cost = (step == 0) ? 0 : max_comm_per_step[step - 1];
115+
v_workw_t<Graph_t> costs = 0U;
116+
for (unsigned step = 0U; step < this->number_of_supersteps; step++) {
117+
const auto step_comm_cost = (step == 0U) ? 0U : max_comm_per_step[step - 1U];
118+
if (step_comm_cost > 0U) {
119+
step_comm_cost += this->instance->synchronisationCosts();
120+
}
118121
costs += std::max(step_comm_cost, max_work_per_step[step]);
119122

120-
if (step_comm_cost > 0) {
121-
costs += this->instance->synchronisationCosts();
122-
}
123123
}
124124
return costs;
125125
}

include/osp/bsp/model/MaxBspScheduleCS.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ class MaxBspScheduleCS : public BspScheduleCS<Graph_t> {
106106
const std::vector<v_commw_t<Graph_t>> max_comm_per_step = this->compute_max_comm_per_step_helper(rec, send);
107107
const std::vector<v_workw_t<Graph_t>> max_work_per_step = this->compute_max_work_per_step_helper();
108108

109-
v_workw_t<Graph_t> costs = 0;
110-
for (unsigned step = 0; step < this->number_of_supersteps; step++) {
111-
const auto step_comm_cost = (step == 0) ? 0 : max_comm_per_step[step - 1];
109+
v_workw_t<Graph_t> costs = 0U;
110+
for (unsigned step = 0U; step < this->number_of_supersteps; step++) {
111+
const auto step_comm_cost = (step == 0U) ? 0U : max_comm_per_step[step - 1U];
112+
if (step_comm_cost > 0U) {
113+
step_comm_cost += this->instance->synchronisationCosts();
114+
}
112115
costs += std::max(step_comm_cost, max_work_per_step[step]);
113116

114-
if (step_comm_cost > 0) {
115-
costs += this->instance->synchronisationCosts();
116-
}
117117
}
118118
return costs;
119119
}

0 commit comments

Comments
 (0)