Search in sources :

Example 41 with Implementation

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));
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) Implementation(es.bsc.compss.types.implementations.Implementation) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) LinkedList(java.util.LinkedList) FakeWorker(es.bsc.es.bsc.compss.scheduler.types.fake.FakeWorker) BeforeClass(org.junit.BeforeClass)

Example 42 with Implementation

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);
}
Also used : FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) Implementation(es.bsc.compss.types.implementations.Implementation) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) LinkedList(java.util.LinkedList) BeforeClass(org.junit.BeforeClass)

Example 43 with Implementation

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();
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) FakeResourceScheduler(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceScheduler) Implementation(es.bsc.compss.types.implementations.Implementation) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) LinkedList(java.util.LinkedList) FakeWorker(es.bsc.es.bsc.compss.scheduler.types.fake.FakeWorker) BeforeClass(org.junit.BeforeClass)

Example 44 with Implementation

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;
}
Also used : MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription) Implementation(es.bsc.compss.types.implementations.Implementation) MOProfile(es.bsc.compss.scheduler.multiobjective.types.MOProfile)

Example 45 with Implementation

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;
}
Also used : Implementation(es.bsc.compss.types.implementations.Implementation) CloudInstanceTypeDescription(es.bsc.compss.types.resources.description.CloudInstanceTypeDescription) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) CloudMethodResourceDescription(es.bsc.compss.types.resources.description.CloudMethodResourceDescription) HashMap(java.util.HashMap) Map(java.util.Map) MOProfile(es.bsc.compss.scheduler.multiobjective.types.MOProfile)

Aggregations

Implementation (es.bsc.compss.types.implementations.Implementation)54 MethodImplementation (es.bsc.compss.types.implementations.MethodImplementation)24 MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)20 LinkedList (java.util.LinkedList)19 JSONObject (org.json.JSONObject)13 Test (org.junit.Test)12 ResourceScheduler (es.bsc.compss.components.impl.ResourceScheduler)10 List (java.util.List)9 MOProfile (es.bsc.compss.scheduler.multiobjective.types.MOProfile)8 CloudMethodResourceDescription (es.bsc.compss.types.resources.description.CloudMethodResourceDescription)8 HashMap (java.util.HashMap)7 AllocatableAction (es.bsc.compss.scheduler.types.AllocatableAction)6 Profile (es.bsc.compss.scheduler.types.Profile)6 BeforeClass (org.junit.BeforeClass)6 CloudInstanceTypeDescription (es.bsc.compss.types.resources.description.CloudInstanceTypeDescription)5 WorkerResourceDescription (es.bsc.compss.types.resources.WorkerResourceDescription)4 Score (es.bsc.compss.scheduler.types.Score)3 ServiceImplementation (es.bsc.compss.types.implementations.ServiceImplementation)3 Worker (es.bsc.compss.types.resources.Worker)3 Processor (es.bsc.compss.types.resources.components.Processor)3