Search in sources :

Example 1 with OptimizationWorker

use of es.bsc.es.bsc.compss.scheduler.types.OptimizationWorker 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);
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) FakeWorker(es.bsc.es.bsc.compss.scheduler.types.fake.FakeWorker) LinkedList(java.util.LinkedList) OptimizationWorker(es.bsc.es.bsc.compss.scheduler.types.OptimizationWorker) ScheduleOptimizer(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.ScheduleOptimizer) FakeResourceScheduler(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceScheduler)

Aggregations

ScheduleOptimizer (es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.ScheduleOptimizer)1 OptimizationWorker (es.bsc.es.bsc.compss.scheduler.types.OptimizationWorker)1 FakeImplementation (es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation)1 FakeProfile (es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile)1 FakeResourceDescription (es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription)1 FakeResourceScheduler (es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceScheduler)1 FakeWorker (es.bsc.es.bsc.compss.scheduler.types.fake.FakeWorker)1 LinkedList (java.util.LinkedList)1