use of es.bsc.compss.types.implementations.MethodImplementation in project compss by bsc-wdc.
the class ResourceOptimizer method optionalIncrease.
private boolean optionalIncrease(float[] creationRecommendations) {
PriorityQueue<ValueResourceDescription> pq = new PriorityQueue<>();
for (int coreId = 0; coreId < creationRecommendations.length; coreId++) {
if (creationRecommendations[coreId] > 1) {
List<Implementation> impls = CoreManager.getCoreImplementations(coreId);
for (Implementation impl : impls) {
if (impl.getTaskType() == TaskType.SERVICE) {
continue;
}
MethodResourceDescription constraints = ((MethodImplementation) impl).getRequirements();
ValueResourceDescription v = new ValueResourceDescription(constraints, creationRecommendations[coreId], false);
pq.add(v);
}
}
}
ResourceCreationRequest rcr = requestOneCreation(pq, false);
return (rcr != null);
}
use of es.bsc.compss.types.implementations.MethodImplementation in project compss by bsc-wdc.
the class ResourceOptimizer method mandatoryIncrease.
private void mandatoryIncrease(float[] creationRecommendations, List<Integer> requiredVMs) {
PriorityQueue<ValueResourceDescription> pq = new PriorityQueue<>();
boolean[] required = new boolean[creationRecommendations.length];
for (int coreId : requiredVMs) {
required[coreId] = true;
}
for (int coreId = 0; coreId < creationRecommendations.length; coreId++) {
List<Implementation> impls = CoreManager.getCoreImplementations(coreId);
for (Implementation impl : impls) {
if (impl.getTaskType() == TaskType.SERVICE) {
continue;
}
MethodResourceDescription constraints = ((MethodImplementation) impl).getRequirements();
ValueResourceDescription v = new ValueResourceDescription(constraints, creationRecommendations[coreId], false);
pq.add(v);
}
}
requestOneCreation(pq, true);
}
use of es.bsc.compss.types.implementations.MethodImplementation in project compss by bsc-wdc.
the class ResourceSchedulerTest method setUpClass.
@BeforeClass
public static void setUpClass() {
// Method resource description and its slots
Processor p = new Processor();
p.setComputingUnits(4);
MethodResourceDescription description = new MethodResourceDescription();
description.addProcessor(p);
worker = new FakeWorker(description, 4);
int coreId = CoreManager.registerNewCoreElement("methodA");
LinkedList<Implementation> impls = new LinkedList<>();
LinkedList<String> signs = new LinkedList<>();
Implementation impl = new MethodImplementation("ClassA", "methodA", coreId, 0, new MethodResourceDescription());
impls.add(impl);
signs.add("ClassA.methodA");
impl = new MethodImplementation("ClassB", "methodA", coreId, 1, new MethodResourceDescription());
impls.add(impl);
signs.add("ClassB.methodA");
CoreManager.registerNewImplementations(coreId, impls, signs);
coreId = CoreManager.registerNewCoreElement("methodB");
impls = new LinkedList<>();
signs = new LinkedList<>();
impl = new MethodImplementation("ClassA", "methodB", coreId, 0, new MethodResourceDescription());
impls.add(impl);
signs.add("ClassA.methodB");
CoreManager.registerNewImplementations(coreId, impls, signs);
}
use of es.bsc.compss.types.implementations.MethodImplementation in project compss by bsc-wdc.
the class NIOJob method prepareJob.
public NIOTask prepareJob() {
AbstractMethodImplementation absMethodImpl = (AbstractMethodImplementation) this.impl;
// This is a workarround for Python
if (absMethodImpl.getMethodType().equals(MethodType.METHOD)) {
MethodImplementation mImpl = (MethodImplementation) absMethodImpl;
String methodName = mImpl.getAlternativeMethodName();
if (methodName == null || methodName.isEmpty()) {
mImpl.setAlternativeMethodName(taskParams.getName());
}
}
boolean hasTarget = taskParams.hasTargetObject();
boolean hasReturn = taskParams.hasReturnValue();
LinkedList<NIOParam> params = addParams();
MethodResourceDescription reqs = absMethodImpl.getRequirements();
int numParams = params.size();
if (taskParams.hasReturnValue()) {
numParams--;
}
// Create NIOTask
NIOTask nt = new NIOTask(LANG, debug, absMethodImpl, hasTarget, hasReturn, params, numParams, reqs, this.slaveWorkersNodeNames, this.taskId, this.taskParams.getId(), this.jobId, this.history, this.transferId);
return nt;
}
use of es.bsc.compss.types.implementations.MethodImplementation in project compss by bsc-wdc.
the class NIOJob method toString.
@Override
public String toString() {
MethodImplementation method = (MethodImplementation) this.impl;
String className = method.getDeclaringClass();
String methodName = taskParams.getName();
return "NIOJob JobId" + this.jobId + " for method " + methodName + " at class " + className;
}
Aggregations