use of es.bsc.compss.types.resources.ResourceDescription in project compss by bsc-wdc.
the class LocalOptimizationState method replaceAction.
public void replaceAction(AllocatableAction<P, T, I> action) {
this.action = action;
if (this.action != null) {
missingResources = this.action.getAssignedImplementation().getRequirements().copy();
// Check if the new peek can run in the already freed resources.
for (Gap<P, T, I> gap : gaps) {
ResourceDescription empty = gap.getResources().copy();
topStartTime = gap.getInitialTime();
ResourceDescription.reduceCommonDynamics(empty, missingResources);
if (missingResources.isDynamicUseless()) {
break;
}
}
} else {
missingResources = null;
topStartTime = 0l;
}
}
use of es.bsc.compss.types.resources.ResourceDescription in project compss by bsc-wdc.
the class LocalOptimizationState method checkGapForReserve.
private boolean checkGapForReserve(Gap<P, T, I> g, ResourceDescription requirements, long reserveStart, LinkedList<Gap<P, T, I>> previousGaps) {
boolean remove = false;
AllocatableAction<P, T, I> gapAction = g.getOrigin();
ResourceDescription rd = g.getResources();
ResourceDescription reduction = ResourceDescription.reduceCommonDynamics(rd, requirements);
Gap<P, T, I> tmpGap = new Gap<>(g.getInitialTime(), reserveStart, g.getOrigin(), reduction, 0);
previousGaps.add(tmpGap);
if (gapAction != null) {
FullGraphSchedulingInformation<P, T, I> gapDSI = (FullGraphSchedulingInformation<P, T, I>) 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) {
FullGraphSchedulingInformation<P, T, I> gapDSI = (FullGraphSchedulingInformation<P, T, I>) gapAction.getSchedulingInfo();
gapDSI.removeGap();
}
}
return remove;
}
Aggregations