Commit 783f603d authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

Online algorithm ERLS

parent 97a82b26
......@@ -5,6 +5,7 @@
#include <TrueHeteroPrio.h>
#include <OnlineQA.h>
#include <OnlineECT.h>
#include <OnlineERLS.h>
#include "algorithm.h"
#include "listAlgorithm.h"
......@@ -301,6 +302,8 @@ Algorithm* createAlg(const string& name, const AlgOptions& options) {
alg = new OnlineQA(options);
if(name == "ect")
alg = new OnlineECT(options);
if(name == "erls")
alg = new OnlineERLS(options);
#ifdef WITH_CPLEX
if(name == "lp")
alg = new SchedLPIndep(options);
......
//
// Created by eyraud on 31/08/18.
//
#ifndef PMTOOL_ONLINEERLS_H
#define PMTOOL_ONLINEERLS_H
#include "OnlineGeneric.h"
class OnlineERLS : public OnlineGeneric {
public:
double compute(Instance &instance, SchedAction *action) override;
OnlineERLS(const AlgOptions &options);
int assignTask(int task, double now) override;
protected:
int largestGroup;
double threshold;
};
#endif //PMTOOL_ONLINEERLS_H
......@@ -15,7 +15,7 @@ set(SCHED_SRC
availSequence.cpp
GreedyAlgorithm.cpp
HeftAlgorithm.cpp
OnlineZhang.cpp ../include/OnlineZhang.h GreedyPerType.cpp ../include/GreedyPerType.h TrueHeteroPrio.cpp ../include/TrueHeteroPrio.h OnlineGeneric.cpp ../include/OnlineGeneric.h OnlineQA.cpp ../include/OnlineQA.h OnlineECT.cpp ../include/OnlineECT.h)
OnlineZhang.cpp ../include/OnlineZhang.h GreedyPerType.cpp ../include/GreedyPerType.h TrueHeteroPrio.cpp ../include/TrueHeteroPrio.h OnlineGeneric.cpp ../include/OnlineGeneric.h OnlineQA.cpp ../include/OnlineQA.h OnlineECT.cpp ../include/OnlineECT.h OnlineERLS.cpp ../include/OnlineERLS.h)
if(CPLEX_FOUND)
set(SCHED_SRC ${SCHED_SRC} SchedLPIndep.cpp ../include/SchedLPIndep.h AreaRound.cpp ../include/AreaRound.h)
......
//
// Created by eyraud on 31/08/18.
//
#include <cmath>
#include "OnlineERLS.h"
int OnlineERLS::assignTask(int task, double now) {
// In ER-LS algorithm definition, we call GPUs the machine type with the less processors
int gpuWorker = getEarliestWorker(1 - largestGroup);
double gpuReadyTime = finishTimes[gpuWorker];
double gpuComputeTime = ins->execType(1 - largestGroup, task);
double cpuComputeTime = ins->execType(largestGroup, task);
if (cpuComputeTime >= gpuReadyTime + gpuComputeTime)
return gpuWorker;
if (cpuComputeTime / gpuComputeTime <= threshold)
return getEarliestWorker(largestGroup);
else
return gpuWorker;
}
double OnlineERLS::compute(Instance &instance, SchedAction *action) {
largestGroup = instance.nbWorkers[0] > instance.nbWorkers[1] ? 0 : 1;
threshold = sqrt(instance.nbWorkers[largestGroup] / instance.nbWorkers[1-largestGroup]);
return OnlineGeneric::compute(instance, action);
}
OnlineERLS::OnlineERLS(const AlgOptions &options) : OnlineGeneric(options) {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment