Commit 5ad8ea5e authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

IndepAccel: more comments in code

parent fb58125b
......@@ -30,6 +30,10 @@ bool IndepAccel::tryGuess(Instance& ins, std::vector<int> taskSet, double target
if(verbosity >= 6)
cout << "IndepAccel, target = " << target << endl;
// Sets G* go on GPU, sets Cµ* go on CPU
// Sets "1" contain long tasks than may disturb the schedule, we
// should have at most m (or k) of them
// Sets "2" are the short ones
vector<int> setG1, setG2, setC1, setC2;
for(auto t: taskSet) {
if(ins.execType(IA_CPU, t) <= target)
......@@ -43,6 +47,9 @@ bool IndepAccel::tryGuess(Instance& ins, std::vector<int> taskSet, double target
(cpuTime(ins, b) - gpuTime(ins, b)) );
};
sort(setC2.begin(), setC2.end(), surfaceCmp);
// Tasks with CPU time > target can not go on CPU, they go at the end of G1,
/// and are sorted by decreasing GPU time. Line 131 is where we forbid them to move
sort(setG1.begin(), setG1.end(), [&] (int a, int b) {
if(cpuTime(ins, a) > target) {
......@@ -60,6 +67,8 @@ bool IndepAccel::tryGuess(Instance& ins, std::vector<int> taskSet, double target
if(verbosity >= 7)
cout << "IndepAccel: start. C1; " << setC1 << " C2: " << setC2 << " G1: " << setG1 << " G2: " << setG2 << endl;
// Tasks in G1 with GPU time small enough go to G2: they do not disturb the schedule
// We find them at the end of G1 because of how we sorted G1.
if(!setG1.empty()) {
auto it = setG1.end() - 1;
while (gpuTime(ins, *it) < target / 2.0) {
......@@ -114,6 +123,7 @@ bool IndepAccel::tryGuess(Instance& ins, std::vector<int> taskSet, double target
iterC2++;
changed = true;
}
// Here is where we forbid tasks which were moved at the end of G1 to be reassigned
if( (((int) setC1.size()) < nbCPU) && (iterG1 != setG1.end()) && (cpuTime(ins, *iterG1) <= target) ) {
setC1.push_back(*iterG1);
GPUload -= gpuTime(ins, *iterG1);
......
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