Skip to content
Snippets Groups Projects
Commit 01cdd617 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Improved parallel scheduler

parent 1b2e606d
No related branches found
No related tags found
2 merge requests!212Version 0.3.0,!186Refactor OperatorImpl for backend/export
Pipeline #54354 passed
......@@ -127,7 +127,12 @@ void Aidge::ParallelScheduler::forward(bool forwardDims, const std::vector<std::
// in the next step
for (size_t i = 0; i < staticSchedule.size(); ) {
auto runnable = staticSchedule[i];
if (!pool.busy() && runnable->early <= latest) {
if (runnable->early > latest) {
// No more node can be run at this step (latest)
break;
}
if (!pool.busy()) {
// Check that potential preceding non-critical nodes are finished
bool ready = true;
for (auto elt : runnable->laterThan) {
......@@ -168,9 +173,17 @@ void Aidge::ParallelScheduler::forward(bool forwardDims, const std::vector<std::
}
}
else {
// Thread pool is already full or no more node can be run at
// this step (latest)
break;
// Thread pool is already full
bool ready = true;
for (auto elt : mustFinish) {
ready = ready && finished.at(elt);
}
if (!ready) {
std::this_thread::yield();
}
else {
break;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment