use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.
the class LocalOptimizationState method releaseDataSuccessors.
public void releaseDataSuccessors(MOSchedulingInformation dsi, long timeLimit) {
List<AllocatableAction> successors = dsi.getOptimizingSuccessors();
for (AllocatableAction successor : successors) {
MOSchedulingInformation successorDSI = (MOSchedulingInformation) successor.getSchedulingInfo();
int missingParams = 0;
long startTime = 0;
boolean retry = true;
while (retry) {
try {
List<AllocatableAction> predecessors = successor.getDataPredecessors();
for (AllocatableAction predecessor : predecessors) {
MOSchedulingInformation predDSI = ((MOSchedulingInformation) predecessor.getSchedulingInfo());
if (predecessor.getAssignedResource() != worker) {
startTime = Math.max(startTime, predDSI.getExpectedEnd());
} else if (predDSI.isOnOptimization()) {
missingParams++;
} else {
startTime = Math.max(startTime, predDSI.getExpectedEnd());
}
}
retry = false;
} catch (ConcurrentModificationException cme) {
missingParams = 0;
startTime = 0;
}
}
successorDSI.setExpectedStart(startTime);
if (missingParams == 0) {
if (successorDSI.getExpectedStart() <= timeLimit) {
selectableActions.offer(successor);
} else {
readyActions.add(successor);
}
}
}
dsi.clearOptimizingSuccessors();
}
use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.
the class PriorityActionSet method poll.
public AllocatableAction poll() {
AllocatableAction currentPeek;
while ((currentPeek = priority.poll()) != null) {
Integer coreId = currentPeek.getCoreId();
AllocatableAction nextPeek;
if (coreId == null) {
noCoreActions.poll();
nextPeek = noCoreActions.peek();
} else {
coreActions[coreId].poll();
nextPeek = coreActions[coreId].peek();
}
if (nextPeek != null) {
priority.offer(nextPeek);
}
MOSchedulingInformation dsi = (MOSchedulingInformation) currentPeek.getSchedulingInfo();
if (dsi.isToReschedule()) {
break;
}
}
return currentPeek;
}
use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.
the class PriorityActionSet method peek.
public AllocatableAction peek() {
AllocatableAction currentPeek = priority.peek();
while (currentPeek != null && !((MOSchedulingInformation) currentPeek.getSchedulingInfo()).isToReschedule()) {
removeFirst(currentPeek.getCoreId());
currentPeek = priority.peek();
}
return currentPeek;
}
use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.
the class PriorityActionSet method peekAll.
public PriorityQueue<AllocatableAction> peekAll() {
PriorityQueue<AllocatableAction> peeks = new PriorityQueue<AllocatableAction>(coreActions.length + 1, comparator);
AllocatableAction currentCore = noCoreActions.peek();
if (currentCore != null && !((MOSchedulingInformation) currentCore.getSchedulingInfo()).isToReschedule()) {
noCoreActions.poll();
currentCore = noCoreActions.peek();
}
if (currentCore != null) {
peeks.offer(currentCore);
}
for (PriorityQueue<AllocatableAction> core : coreActions) {
currentCore = core.peek();
if (currentCore != null && !((MOSchedulingInformation) currentCore.getSchedulingInfo()).isToReschedule()) {
core.poll();
currentCore = core.peek();
}
if (currentCore != null) {
peeks.offer(currentCore);
}
}
return peeks;
}
use of es.bsc.compss.scheduler.types.AllocatableAction in project compss by bsc-wdc.
the class ActionSet method removeAllActions.
public List<AllocatableAction> removeAllActions() {
List<AllocatableAction> runnable = new LinkedList<>();
Iterator<AllocatableAction> actions = this.noCore.iterator();
while (actions.hasNext()) {
AllocatableAction action = actions.next();
actions.remove();
runnable.add(action);
}
for (int core = 0; core < this.coreIndexed.length; ++core) {
runnable.addAll(coreIndexed[core]);
this.coreIndexed[core] = new LinkedList<>();
this.counts[core] = 0;
}
totalActions = 0;
return runnable;
}
Aggregations