Search in sources :

Example 11 with FakeProfile

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile in project compss by bsc-wdc.

the class OptimizationTest method testNoDataDependencies.

// @Test
@SuppressWarnings("unchecked")
public void testNoDataDependencies() throws BlockedActionException, UnassignedActionException, InvalidSchedulingException, InterruptedException {
    // Build graph
    /*
         * 1 --> 3 --> 5 -->6 --> 8 -->9 ----->11 -->12 --> 13 2 --> 4 ┘ └->7 ┘ └->10 ---| └-----┘ | |
         * ------------------------------------------------------- 14┘ 15┘
         */
    drs1.clear();
    FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
    FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
    FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, CoreManager.getCoreImplementations(0));
    FakeAllocatableAction action4 = new FakeAllocatableAction(fao, 4, 0, CoreManager.getCoreImplementations(0));
    FakeAllocatableAction action5 = new FakeAllocatableAction(fao, 5, 0, CoreManager.getCoreImplementations(1));
    FakeAllocatableAction action6 = new FakeAllocatableAction(fao, 6, 0, CoreManager.getCoreImplementations(0));
    FakeAllocatableAction action7 = new FakeAllocatableAction(fao, 7, 0, CoreManager.getCoreImplementations(2));
    FakeAllocatableAction action8 = new FakeAllocatableAction(fao, 8, 0, CoreManager.getCoreImplementations(3));
    FakeAllocatableAction action9 = new FakeAllocatableAction(fao, 9, 0, CoreManager.getCoreImplementations(0));
    FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(2));
    FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(3));
    FakeAllocatableAction action12 = new FakeAllocatableAction(fao, 12, 0, CoreManager.getCoreImplementations(0));
    FakeAllocatableAction action13 = new FakeAllocatableAction(fao, 13, 0, CoreManager.getCoreImplementations(1));
    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);
    action1.selectExecution(drs1, (FakeImplementation) action1.getImplementations()[0]);
    action1.tryToLaunch();
    action2.selectExecution(drs1, (FakeImplementation) action2.getImplementations()[0]);
    action2.tryToLaunch();
    action3.selectExecution(drs1, (FakeImplementation) action3.getImplementations()[0]);
    addSchedulingDependency(action1, action3);
    action4.selectExecution(drs1, (FakeImplementation) action4.getImplementations()[0]);
    addSchedulingDependency(action2, action4);
    action5.selectExecution(drs1, (FakeImplementation) action5.getImplementations()[0]);
    action5.addDataPredecessor(action2);
    addSchedulingDependency(action3, action5);
    addSchedulingDependency(action4, action5);
    action6.selectExecution(drs1, (FakeImplementation) action6.getImplementations()[0]);
    action6.addDataPredecessor(action2);
    addSchedulingDependency(action5, action6);
    action7.selectExecution(drs1, (FakeImplementation) action7.getImplementations()[0]);
    action7.addDataPredecessor(action2);
    addSchedulingDependency(action5, action7);
    action8.selectExecution(drs1, (FakeImplementation) action8.getImplementations()[0]);
    action8.addDataPredecessor(action5);
    addSchedulingDependency(action6, action8);
    addSchedulingDependency(action7, action8);
    action9.selectExecution(drs1, (FakeImplementation) action9.getImplementations()[0]);
    addSchedulingDependency(action8, action9);
    action9.addDataPredecessor(action5);
    action10.selectExecution(drs1, (FakeImplementation) action10.getImplementations()[0]);
    addSchedulingDependency(action8, action10);
    action11.selectExecution(drs1, (FakeImplementation) action11.getImplementations()[0]);
    addSchedulingDependency(action9, action11);
    addSchedulingDependency(action10, action11);
    action11.addDataPredecessor(action14);
    action12.selectExecution(drs1, (FakeImplementation) action12.getImplementations()[0]);
    addSchedulingDependency(action11, action12);
    action13.selectExecution(drs1, (FakeImplementation) action13.getImplementations()[0]);
    addSchedulingDependency(action11, action13);
    addSchedulingDependency(action12, action13);
    action13.addDataPredecessor(action15);
    // debugActions(action1, action2, action3, action4, action5, action6, action7, action8, action9, action10,
    // action11, action12, action13 );
    LinkedList<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>>[] actions = new LinkedList[CoreManager.getCoreCount()];
    for (int i = 0; i < actions.length; i++) {
        actions[i] = new LinkedList<>();
    }
    // 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());
    LinkedList<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> runningActions = drs1.scanActions(readyActions, selectableActions);
    HashMap<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>, Long> expectedReady = new HashMap<>();
    expectedReady.put(action11, 10_000l);
    expectedReady.put(action13, 12_000l);
    Verifiers.verifyReadyActions(new PriorityQueue<>(readyActions), expectedReady);
    AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>[] expectedSelectable = new AllocatableAction[] { action3, action4, action10, action12 };
    Verifiers.verifyPriorityActions(new PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation>(selectableActions), expectedSelectable);
    PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> donationActions = new PriorityQueue<>(1, ScheduleOptimizer.getDonationComparator());
    drs1.rescheduleTasks(System.currentTimeMillis(), readyActions, selectableActions, runningActions, donationActions);
