Search in sources :

Example 11 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction 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 12 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction 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 13 with AllocatableAction

use of es.bsc.compss.scheduler.types.AllocatableAction 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)

Example 14 with AllocatableAction

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

the class PriorityActionSet method rebuildPriorityQueue.

private void rebuildPriorityQueue() {
    priority.clear();
    AllocatableAction action = noCoreActions.peek();
    if (action != null) {
        priority.offer(action);
    }
    for (PriorityQueue<AllocatableAction> coreAction : coreActions) {
        action = coreAction.peek();
        if (action != null) {
            priority.offer(action);
        }
    }
}
Also used : AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction)

Example 15 with AllocatableAction

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

the class FIFODataScheduler method purgeFreeActions.

/*
     * *********************************************************************************************************
     * *********************************************************************************************************
     * ********************************* SCHEDULING OPERATIONS *************************************************
     * *********************************************************************************************************
     * *********************************************************************************************************
     */
@Override
public <T extends WorkerResourceDescription> void purgeFreeActions(List<AllocatableAction> dataFreeActions, List<AllocatableAction> resourceFreeActions, List<AllocatableAction> blockedCandidates, ResourceScheduler<T> resource) {
    LOGGER.debug("[DataScheduler] Treating dependency free actions");
    PriorityQueue<ObjectValue<AllocatableAction>> executableActions = new PriorityQueue<>();
    for (AllocatableAction action : dataFreeActions) {
        Score actionScore = this.generateActionScore(action);
        Score fullScore = action.schedulingScore(resource, actionScore);
        ObjectValue<AllocatableAction> obj = new ObjectValue<>(action, fullScore);
        executableActions.add(obj);
    }
    dataFreeActions.clear();
    while (!executableActions.isEmpty()) {
        ObjectValue<AllocatableAction> obj = executableActions.poll();
        AllocatableAction freeAction = obj.getObject();
        try {
            scheduleAction(freeAction, resource, obj.getScore());
            tryToLaunch(freeAction);
        } catch (BlockedActionException e) {
            removeFromReady(freeAction);
            addToBlocked(freeAction);
        } catch (UnassignedActionException e) {
            dataFreeActions.add(freeAction);
        }
    }
    List<AllocatableAction> unassignedReadyActions = this.unassignedReadyActions.getAllActions();
    this.unassignedReadyActions.removeAllActions();
    dataFreeActions.addAll(unassignedReadyActions);
}
Also used : Score(es.bsc.compss.scheduler.types.Score) ObjectValue(es.bsc.compss.scheduler.types.ObjectValue) UnassignedActionException(es.bsc.compss.scheduler.exceptions.UnassignedActionException) BlockedActionException(es.bsc.compss.scheduler.exceptions.BlockedActionException) AllocatableAction(es.bsc.compss.scheduler.types.AllocatableAction) PriorityQueue(java.util.PriorityQueue)

Aggregations

AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)43 LinkedList (java.util.LinkedList)13 MOSchedulingInformation (es.bsc.compss.scheduler.multiobjective.MOSchedulingInformation)11 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)10 PriorityQueue (java.util.PriorityQueue)10 Gap (es.bsc.compss.scheduler.multiobjective.types.Gap)9 Score (es.bsc.compss.scheduler.types.Score)7 BlockedActionException (es.bsc.compss.scheduler.exceptions.BlockedActionException)6 Implementation (es.bsc.compss.types.implementations.Implementation)6 ResourceDescription (es.bsc.compss.types.resources.ResourceDescription)6 ActionNotFoundException (es.bsc.compss.scheduler.exceptions.ActionNotFoundException)5 ConcurrentModificationException (java.util.ConcurrentModificationException)5 ObjectValue (es.bsc.compss.scheduler.types.ObjectValue)4 MOProfile (es.bsc.compss.scheduler.multiobjective.types.MOProfile)3 HashSet (java.util.HashSet)3 FailedActionException (es.bsc.compss.scheduler.exceptions.FailedActionException)2 UnassignedActionException (es.bsc.compss.scheduler.exceptions.UnassignedActionException)2 MOScore (es.bsc.compss.scheduler.multiobjective.types.MOScore)2 OptimizationAction (es.bsc.compss.scheduler.multiobjective.types.OptimizationAction)2 Profile (es.bsc.compss.scheduler.types.Profile)2