use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class OptimizationTest method setUpClass.
@BeforeClass
public static void setUpClass() {
CoreManager.clear();
CoreManager.registerNewCoreElement("fakeSignature00");
CoreManager.registerNewCoreElement("fakeSignature10");
CoreManager.registerNewCoreElement("fakeSignature20");
CoreManager.registerNewCoreElement("fakeSignature30");
CoreManager.registerNewCoreElement("fakeSignature40");
CoreManager.registerNewCoreElement("fakeSignature50");
CoreManager.registerNewCoreElement("fakeSignature60");
CoreManager.registerNewCoreElement("fakeSignature70");
FakeImplementation impl00 = new FakeImplementation(0, 0, new FakeResourceDescription(2));
List<Implementation<?>> impls0 = new LinkedList<>();
impls0.add(impl00);
List<String> signatures0 = new LinkedList<>();
signatures0.add("fakeSignature00");
CoreManager.registerNewImplementations(0, impls0, signatures0);
FakeImplementation impl10 = new FakeImplementation(1, 0, new FakeResourceDescription(3));
List<Implementation<?>> impls1 = new LinkedList<>();
impls1.add(impl10);
List<String> signatures1 = new LinkedList<>();
signatures1.add("fakeSignature10");
CoreManager.registerNewImplementations(1, impls1, signatures1);
FakeImplementation impl20 = new FakeImplementation(2, 0, new FakeResourceDescription(1));
List<Implementation<?>> impls2 = new LinkedList<>();
impls2.add(impl20);
List<String> signatures2 = new LinkedList<>();
signatures2.add("fakeSignature20");
CoreManager.registerNewImplementations(2, impls2, signatures2);
FakeImplementation impl30 = new FakeImplementation(3, 0, new FakeResourceDescription(4));
List<Implementation<?>> impls3 = new LinkedList<>();
impls3.add(impl30);
List<String> signatures3 = new LinkedList<>();
signatures3.add("fakeSignature30");
CoreManager.registerNewImplementations(3, impls3, signatures3);
FakeImplementation impl40 = new FakeImplementation(4, 0, new FakeResourceDescription(2));
List<Implementation<?>> impls4 = new LinkedList<>();
impls4.add(impl40);
List<String> signatures4 = new LinkedList<>();
signatures4.add("fakeSignature40");
CoreManager.registerNewImplementations(4, impls4, signatures4);
FakeImplementation impl50 = new FakeImplementation(5, 0, new FakeResourceDescription(1));
List<Implementation<?>> impls5 = new LinkedList<>();
impls5.add(impl50);
List<String> signatures5 = new LinkedList<>();
signatures5.add("fakeSignature50");
CoreManager.registerNewImplementations(5, impls5, signatures5);
FakeImplementation impl60 = new FakeImplementation(6, 0, new FakeResourceDescription(3));
List<Implementation<?>> impls6 = new LinkedList<>();
impls6.add(impl60);
List<String> signatures6 = new LinkedList<>();
signatures6.add("fakeSignature60");
CoreManager.registerNewImplementations(6, impls6, signatures6);
int maxSlots = 4;
FakeResourceDescription frd = new FakeResourceDescription(maxSlots);
FakeWorker fw = new FakeWorker("worker1", frd, maxSlots);
drs1 = new FullGraphResourceScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>(fw, fao);
FakeResourceDescription frd2 = new FakeResourceDescription(maxSlots);
FakeWorker fw2 = new FakeWorker("worker2", frd2, maxSlots);
drs2 = new FullGraphResourceScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>(fw2, fao);
drs1.profiledExecution(impl00, new FakeProfile(50));
drs1.profiledExecution(impl10, new FakeProfile(50));
drs1.profiledExecution(impl20, new FakeProfile(30));
drs1.profiledExecution(impl30, new FakeProfile(50));
drs1.profiledExecution(impl40, new FakeProfile(20));
drs1.profiledExecution(impl50, new FakeProfile(10));
drs1.profiledExecution(impl60, new FakeProfile(30));
drs2.profiledExecution(impl00, new FakeProfile(50));
drs2.profiledExecution(impl10, new FakeProfile(50));
drs2.profiledExecution(impl20, new FakeProfile(30));
// Faster than drs
drs2.profiledExecution(impl30, new FakeProfile(30));
drs2.profiledExecution(impl40, new FakeProfile(15));
drs2.profiledExecution(impl50, new FakeProfile(10));
drs2.profiledExecution(impl60, new FakeProfile(15));
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class PriorityActionSetTest method setUpClass.
@BeforeClass
public static void setUpClass() {
CoreManager.clear();
CoreManager.registerNewCoreElement("fakeSignature00");
CoreManager.registerNewCoreElement("fakeSignature10");
CoreManager.registerNewCoreElement("fakeSignature20");
FakeImplementation impl00 = new FakeImplementation(0, 0, new FakeResourceDescription(2));
List<Implementation<?>> impls0 = new LinkedList<>();
impls0.add(impl00);
List<String> signatures0 = new LinkedList<>();
signatures0.add("fakeSignature00");
CoreManager.registerNewImplementations(0, impls0, signatures0);
FakeImplementation impl10 = new FakeImplementation(1, 0, new FakeResourceDescription(3));
List<Implementation<?>> impls1 = new LinkedList<>();
impls1.add(impl10);
List<String> signatures1 = new LinkedList<>();
signatures1.add("fakeSignature10");
CoreManager.registerNewImplementations(1, impls1, signatures1);
FakeImplementation impl20 = new FakeImplementation(2, 0, new FakeResourceDescription(1));
List<Implementation<?>> impls2 = new LinkedList<>();
impls2.add(impl20);
List<String> signatures2 = new LinkedList<>();
signatures2.add("fakeSignature20");
CoreManager.registerNewImplementations(2, impls2, signatures2);
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class ScoresTest method setUpClass.
@BeforeClass
public static void setUpClass() {
CoreManager.clear();
CoreManager.registerNewCoreElement("fakeSignature00");
CoreManager.registerNewCoreElement("fakeSignature10");
CoreManager.registerNewCoreElement("fakeSignature20");
CoreManager.registerNewCoreElement("fakeSignature30");
CoreManager.registerNewCoreElement("fakeSignature40");
CoreManager.registerNewCoreElement("task");
System.setProperty(ITConstants.IT_TRACING, "0");
System.setProperty(ITConstants.IT_EXTRAE_CONFIG_FILE, "");
Comm.init();
ds = new FullGraphScheduler<FakeProfile, FakeResourceDescription, FakeImplementation>();
FakeImplementation impl00 = new FakeImplementation(0, 0, new FakeResourceDescription(2));
List<Implementation<?>> impls0 = new LinkedList<>();
impls0.add(impl00);
List<String> signatures0 = new LinkedList<>();
signatures0.add("fakeSignature00");
CoreManager.registerNewImplementations(0, impls0, signatures0);
FakeImplementation impl10 = new FakeImplementation(1, 0, new FakeResourceDescription(3));
List<Implementation<?>> impls1 = new LinkedList<>();
impls1.add(impl10);
List<String> signatures1 = new LinkedList<>();
signatures1.add("fakeSignature10");
CoreManager.registerNewImplementations(1, impls1, signatures1);
FakeImplementation impl20 = new FakeImplementation(2, 0, new FakeResourceDescription(1));
List<Implementation<?>> impls2 = new LinkedList<>();
impls2.add(impl20);
List<String> signatures2 = new LinkedList<>();
signatures2.add("fakeSignature20");
CoreManager.registerNewImplementations(2, impls2, signatures2);
FakeImplementation impl30 = new FakeImplementation(3, 0, new FakeResourceDescription(4));
List<Implementation<?>> impls3 = new LinkedList<>();
impls3.add(impl30);
List<String> signatures3 = new LinkedList<>();
signatures3.add("fakeSignature30");
CoreManager.registerNewImplementations(3, impls3, signatures3);
FakeImplementation impl40 = new FakeImplementation(4, 0, new FakeResourceDescription(4));
FakeImplementation impl41 = new FakeImplementation(4, 1, new FakeResourceDescription(2));
List<Implementation<?>> impls4 = new LinkedList<>();
impls4.add(impl40);
impls4.add(impl41);
List<String> signatures4 = new LinkedList<>();
signatures4.add("fakeSignature40");
signatures4.add("fakeSignature41");
CoreManager.registerNewImplementations(4, impls4, signatures4);
int maxSlots = 4;
FakeResourceDescription frd = new FakeResourceDescription(maxSlots);
FakeWorker fw = new FakeWorker("worker1", frd, maxSlots);
drs1 = new FakeResourceScheduler(fw, fao, 0);
FakeResourceDescription frd2 = new FakeResourceDescription(maxSlots);
FakeWorker fw2 = new FakeWorker("worker2", frd2, maxSlots);
drs2 = new FakeResourceScheduler(fw2, fao, 0);
drs1.profiledExecution(impl00, new FakeProfile(50));
drs1.profiledExecution(impl10, new FakeProfile(50));
drs1.profiledExecution(impl20, new FakeProfile(30));
drs1.profiledExecution(impl30, new FakeProfile(50));
drs1.profiledExecution(impl40, new FakeProfile(20));
drs1.profiledExecution(impl41, new FakeProfile(30));
CORE0 = drs1.getProfile(impl00).getAverageExecutionTime();
CORE2 = drs1.getProfile(impl20).getAverageExecutionTime();
CORE4_0 = drs1.getProfile(impl40).getAverageExecutionTime();
CORE4_1 = drs1.getProfile(impl41).getAverageExecutionTime();
// debugConfiguration();
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class MOResourceOptimizer method createResourceForComponent.
private Resource<?> createResourceForComponent(CloudInstanceTypeDescription citd, CloudImageDescription cid) {
Resource<?> r = new Resource<>(null);
MOCloudTypeProfile moCloudTypeProf = (MOCloudTypeProfile) getCloudTypeProfile(citd);
r.idlePower = moCloudTypeProf.getIdlePower();
r.idlePrice = moCloudTypeProf.getIdlePrice();
MethodResourceDescription rd = citd.getResourceDescription();
r.capacity = new int[CoreManager.getCoreCount()];
r.profiles = new MOProfile[CoreManager.getCoreCount()];
for (int coreId = 0; coreId < CoreManager.getCoreCount(); coreId++) {
List<Implementation> impls = CoreManager.getCoreImplementations(coreId);
MOProfile[] profiles = new MOProfile[impls.size()];
for (int i = 0; i < impls.size(); i++) {
profiles[i] = (MOProfile) moCloudTypeProf.getImplProfiles(coreId, impls.get(i).getImplementationId());
}
Implementation impl = getBestImplementation(impls, profiles);
r.capacity[coreId] = rd.canHostSimultaneously((MethodResourceDescription) impl.getRequirements());
r.profiles[coreId] = (MOProfile) moCloudTypeProf.getImplProfiles(coreId, impl.getImplementationId());
}
r.startTime = cid.getCreationTime() * 1000;
r.clear();
return r;
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class MOResourceOptimizer method reduceResourceForComponent.
private Resource<?> reduceResourceForComponent(Resource<?> excludedWorker, CloudMethodResourceDescription reduction) {
Resource<?> clone = new Resource<>(excludedWorker.worker);
clone.idlePower = excludedWorker.idlePower;
clone.idlePrice = excludedWorker.idlePrice;
clone.capacity = new int[excludedWorker.capacity.length];
System.arraycopy(excludedWorker.capacity, 0, clone.capacity, 0, excludedWorker.capacity.length);
clone.startTime = excludedWorker.startTime;
clone.startEnergy = excludedWorker.startEnergy;
clone.startCost = excludedWorker.startCost;
clone.time = excludedWorker.time;
clone.counts = excludedWorker.counts;
Map<CloudInstanceTypeDescription, int[]> composition = reduction.getTypeComposition();
for (Map.Entry<CloudInstanceTypeDescription, int[]> component : composition.entrySet()) {
CloudInstanceTypeDescription type = component.getKey();
int count = component.getValue()[0];
MethodResourceDescription rd = type.getResourceDescription();
MOCloudTypeProfile moCloudTypeProf = (MOCloudTypeProfile) getCloudTypeProfile(type);
clone.idlePower -= moCloudTypeProf.getIdlePower() * count;
clone.idlePrice -= moCloudTypeProf.getIdlePrice() * count;
for (int coreId = 0; coreId < CoreManager.getCoreCount(); coreId++) {
List<Implementation> impls = CoreManager.getCoreImplementations(coreId);
MOProfile[] profiles = new MOProfile[impls.size()];
for (int i = 0; i < impls.size(); i++) {
profiles[i] = (MOProfile) moCloudTypeProf.getImplProfiles(coreId, impls.get(i).getImplementationId());
}
Implementation impl = getBestImplementation(impls, profiles);
clone.capacity[coreId] -= rd.canHostSimultaneously((MethodResourceDescription) impl.getRequirements()) * count;
}
}
return clone;
}
Aggregations