/*
         * drs.seekGaps(System.currentTimeMillis(), gaps, actions);
         * 
         * long[][][] times = { new long[][]{//CORE 0 new long[]{0, CORE0}, //1 new long[]{0, CORE0}, //2 new
         * long[]{CORE0, 2 * CORE0}, //3 new long[]{CORE0, 2 * CORE0}, //4 new long[]{2 * CORE0 + CORE1, 3 * CORE0 +
         * CORE1}, //6 new long[]{3 * CORE0 + CORE1 + CORE3, 4 * CORE0 + CORE1 + CORE3}, //9 new long[]{10_000 + CORE3,
         * 10_000 + CORE3 + CORE0}, //12 }, new long[][]{//CORE 1 new long[]{2 * CORE0, 2 * CORE0 + CORE1}, //5 new
         * long[]{12_000, 12_000 + CORE1}, //13 }, new long[][]{//CORE 2 new long[]{2 * CORE0 + CORE1, 2 * CORE0 + CORE1
         * + CORE2}, //7 new long[]{3 * CORE0 + CORE1 + CORE3, 3 * CORE0 + CORE1 + CORE2 + CORE3}, //10 }, new
         * long[][]{//CORE 3 new long[]{3 * CORE0 + CORE1, 3 * CORE0 + CORE1 + CORE3}, //8 new long[]{10_000, 10_000 +
         * CORE3}, //11 },}; Verifiers.verifyUpdate(actions, times);
         * 
         * Gap[] expectedGaps = { new Gap(2 * CORE0, 3 * CORE0 + CORE1, action3, new FakeResourceDescription(1), 0), new
         * Gap(2 * CORE0 + CORE1 + CORE2, 3 * CORE0 + CORE1, action7, new FakeResourceDescription(1), 0), new Gap(3 *
         * CORE0 + CORE1 + CORE3, 10_000, action8, new FakeResourceDescription(1), 0), new Gap(3 * CORE0 + CORE1 + CORE2
         * + CORE3, 10_000, action10, new FakeResourceDescription(1), 0), new Gap(4 * CORE0 + CORE1 + CORE3, 10_000,
         * action9, new FakeResourceDescription(2), 0), new Gap(10_000 + CORE3 + CORE0, 12_000, action12, new
         * FakeResourceDescription(2), 0), new Gap(10_000 + CORE3, 12_000, action11, new FakeResourceDescription(1), 0),
         * new Gap(10_000 + CORE3, Long.MAX_VALUE, action11, new FakeResourceDescription(1), 0), new Gap(12_000 + CORE1,
         * Long.MAX_VALUE, action13, new FakeResourceDescription(3), 0),}; Verifiers.verifyGaps(gaps, expectedGaps);
         */
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) HashMap(java.util.HashMap) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) AllocatableAction(es.bsc.es.bsc.compss.scheduler.types.AllocatableAction) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) PriorityQueue(java.util.PriorityQueue) PriorityActionSet(es.bsc.es.bsc.compss.scheduler.types.PriorityActionSet) LinkedList(java.util.LinkedList) FullGraphSchedulingInformation(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction)

Example 12 with FakeProfile

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile in project compss by bsc-wdc.

the class PriorityActionSetTest method testInitialScheduling.

@SuppressWarnings("unchecked")
@Test
public void testInitialScheduling() throws BlockedActionException, UnassignedActionException {
    PriorityActionSet<FakeProfile, FakeResourceDescription, FakeImplementation> pas = new PriorityActionSet<>(new Comparator<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>>() {

        @Override
        public int compare(AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation> o1, AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation> o2) {
            return Long.compare(o1.getId(), o2.getId());
        }
    });
    PriorityQueue<AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>> peeks;
    FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action1.getSchedulingInfo()).setToReschedule(true);
    pas.offer(action1);
    if (action1 != pas.peek()) {
        fail(action1 + " expected to be the most prioritary action and " + pas.peek() + " was.");
    }
    FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action2.getSchedulingInfo()).setToReschedule(true);
    pas.offer(action2);
    if (action1 != pas.peek()) {
        fail(action1 + " expected to be the most prioritary action and " + pas.peek() + " was.");
    }
    FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, null);
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action3.getSchedulingInfo()).setToReschedule(true);
    pas.offer(action3);
    if (action1 != pas.peek()) {
        fail(action1 + " expected to be the most prioritary action and " + pas.peek() + " was.");
    }
    peeks = pas.peekAll();
    AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation>[] expectedPeeks = new AllocatableAction[] { action1, action3 };
    Verifiers.verifyPriorityActions(peeks, expectedPeeks);
    FakeAllocatableAction action4 = new FakeAllocatableAction(fao, 4, 0, CoreManager.getCoreImplementations(1));
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action4.getSchedulingInfo()).setToReschedule(true);
    pas.offer(action4);
    peeks = pas.peekAll();
    expectedPeeks = new AllocatableAction[] { action1, action3, action4 };
    Verifiers.verifyPriorityActions(peeks, expectedPeeks);
    AllocatableAction<FakeProfile, FakeResourceDescription, FakeImplementation> action = pas.poll();
    if (action1 != action) {
        fail(action1 + " expected to be the most prioritary action and " + action + " was.");
    }
    peeks = pas.peekAll();
    expectedPeeks = new AllocatableAction[] { action2, action3, action4 };
    Verifiers.verifyPriorityActions(peeks, expectedPeeks);
    action = pas.poll();
    if (action2 != action) {
        fail(action2 + " expected to be the most prioritary action and " + action + " was.");
    }
    peeks = pas.peekAll();
    expectedPeeks = new AllocatableAction[] { action3, action4 };
    Verifiers.verifyPriorityActions(peeks, expectedPeeks);
    action = pas.poll();
    if (action3 != action) {
        fail(action3 + " expected to be the most prioritary action and " + action + " was.");
    }
    peeks = pas.peekAll();
    expectedPeeks = new AllocatableAction[] { action4 };
    Verifiers.verifyPriorityActions(peeks, expectedPeeks);
    action = pas.poll();
    if (action4 != action) {
        fail(action4 + " expected to be the most prioritary action and " + action + " was.");
    }
    peeks = pas.peekAll();
    expectedPeeks = new AllocatableAction[] {};
    Verifiers.verifyPriorityActions(peeks, expectedPeeks);
    FakeAllocatableAction action5 = new FakeAllocatableAction(fao, 5, 0, CoreManager.getCoreImplementations(1));
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action5.getSchedulingInfo()).setToReschedule(true);
    FakeAllocatableAction action6 = new FakeAllocatableAction(fao, 6, 0, CoreManager.getCoreImplementations(1));
    ((FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action6.getSchedulingInfo()).setToReschedule(true);
    pas.offer(action6);
    action = pas.peek();
    if (action6 != action) {
        fail(action6 + " expected to be the most prioritary action and " + action + " was.");
    }
    pas.offer(action5);
    action = pas.peek();
    if (action5 != action) {
        fail(action5 + " expected to be the most prioritary action and " + action + " was.");
    }
}
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) AllocatableAction(es.bsc.es.bsc.compss.scheduler.types.AllocatableAction) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) PriorityActionSet(es.bsc.es.bsc.compss.scheduler.types.PriorityActionSet) FullGraphSchedulingInformation(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) Test(org.junit.Test)

Example 13 with FakeProfile

use of es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile in project compss by bsc-wdc.

the class ScoresTest 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("task");
    System.setProperty(ITConstants.IT_TRACING, "0");
    System.setProperty(ITConstants.IT_EXTRAE_CONFIG_FILE, "");
    Comm.init();
    ds = new FullGraphScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>();
    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(4));
    FakeImplementation impl41 = new FakeImplementation(4, 1, new FakeResourceDescription(2));
    List<Implementation<?>> impls4 = new LinkedList<>();
    impls4.add(impl40);
    impls4.add(impl41);
    List<String> signatures4 = new LinkedList<>();
    signatures4.add("fakeSignature40");
    signatures4.add("fakeSignature41");
    CoreManager.registerNewImplementations(4, impls4, signatures4);
    int maxSlots = 4;
    FakeResourceDescription frd = new FakeResourceDescription(maxSlots);
    FakeWorker fw = new FakeWorker("worker1", frd, maxSlots);
    drs1 = new FakeResourceScheduler(fw, fao, 0);
    FakeResourceDescription frd2 = new FakeResourceDescription(maxSlots);
    FakeWorker fw2 = new FakeWorker("worker2", frd2, maxSlots);
    drs2 = new FakeResourceScheduler(fw2, fao, 0);
    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(impl41, new FakeProfile(30));
    CORE0 = drs1.getProfile(impl00).getAverageExecutionTime();
    CORE2 = drs1.getProfile(impl20).getAverageExecutionTime();
    CORE4_0 = drs1.getProfile(impl40).getAverageExecutionTime();
    CORE4_1 = drs1.getProfile(impl41).getAverageExecutionTime();
// debugConfiguration();
}
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) FakeResourceScheduler(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceScheduler) Implementation(es.bsc.compss.types.implementations.Implementation) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) LinkedList(java.util.LinkedList) FakeWorker(es.bsc.es.bsc.compss.scheduler.types.fake.FakeWorker) BeforeClass(org.junit.BeforeClass)

Aggregations

FakeImplementation (es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation)13 FakeProfile (es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile)13 FakeResourceDescription (es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription)13 FakeAllocatableAction (es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction)9 FullGraphSchedulingInformation (es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation)7 LinkedList (java.util.LinkedList)7 AllocatableAction (es.bsc.es.bsc.compss.scheduler.types.AllocatableAction)5 PriorityActionSet (es.bsc.es.bsc.compss.scheduler.types.PriorityActionSet)5 Test (org.junit.Test)5 BlockedActionException (es.bsc.es.bsc.compss.scheduler.exceptions.BlockedActionException)4 InvalidSchedulingException (es.bsc.es.bsc.compss.scheduler.exceptions.InvalidSchedulingException)4 UnassignedActionException (es.bsc.es.bsc.compss.scheduler.exceptions.UnassignedActionException)4 FakeResourceScheduler (es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceScheduler)4 FakeWorker (es.bsc.es.bsc.compss.scheduler.types.fake.FakeWorker)4 PriorityQueue (java.util.PriorityQueue)4 Implementation (es.bsc.compss.types.implementations.Implementation)3 FullGraphScore (es.bsc.es.bsc.compss.scheduler.types.FullGraphScore)3 HashMap (java.util.HashMap)3 BeforeClass (org.junit.BeforeClass)3 TaskDescription (es.bsc.compss.types.TaskDescription)2