use of es.bsc.es.bsc.compss.scheduler.types.FullGraphScore in project compss by bsc-wdc.
the class ScoresTest method testImplementationScores.
@SuppressWarnings("unchecked")
@Test
public void testImplementationScores() throws BlockedActionException, UnassignedActionException {
drs1.clear();
// No resources and no dependencies
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(4));
TaskDescription tp1 = new TaskDescription("task", false, Constants.SINGLE_NODE, false, false, false, false, new Parameter[0]);
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 0, 0, 0, 0, 0);
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
Verifiers.verifyScore(score1_0, 0, 0, 0, CORE4_0, 0);
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
Verifiers.verifyScore(score1_1, 0, 0, 0, CORE4_1, 0);
Verifiers.validateBetterScore(score1_0, score1_1, true);
// Resources with load
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
action2.selectExecution(drs1, (FakeImplementation) action2.getImplementations()[0]);
drs1.scheduleAction(action2);
score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
Verifiers.verifyScore(score1_0, 0, 0, CORE0, CORE4_0, CORE0);
score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
Verifiers.verifyScore(score1_1, 0, 0, 0, CORE4_1, 0);
Verifiers.validateBetterScore(score1_0, score1_1, false);
FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, CoreManager.getCoreImplementations(2));
action3.selectExecution(drs1, (FakeImplementation) action3.getImplementations()[0]);
drs1.scheduleAction(action3);
score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
Verifiers.verifyScore(score1_0, 0, 0, CORE0, CORE4_0, CORE0);
score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
Verifiers.verifyScore(score1_1, 0, 0, CORE2, CORE4_1, CORE2);
Verifiers.validateBetterScore(score1_0, score1_1, false);
// Data Dependencies
FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(0));
action10.selectExecution(drs2, (FakeImplementation) action10.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi10 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action10.getSchedulingInfo();
dsi10.setExpectedEnd(10);
action1.addDataPredecessor(action10);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 0, 10, 0, 0, 10);
score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
Verifiers.verifyScore(score1_0, 0, 10, CORE0, CORE4_0, CORE0);
score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
Verifiers.verifyScore(score1_1, 0, 10, CORE2, CORE4_1, CORE2);
Verifiers.validateBetterScore(score1_0, score1_1, false);
FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(0));
action11.selectExecution(drs2, (FakeImplementation) action11.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi11 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action11.getSchedulingInfo();
dsi11.setExpectedEnd(10_000);
action1.addDataPredecessor(action11);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 0, 10_000, 0, 0, 10_000);
score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
Verifiers.verifyScore(score1_0, 0, 10_000, CORE0, CORE4_0, 10_000);
score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
Verifiers.verifyScore(score1_1, 0, 10_000, CORE2, CORE4_1, 10_000);
Verifiers.validateBetterScore(score1_0, score1_1, true);
}
use of es.bsc.es.bsc.compss.scheduler.types.FullGraphScore in project compss by bsc-wdc.
the class ScoresTest method testResourceScores.
@SuppressWarnings("unchecked")
@Test
public void testResourceScores() throws BlockedActionException, UnassignedActionException, Exception {
drs1.clear();
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
DataInstanceId d1v1 = new DataInstanceId(1, 1);
Comm.registerData(d1v1.getRenaming());
DataInstanceId d2v2 = new DataInstanceId(2, 2);
Comm.registerData(d2v2.getRenaming());
DependencyParameter dpD1V1 = new DependencyParameter(DataType.FILE_T, Direction.IN, Stream.UNSPECIFIED, Constants.PREFIX_EMTPY);
dpD1V1.setDataAccessId(new RAccessId(1, 1));
DependencyParameter dpD2V2 = new DependencyParameter(DataType.FILE_T, Direction.IN, Stream.UNSPECIFIED, Constants.PREFIX_EMTPY);
dpD2V2.setDataAccessId(new RAccessId(2, 2));
TaskDescription params = new TaskDescription("task", false, Constants.SINGLE_NODE, false, false, false, false, new Parameter[] { dpD1V1, dpD2V2 });
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> actionScore = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
Verifiers.verifyScore(score1, 0, 2 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 2 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
Comm.registerLocation(d1v1.getRenaming(), DataLocation.createLocation(drs1.getResource(), new SimpleURI("/home/test/a")));
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
Verifiers.verifyScore(score1, 0, 1 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 1 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
Comm.registerLocation(d2v2.getRenaming(), DataLocation.createLocation(drs1.getResource(), new SimpleURI("/home/test/b")));
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
Verifiers.verifyScore(score1, 0, 0 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 0 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
Comm.removeData(d1v1.getRenaming());
Comm.removeData(d2v2.getRenaming());
}
use of es.bsc.es.bsc.compss.scheduler.types.FullGraphScore in project compss by bsc-wdc.
the class ScoresTest method testActionScores.
@SuppressWarnings("unchecked")
@Test
public void testActionScores() throws BlockedActionException, UnassignedActionException {
drs1.clear();
FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 1, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
FakeAllocatableAction action14 = new FakeAllocatableAction(fao, 14, 0, CoreManager.getCoreImplementations(0));
action14.selectExecution(drs2, (FakeImplementation) action14.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi14 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action14.getSchedulingInfo();
dsi14.setExpectedEnd(10_000);
FakeAllocatableAction action15 = new FakeAllocatableAction(fao, 15, 0, CoreManager.getCoreImplementations(0));
action15.selectExecution(drs2, (FakeImplementation) action15.getImplementations()[0]);
FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi15 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action15.getSchedulingInfo();
dsi15.setExpectedEnd(12_000);
FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Score score2 = ds.generateActionScore(action2);
Verifiers.verifyScore(score1, 1, 0, 0, 0, 0);
Verifiers.verifyScore((FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) score2, 0, 0, 0, 0, 0);
Verifiers.validateBetterScore(score1, score2, true);
action1.addDataPredecessor(action14);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 1, 10_000, 0, 0, 10_000);
action1.addDataPredecessor(action15);
score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
Verifiers.verifyScore(score1, 1, 12_000, 0, 0, 12_000);
}
use of es.bsc.es.bsc.compss.scheduler.types.FullGraphScore in project compss by bsc-wdc.
the class FullGraphResourceScheduler method generateImplementationScore.
/**
* @param action
* @param params
* @param impl
* @param resourceScore
* @return
*/
@SuppressWarnings("unchecked")
@Override
public Score generateImplementationScore(AllocatableAction<P, T, I> action, TaskDescription params, I impl, Score resourceScore) {
LOGGER.debug("[FullGraphScheduler] Generate implementation score for action " + action.getId());
ResourceDescription rd = impl.getRequirements().copy();
long resourceFreeTime = 0;
try {
for (Gap<P, T, I> g : gaps) {
rd.reduceDynamic(g.getResources());
if (rd.isDynamicUseless()) {
resourceFreeTime = g.getInitialTime();
break;
}
}
} catch (ConcurrentModificationException cme) {
resourceFreeTime = 0;
}
if (resourceFreeTime < 0) {
resourceFreeTime = 0;
}
long implScore;
Profile p = this.getProfile(impl);
if (p != null) {
implScore = p.getAverageExecutionTime();
} else {
implScore = 0;
}
// The data transfer penalty is already included on the datadependency time of the resourceScore
return new FullGraphScore<P, T, I>((FullGraphScore<P, T, I>) resourceScore, 0, 0, resourceFreeTime, implScore);
}
Aggregations