Skip to content

Commit 877d43f

Browse files
greedyrecomp test suite and upgrades
1 parent 1eb07c9 commit 877d43f

6 files changed

Lines changed: 133 additions & 57 deletions

File tree

apps/config/bsp_test_suite_config.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,30 @@
1818
"parameters": {}
1919
},
2020
{
21-
"name": "GreedyRecomputer",
21+
"name": "GreedyRecomputerMask7",
22+
"id": "GreedyRecomputer",
2223
"run" : true,
23-
"name_suffix" : "Locking",
24+
"name_suffix" : "GreedyBsp",
2425
"parameters": {
26+
"methodmask" : 7,
2527
"scheduler": {
26-
"name": "BspLocking",
28+
"name": "GreedyBspHC",
29+
"id": "LocalSearch",
30+
"run" : true,
31+
"name_suffix" : "GreedyBspHC",
2732
"parameters": {
28-
"max_percent_idle_processors": 0.4,
29-
"increase_parallelism_in_new_superstep": true
30-
}
33+
"improver": {
34+
"name" : "hill_climb"
35+
},
36+
"scheduler": {
37+
"name": "GreedyBsp",
38+
"id": "GreedyBsp",
39+
"parameters": {
40+
"max_percent_idle_processors": 0.2,
41+
"increase_parallelism_in_new_superstep": true
42+
}
43+
}
44+
}
3145
}
3246
}
3347
},

apps/test_suite_runner/AbstractTestSuiteRunner.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ class AbstractTestSuiteRunner {
312312
continue;
313313
}
314314

315+
bspInstance.SetAllOnesCompatibilityMatrix();
316+
315317
for (auto &algorithmConfigPair : parser_.scheduler_) {
316318
const pt::ptree &algoConfig = algorithmConfigPair.second;
317319

apps/test_suite_runner/StringToScheduler/run_bsp_recomp_scheduler.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ ReturnStatus RunBspRecompScheduler(const ConfigParser &parser,
4545

4646
std::cout << "Running algorithm: " << algorithm.get_child("name").get_value<std::string>() << std::endl;
4747

48-
if (algorithm.get_child("name").get_value<std::string>() == "GreedyRecomputer") {
48+
if (algorithm.get_child("id").get_value<std::string>() == "GreedyRecomputer") {
4949
BspSchedule<GraphT> bspSchedule(schedule.GetInstance());
5050

51+
unsigned methodMask = algorithm.get_child("parameters").get_child("methodmask").get_value<unsigned>();
52+
if (methodMask > 7) {
53+
return ReturnStatus::ERROR;
54+
}
55+
5156
ReturnStatus status = RunBspScheduler(parser, algorithm.get_child("parameters").get_child("scheduler"), bspSchedule);
5257

5358
BspScheduleCS<GraphT> initialSchedule(std::move(bspSchedule));
@@ -58,7 +63,11 @@ ReturnStatus RunBspRecompScheduler(const ConfigParser &parser,
5863

5964
GreedyRecomputer<GraphT> scheduler;
6065

61-
return scheduler.ComputeRecompScheduleBasic(initialSchedule, schedule);
66+
if (methodMask == 0) {
67+
return scheduler.ComputeRecompScheduleBasic(initialSchedule, schedule);
68+
} else {
69+
return scheduler.ComputeRecompScheduleAdvanced(initialSchedule, schedule, methodMask);
70+
}
6271

6372
} else {
6473
throw std::invalid_argument("Parameter error: Unknown algorithm.\n");

apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,16 @@ ReturnStatus RunBspScheduler(const ConfigParser &parser,
196196

197197
std::unique_ptr<ImprovementScheduler<GraphT>> improver
198198
= GetBspImproverByName<GraphT>(parser, algorithm.get_child("parameters").get_child("improver"));
199-
return improver->ImproveSchedule(schedule);
199+
200+
const unsigned timeLimit = parser.globalParams_.get_optional<unsigned>("timeLimit").value_or(std::numeric_limits<unsigned>::max());
201+
improver->SetTimeLimitSeconds(timeLimit);
202+
if (timeLimit == std::numeric_limits<unsigned>::max()) {
203+
return improver->ImproveSchedule(schedule);
204+
} else {
205+
return improver->ImproveScheduleWithTimeLimit(schedule);
206+
}
207+
208+
200209
#ifdef COPT
201210
} else if (id == "FullILP") {
202211
CoptFullScheduler<GraphT> scheduler;

include/osp/bsp/model/BspScheduleRecomp.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ bool BspScheduleRecomp<GraphT>::SatisfiesConstraints() const {
211211

212212
if (nodeFirstAvailableOnProc[node][fromProc] > val) {
213213
// std::cout << "Not a valid schedule: node " << node << " not yet available for sending from processor "
214-
// << from_proc << " in superstep "<< val <<"." << std::endl;
214+
// << fromProc << " in superstep "<< val <<"." << std::endl;
215215
return false;
216216
}
217217
}
@@ -341,7 +341,7 @@ void BspScheduleRecomp<Graph_t>::CleanSchedule()
341341
for (auto const &[key, val] : commSchedule_) {
342342
arrivesAt[std::get<0>(key)][std::get<2>(key)].insert(val);
343343
}
344-
344+
345345
// - computation steps
346346
for (const auto &node : instance_->GetComputationalDag().Vertices()) {
347347
for (unsigned index = 0; index < nodeToProcessorAndSupertepAssignment_[node].size(); ) {
@@ -386,7 +386,7 @@ void BspScheduleRecomp<Graph_t>::CleanSchedule()
386386
usedAt[std::get<0>(key)][std::get<1>(key)].insert(val);
387387
}
388388

389-
// - computation steps
389+
// - computation steps
390390
for (const auto &node : instance_->GetComputationalDag().Vertices()) {
391391
for (unsigned index = 0; index < nodeToProcessorAndSupertepAssignment_[node].size(); ) {
392392
const auto &procAndStep = nodeToProcessorAndSupertepAssignment_[node][index];

0 commit comments

Comments
 (0)