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