Search in sources :

Example 1 with MOSchedulingInformation

use of es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation in project compss by bsc-wdc.

the class LocalOptimizationState method checkGapForReserve.

private boolean checkGapForReserve(Gap g, ResourceDescription requirements, long reserveStart, List<Gap> previousGaps) {
    boolean remove = false;
    AllocatableAction gapAction = g.getOrigin();
    ResourceDescription rd = g.getResources();
    ResourceDescription reduction = ResourceDescription.reduceCommonDynamics(rd, requirements);
    if (!reduction.isDynamicUseless()) {
        Gap tmpGap = new Gap(g.getInitialTime(), reserveStart, g.getOrigin(), reduction, 0);
        previousGaps.add(tmpGap);
        if (gapAction != null) {
            MOSchedulingInformation gapDSI = (MOSchedulingInformation) gapAction.getSchedulingInfo();
            // Remove resources from the first gap
            gapDSI.addGap();
        }
        // If the gap has been fully used
        if (rd.isDynamicUseless()) {
            // Remove the gap
            remove = true;
            if (gapAction != null) {
                MOSchedulingInformation gapDSI = (MOSchedulingInformation) gapAction.getSchedulingInfo();
                gapDSI.removeGap();
            }
        }
    }
    return remove;
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) ResourceDescription(es.bsc.compss.types.resources.ResourceDescription) WorkerResourceDescription(es.bsc.compss.types.resources.WorkerResourceDescription) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction)

Example 2 with MOSchedulingInformation

use of es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation in project compss by bsc-wdc.

the class LocalOptimizationState method removeTmpGap.

public void removeTmpGap(Gap g) {
    AllocatableAction gapAction = g.getOrigin();
    if (gapAction != null) {
        MOSchedulingInformation gapDSI = (MOSchedulingInformation) gapAction.getSchedulingInfo();
        gapDSI.removeGap();
        if (!gapDSI.hasGaps()) {
            gapDSI.unlock();
        }
    }
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction)

Example 3 with MOSchedulingInformation

use of es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation in project compss by bsc-wdc.

the class LocalOptimizationState method resourceBlockedAction.

public void resourceBlockedAction(AllocatableAction action) {
    MOSchedulingInformation aDSI = (MOSchedulingInformation) action.getSchedulingInfo();
    MOSchedulingInformation rbaDSI = (MOSchedulingInformation) resourceBlockingAction.getSchedulingInfo();
    rbaDSI.lock();
    rbaDSI.addSuccessor(action);
    Gap opActionGap = new Gap(0, 0, resourceBlockingAction, action.getAssignedImplementation().getRequirements().copy(), 0);
    aDSI.addPredecessor(opActionGap);
    rbaDSI.unlock();
    updateConsumptions(action);
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation)

Example 4 with MOSchedulingInformation

use of es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation in project compss by bsc-wdc.

the class LocalOptimizationState method pollActionForGap.

public AllocatableAction pollActionForGap(Gap gap) {
    AllocatableAction gapAction = null;
    PriorityQueue<AllocatableAction> peeks = selectableActions.peekAll();
    // Get Main action to fill the gap
    while (!peeks.isEmpty() && gapAction == null) {
        AllocatableAction candidate = peeks.poll();
        // Check times
        MOSchedulingInformation candidateDSI = (MOSchedulingInformation) candidate.getSchedulingInfo();
        long start = candidateDSI.getExpectedStart();
        if (start > gap.getEndTime()) {
            continue;
        }
        Implementation impl = candidate.getAssignedImplementation();
        Profile p = worker.getProfile(impl);
        long expectedLength = p.getAverageExecutionTime();
        if ((gap.getEndTime() - gap.getInitialTime()) < expectedLength) {
            continue;
        }
        if ((start + expectedLength) > gap.getEndTime()) {
            continue;
        }
        // Check description
        if (gap.getResources().canHostDynamic(impl)) {
            selectableActions.removeFirst(candidate.getCoreId());
            gapAction = candidate;
        }
    }
    return gapAction;
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) Implementation(es.bsc.compss.types.implementations.Implementation) Profile(es.bsc.compss.scheduler.types.Profile)

Example 5 with MOSchedulingInformation

use of es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation in project compss by bsc-wdc.

the class PriorityActionSet method offer.

@SuppressWarnings("unchecked")
public void offer(AllocatableAction action) {
    if (((MOSchedulingInformation) action.getSchedulingInfo()).isToReschedule()) {
        Integer coreId = action.getCoreId();
        AllocatableAction currentPeek = null;
        if (coreId == null) {
            currentPeek = noCoreActions.peek();
            noCoreActions.offer(action);
        } else {
            if (coreId < coreActions.length) {
                currentPeek = coreActions[coreId].peek();
            } else {
                // Resize coreActions array
                int originalSize = this.coreActions.length;
                PriorityQueue<AllocatableAction>[] coreActions = (PriorityQueue<AllocatableAction>[]) new PriorityQueue[coreId + 1];
                System.arraycopy(this.coreActions, 0, coreActions, 0, originalSize);
                for (int coreIdx = originalSize; coreIdx < coreId + 1; coreIdx++) {
                    coreActions[coreIdx] = new PriorityQueue<>(1, comparator);
                }
                this.coreActions = coreActions;
            }
            coreActions[coreId].offer(action);
        }
        if (currentPeek != action) {
            rebuildPriorityQueue();
        }
    }
}
Also used : MOSchedulingInformation(es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) PriorityQueue(java.util.PriorityQueue)

Aggregations

MOSchedulingInformation (es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation)15 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)11 Implementation (es.bsc.compss.types.implementations.Implementation)2 ResourceDescription (es.bsc.compss.types.resources.ResourceDescription)2 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)2 PriorityQueue (java.util.PriorityQueue)2 Profile (es.bsc.compss.scheduler.types.Profile)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1