Skip to content

Commit 2b1aa72

Browse files
BspSchedule constructor explicit (+test fix) (#27)
1 parent d794952 commit 2b1aa72

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ RETURN_STATUS run_bsp_scheduler(const ConfigParser &parser, const boost::propert
198198
if (status != RETURN_STATUS::OSP_SUCCESS && status != RETURN_STATUS::BEST_FOUND) {
199199
throw std::invalid_argument("Error while computing initial solution.\n");
200200
}
201-
scheduler.setInitialSolutionFromBspSchedule(initial_schedule);
201+
BspScheduleCS<Graph_t> initial_schedule_cs(initial_schedule);
202+
scheduler.setInitialSolutionFromBspSchedule(initial_schedule_cs);
202203
}
203204

204205
// intermediate solutions

include/osp/bsp/model/BspScheduleCS.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class BspScheduleCS : public BspSchedule<Graph_t> {
112112
const std::map<KeyTriple, unsigned int> &comm_)
113113
: BspSchedule<Graph_t>(inst, processor_assignment_, superstep_assignment_), commSchedule(comm_) {}
114114

115-
BspScheduleCS(BspSchedule<Graph_t> &&schedule) : BspSchedule<Graph_t>(std::move(schedule)) {
115+
explicit BspScheduleCS(BspSchedule<Graph_t> &&schedule) : BspSchedule<Graph_t>(std::move(schedule)) {
116116
setAutoCommunicationSchedule();
117117
}
118118

@@ -124,7 +124,7 @@ class BspScheduleCS : public BspSchedule<Graph_t> {
124124
comm_.clear();
125125
}
126126

127-
BspScheduleCS(const BspSchedule<Graph_t> &schedule) : BspSchedule<Graph_t>(schedule) {
127+
explicit BspScheduleCS(const BspSchedule<Graph_t> &schedule) : BspSchedule<Graph_t>(schedule) {
128128
setAutoCommunicationSchedule();
129129
}
130130

tests/ilp_bsp_scheduler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ BOOST_AUTO_TEST_CASE(test_full) {
174174
MaxBspScheduleCS<graph> schedule_max(instance);
175175
scheduler_max.setTimeLimitSeconds(10);
176176
const auto result_max = scheduler_max.computeMaxBspScheduleCS(schedule_max);
177-
BOOST_CHECK_EQUAL(RETURN_STATUS::BEST_FOUND, result_max);
177+
BOOST_CHECK(result_max == RETURN_STATUS::OSP_SUCCESS || result_max == RETURN_STATUS::BEST_FOUND);
178178
BOOST_CHECK(schedule_max.satisfiesPrecedenceConstraints());
179179
BOOST_CHECK(schedule_max.hasValidCommSchedule());
180180

181181
scheduler_max.setInitialSolutionFromBspSchedule(schedule_max);
182182
const auto result_max2 = scheduler_max.computeMaxBspScheduleCS(schedule_max);
183-
BOOST_CHECK_EQUAL(RETURN_STATUS::BEST_FOUND, result_max2);
183+
BOOST_CHECK(result_max2 == RETURN_STATUS::OSP_SUCCESS || result_max2 == RETURN_STATUS::BEST_FOUND);
184184
BOOST_CHECK(schedule_max.satisfiesPrecedenceConstraints());
185185
BOOST_CHECK(schedule_max.hasValidCommSchedule());
186186

0 commit comments

Comments
 (0)