use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation in project compss by bsc-wdc.
the class ScoresTest method testActionScores.
@SuppressWarnings("unchecked")
@Test
public void testActionScores() throws BlockedActionException, UnassignedActionException {
drs1.clear();
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 1, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action14 = new FakeAllocatableAction(fao, 14, 0, CoreManager.getCoreImplementations(0));
action14.selectExecution(drs2, (FakeImplementation) action14.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi14 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action14.getSchedulingInfo();
dsi14.setExpectedEnd(10_000);
FakeAllocatableAction action15 = new FakeAllocatableAction(fao, 15, 0, CoreManager.getCoreImplementations(0));
action15.selectExecution(drs2, (FakeImplementation) action15.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi15 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action15.getSchedulingInfo();
dsi15.setExpectedEnd(12_000);
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Score score2 = ds.generateActionScore(action2);
Verifiers.verifyScore(score1, 1, 0, 0, 0, 0);
Verifiers.verifyScore((FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) score2, 0, 0, 0, 0, 0);
Verifiers.validateBetterScore(score1, score2, true);
action1.addDataPredecessor(action14);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 1, 10_000, 0, 0, 10_000);
action1.addDataPredecessor(action15);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 1, 12_000, 0, 0, 12_000);
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation in project compss by bsc-wdc.
the class InitialSchedulingTest method setUpClass.
@BeforeClass
public static void setUpClass() {
CoreManager.clear();
CoreManager.registerNewCoreElement("fakeSignature00");
CoreManager.registerNewCoreElement("fakeSignature10");
CoreManager.registerNewCoreElement("fakeSignature20");
FakeImplementation impl00 = new FakeImplementation(0, 0, new FakeResourceDescription(2));
List<Implementation<?>> impls0 = new LinkedList<>();
impls0.add(impl00);
List<String> signatures0 = new LinkedList<>();
signatures0.add("fakeSignature00");
CoreManager.registerNewImplementations(0, impls0, signatures0);
FakeImplementation impl10 = new FakeImplementation(1, 0, new FakeResourceDescription(3));
List<Implementation<?>> impls1 = new LinkedList<>();
impls1.add(impl10);
List<String> signatures1 = new LinkedList<>();
signatures1.add("fakeSignature10");
CoreManager.registerNewImplementations(1, impls1, signatures1);
FakeImplementation impl20 = new FakeImplementation(2, 0, new FakeResourceDescription(1));
List<Implementation<?>> impls2 = new LinkedList<>();
impls2.add(impl20);
List<String> signatures2 = new LinkedList<>();
signatures2.add("fakeSignature20");
CoreManager.registerNewImplementations(2, impls2, signatures2);
int maxSlots = 4;
FakeResourceDescription frd = new FakeResourceDescription(maxSlots);
FakeWorker fw = new FakeWorker("worker1", frd, maxSlots);
drs = new FakeResourceScheduler(fw, fao, 0);
drs.profiledExecution(impl00, new FakeProfile(50));
drs.profiledExecution(impl10, new FakeProfile(50));
drs.profiledExecution(impl20, new FakeProfile(30));
CORE0 = drs.getProfile(impl00).getAverageExecutionTime();
CORE1 = drs.getProfile(impl10).getAverageExecutionTime();
CORE2 = drs.getProfile(impl20).getAverageExecutionTime();
// debugConfiguration();
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation in project compss by bsc-wdc.
the class OptimizationTest method setUpClass.
@BeforeClass
public static void setUpClass() {
CoreManager.clear();
CoreManager.registerNewCoreElement("fakeSignature00");
CoreManager.registerNewCoreElement("fakeSignature10");
CoreManager.registerNewCoreElement("fakeSignature20");
CoreManager.registerNewCoreElement("fakeSignature30");
CoreManager.registerNewCoreElement("fakeSignature40");
CoreManager.registerNewCoreElement("fakeSignature50");
CoreManager.registerNewCoreElement("fakeSignature60");
CoreManager.registerNewCoreElement("fakeSignature70");
FakeImplementation impl00 = new FakeImplementation(0, 0, new FakeResourceDescription(2));
List<Implementation<?>> impls0 = new LinkedList<>();
impls0.add(impl00);
List<String> signatures0 = new LinkedList<>();
signatures0.add("fakeSignature00");
CoreManager.registerNewImplementations(0, impls0, signatures0);
FakeImplementation impl10 = new FakeImplementation(1, 0, new FakeResourceDescription(3));
List<Implementation<?>> impls1 = new LinkedList<>();
impls1.add(impl10);
List<String> signatures1 = new LinkedList<>();
signatures1.add("fakeSignature10");
CoreManager.registerNewImplementations(1, impls1, signatures1);
FakeImplementation impl20 = new FakeImplementation(2, 0, new FakeResourceDescription(1));
List<Implementation<?>> impls2 = new LinkedList<>();
impls2.add(impl20);
List<String> signatures2 = new LinkedList<>();
signatures2.add("fakeSignature20");
CoreManager.registerNewImplementations(2, impls2, signatures2);
FakeImplementation impl30 = new FakeImplementation(3, 0, new FakeResourceDescription(4));
List<Implementation<?>> impls3 = new LinkedList<>();
impls3.add(impl30);
List<String> signatures3 = new LinkedList<>();
signatures3.add("fakeSignature30");
CoreManager.registerNewImplementations(3, impls3, signatures3);
FakeImplementation impl40 = new FakeImplementation(4, 0, new FakeResourceDescription(2));
List<Implementation<?>> impls4 = new LinkedList<>();
impls4.add(impl40);
List<String> signatures4 = new LinkedList<>();
signatures4.add("fakeSignature40");
CoreManager.registerNewImplementations(4, impls4, signatures4);
FakeImplementation impl50 = new FakeImplementation(5, 0, new FakeResourceDescription(1));
List<Implementation<?>> impls5 = new LinkedList<>();
impls5.add(impl50);
List<String> signatures5 = new LinkedList<>();
signatures5.add("fakeSignature50");
CoreManager.registerNewImplementations(5, impls5, signatures5);
FakeImplementation impl60 = new FakeImplementation(6, 0, new FakeResourceDescription(3));
List<Implementation<?>> impls6 = new LinkedList<>();
impls6.add(impl60);
List<String> signatures6 = new LinkedList<>();
signatures6.add("fakeSignature60");
CoreManager.registerNewImplementations(6, impls6, signatures6);
int maxSlots = 4;
FakeResourceDescription frd = new FakeResourceDescription(maxSlots);
FakeWorker fw = new FakeWorker("worker1", frd, maxSlots);
drs1 = new FullGraphResourceScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>(fw, fao);
FakeResourceDescription frd2 = new FakeResourceDescription(maxSlots);
FakeWorker fw2 = new FakeWorker("worker2", frd2, maxSlots);
drs2 = new FullGraphResourceScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>(fw2, fao);
drs1.profiledExecution(impl00, new FakeProfile(50));
drs1.profiledExecution(impl10, new FakeProfile(50));
drs1.profiledExecution(impl20, new FakeProfile(30));
drs1.profiledExecution(impl30, new FakeProfile(50));
drs1.profiledExecution(impl40, new FakeProfile(20));
drs1.profiledExecution(impl50, new FakeProfile(10));
drs1.profiledExecution(impl60, new FakeProfile(30));
drs2.profiledExecution(impl00, new FakeProfile(50));
drs2.profiledExecution(impl10, new FakeProfile(50));
drs2.profiledExecution(impl20, new FakeProfile(30));
// Faster than drs
drs2.profiledExecution(impl30, new FakeProfile(30));
drs2.profiledExecution(impl40, new FakeProfile(15));
drs2.profiledExecution(impl50, new FakeProfile(10));
drs2.profiledExecution(impl60, new FakeProfile(15));
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation 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);
}
use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation in project compss by bsc-wdc.
the class OptimizationTest method testScan.
// @Test
@SuppressWarnings("unchecked")
public void testScan() {
FakeAllocatableAction external10 = new FakeAllocatableAction(fao, 13, 0, CoreManager.getCoreImplementations(4));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external10.getSchedulingInfo()).setExpectedEnd(10);
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external10.getSchedulingInfo()).scheduled();
external10.selectExecution(drs2, (FakeImplementation) external10.getImplementations()[0]);
FakeAllocatableAction external20 = new FakeAllocatableAction(fao, 14, 0, CoreManager.getCoreImplementations(4));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external20.getSchedulingInfo()).setExpectedEnd(20);
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external20.getSchedulingInfo()).scheduled();
external20.selectExecution(drs2, (FakeImplementation) external20.getImplementations()[0]);
FakeAllocatableAction external90 = new FakeAllocatableAction(fao, 15, 0, CoreManager.getCoreImplementations(4));
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external90.getSchedulingInfo()).setExpectedEnd(90);
((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) external90.getSchedulingInfo()).scheduled();
external90.selectExecution(drs2, (FakeImplementation) external90.getImplementations()[0]);
drs1.clear();
drs2.clear();
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.addDataPredecessor(external90);
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);
FakeAllocatableAction action7 = new FakeAllocatableAction(fao, 7, 0, CoreManager.getCoreImplementations(5));
action7.addDataPredecessor(external10);
action7.selectExecution(drs1, (FakeImplementation) action7.getImplementations()[0]);
drs1.scheduleAction(action7);
FakeAllocatableAction action8 = new FakeAllocatableAction(fao, 8, 0, CoreManager.getCoreImplementations(5));
action8.addDataPredecessor(external20);
action8.selectExecution(drs1, (FakeImplementation) action8.getImplementations()[0]);
drs1.scheduleAction(action8);
FakeAllocatableAction action9 = new FakeAllocatableAction(fao, 9, 0, CoreManager.getCoreImplementations(4));
action9.addDataPredecessor(external90);
action9.selectExecution(drs1, (FakeImplementation) action9.getImplementations()[0]);
drs1.scheduleAction(action9);
FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(4));
action10.addDataPredecessor(action5);
action10.selectExecution(drs1, (FakeImplementation) action10.getImplementations()[0]);
drs1.scheduleAction(action10);
FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(4));
action11.addDataPredecessor(action6);
action11.selectExecution(drs1, (FakeImplementation) action11.getImplementations()[0]);
drs1.scheduleAction(action11);
FakeAllocatableAction action12 = new FakeAllocatableAction(fao, 12, 0, CoreManager.getCoreImplementations(4));
action12.addDataPredecessor(action5);
action12.addDataPredecessor(action6);
action12.selectExecution(drs1, (FakeImplementation) action12.getImplementations()[0]);
drs1.scheduleAction(action12);
// Actions not depending on other actions scheduled on the same resource
// Sorted by data dependencies release
PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> readyActions = new PriorityQueue<>(1, FullGraphResourceScheduler.getReadyComparator());
// Actions that can be selected to be scheduled on the node
// Sorted by data dependencies release
PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation> selectableActions = new PriorityActionSet<>(FullGraphResourceScheduler.getScanComparator());
drs1.scanActions(readyActions, selectableActions);
HashMap<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>, Long> expectedReady = new HashMap<>();
expectedReady.put(action7, 10l);
expectedReady.put(action8, 20l);
expectedReady.put(action9, 90l);
expectedReady.put(action3, 90l);
Verifiers.verifyReadyActions(new PriorityQueue<>(readyActions), expectedReady);
AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>[] expectedSelectable = new AllocatableAction[] { action5, action6, action4 };
Verifiers.verifyPriorityActions(new PriorityActionSet<>(selectableActions), expectedSelectable);
}
Aggregations