From 34aaaad34e72c921ea72d7b023e5a5270e76dd40 Mon Sep 17 00:00:00 2001 From: Matthijs Bijman Date: Mon, 27 Feb 2017 15:19:15 +0100 Subject: Add tasks that run on 1 machine --- .../simulation/schedulers/FirstInFirstOutScheduler.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h') diff --git a/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h b/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h index 797eb489..5d277c8d 100644 --- a/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h +++ b/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h @@ -22,8 +22,10 @@ namespace Simulation // Find the first workload with dependencies finished int index = 0; - while(!workloads.at(index)->dependencyFinished) - index = (++index) % workloads.size(); + + std::remove_if(workloads.begin(), workloads.end(), [](Workload* workload) { + return !workload->dependencyFinished; + }); // Reset the number of cores used for each workload for (auto workload : workloads) @@ -38,6 +40,19 @@ namespace Simulation workloads.at(index)->setCoresUsed( workloads.at(index)->getCoresUsed() + machine.get().getNumberOfCores() ); + + if (!workloads.at(index)->isParallelizable()) + { + workloads.erase(workloads.begin() + index); + if (workloads.size() == 0) + break; + + index %= workloads.size(); + } + else + { + index = (++index) % workloads.size(); + } } } }; -- cgit v1.2.3