Skip to content
Snippets Groups Projects
Commit 9cabcb41 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

[Scheduler] Update the way progress bar is computed.

parent 5a104feb
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,11 @@ void drawProgressBar(double progress, int barWidth, const std::string& additiona ...@@ -34,6 +34,11 @@ void drawProgressBar(double progress, int barWidth, const std::string& additiona
} }
void Aidge::SequentialScheduler::generateScheduling(bool verbose) { void Aidge::SequentialScheduler::generateScheduling(bool verbose) {
// TODO: For loop on the list of node to run
// run sequencially every runnable consumers once
// TODO: handle memory allocation in scheduler
// TODO: optimize memory usage
// setup initial producers list // setup initial producers list
mComputationNumber = 0; mComputationNumber = 0;
std::set<std::shared_ptr<Node>> producers; std::set<std::shared_ptr<Node>> producers;
...@@ -180,35 +185,20 @@ void Aidge::SequentialScheduler::forward(bool forwardDims, bool verbose) { ...@@ -180,35 +185,20 @@ void Aidge::SequentialScheduler::forward(bool forwardDims, bool verbose) {
mScheduling.clear(); mScheduling.clear();
this->generateScheduling(); this->generateScheduling();
int cpt = 0;
// TODO: For loop on the list of node to run
// run sequencially every runnable consumers once
// TODO: handle memory allocation in scheduler
// TODO: optimize memory usage
for (const auto& runnable : mStaticSchedule) { for (const auto& runnable : mStaticSchedule) {
bool computationOverForConsumer = true;
for (IOIndex_t parentIDi = 0; parentIDi < runnable->nbInputs(); ++parentIDi) {
if (runnable->getOperator()->getNbConsumedData(parentIDi) <
runnable->getOperator()->getNbRequiredData(parentIDi)) {
computationOverForConsumer = false;
break;
}
}
if (computationOverForConsumer) {
computationOver.insert(runnable);
}
if (verbose) if (verbose)
printf("run: %s\n", printf("run: %s\n",
(runnable->type() + "_" + std::to_string(reinterpret_cast<uintptr_t>(runnable.get()))).c_str()); (runnable->type() + "_" + std::to_string(reinterpret_cast<uintptr_t>(runnable.get()))).c_str());
else else
drawProgressBar(static_cast<float>(computationOver.size()) / static_cast<float>(mComputationNumber), 50, drawProgressBar(static_cast<float>(cpt) / static_cast<float>(mStaticSchedule.size()), 50,
(std::string("running ") + runnable->type() + "_" + (std::string("running ") + runnable->type() + "_" +
std::to_string(reinterpret_cast<uintptr_t>(runnable.get())))); std::to_string(reinterpret_cast<uintptr_t>(runnable.get()))));
const auto tStart = std::chrono::high_resolution_clock::now(); const auto tStart = std::chrono::high_resolution_clock::now();
runnable->forward(); runnable->forward();
const auto tEnd = std::chrono::high_resolution_clock::now(); const auto tEnd = std::chrono::high_resolution_clock::now();
mScheduling.push_back(SchedulingElement(runnable, tStart, tEnd)); mScheduling.push_back(SchedulingElement(runnable, tStart, tEnd));
cpt++;
} }
if (!verbose) drawProgressBar(1.0, 50, " "); if (!verbose) drawProgressBar(1.0, 50, " ");
printf("\n"); printf("\n");
......
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