use of es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.ScheduleOptimizer in project compss by bsc-wdc.
the class OptimizationTest method globalOptimization.
// @Test
public void globalOptimization() {
ScheduleOptimizer<FakeProfile, FakeResourceDescription, FakeImplementation> so = new ScheduleOptimizer<>(ds);
long updateId = System.currentTimeMillis();
Collection<ResourceScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>> workers = new ArrayList<>();
drs1.clear();
drs2.clear();
workers.add(drs1);
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(4));
action1.selectExecution(drs1, (FakeImplementation) action1.getImplementations()[0]);
drs1.scheduleAction(action1);
try {
action1.tryToLaunch();
} catch (Exception e) {
}
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(4));
action2.selectExecution(drs1, (FakeImplementation) action2.getImplementations()[0]);
drs1.scheduleAction(action2);
try {
action2.tryToLaunch();
} catch (Exception e) {
}
FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 1, CoreManager.getCoreImplementations(4));
action3.selectExecution(drs1, (FakeImplementation) action3.getImplementations()[0]);
drs1.scheduleAction(action3);
FakeAllocatableAction action4 = new FakeAllocatableAction(fao, 4, 0, CoreManager.getCoreImplementations(5));
action4.selectExecution(drs1, (FakeImplementation) action4.getImplementations()[0]);
drs1.scheduleAction(action4);
FakeAllocatableAction action5 = new FakeAllocatableAction(fao, 5, 1, CoreManager.getCoreImplementations(4));
action5.selectExecution(drs1, (FakeImplementation) action5.getImplementations()[0]);
drs1.scheduleAction(action5);
FakeAllocatableAction action6 = new FakeAllocatableAction(fao, 6, 1, CoreManager.getCoreImplementations(6));
action6.selectExecution(drs1, (FakeImplementation) action6.getImplementations()[0]);
drs1.scheduleAction(action6);
workers.add(drs2);
so.globalOptimization(updateId, workers);
}
use of es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.ScheduleOptimizer in project compss by bsc-wdc.
the class OptimizationTest method testDonorsAndReceivers.
// @Test
@SuppressWarnings("unchecked")
public void testDonorsAndReceivers() {
ScheduleOptimizer<FakeProfile, FakeResourceDescription, FakeImplementation> so = new ScheduleOptimizer<>(ds);
long[] expectedEndTimes = new long[] { 35000, 20000, 15000, 50000, 40000, 1000 };
OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation>[] optimizedWorkers = new OptimizationWorker[expectedEndTimes.length];
for (int idx = 0; idx < expectedEndTimes.length; idx++) {
int maxSlots = 1;
FakeResourceDescription frd = new FakeResourceDescription(maxSlots);
FakeWorker fw = new FakeWorker("worker" + idx, frd, maxSlots);
FakeResourceScheduler frs = new FakeResourceScheduler(fw, fao, expectedEndTimes[idx]);
optimizedWorkers[idx] = new OptimizationWorker<>(frs);
}
LinkedList<OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation>> receivers = new LinkedList<>();
OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation> donor = so.determineDonorAndReceivers(optimizedWorkers, receivers);
LinkedList<OptimizationWorker<FakeProfile, FakeResourceDescription, FakeImplementation>> donors = new LinkedList<>();
donors.offer(donor);
LinkedList<String> donorsNames = new LinkedList<>();
donorsNames.add("worker3");
LinkedList<String> receiversNames = new LinkedList<>();
receiversNames.add("worker5");
receiversNames.add("worker2");
receiversNames.add("worker1");
receiversNames.add("worker0");
receiversNames.add("worker4");
Verifiers.verifyWorkersPriority(donors, donorsNames);
Verifiers.verifyWorkersPriority(receivers, receiversNames);
}
Aggregations