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();
}
}
}
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;
}
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();
}
}
}
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);
}
}
}
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);
}
Aggregations