use of es.bsc.compss.scheduler.types.Profile in project compss by bsc-wdc.
the class TaskScheduler method getTaskSummary.
/*
* *********************************************************************************************************
* *********************************************************************************************************
* ********************************* MONITORING OPERATIONS *************************************************
* *********************************************************************************************************
* *********************************************************************************************************
*/
/**
* Prints the task summary on a given logger @logger
*
* @param logger
*/
public final void getTaskSummary(Logger logger) {
LOGGER.info("[TaskScheduler] Get task summary");
// Structures for global and per worker stats
int coreCount = CoreManager.getCoreCount();
Profile[] coreGlobalProfiles = new Profile[coreCount];
for (int i = 0; i < coreCount; ++i) {
coreGlobalProfiles[i] = new Profile();
}
HashMap<String, Profile[]> coreProfilesPerWorker = new HashMap<>();
// Retrieve information
for (ResourceScheduler<? extends WorkerResourceDescription> ui : workers.values()) {
if (ui == null) {
continue;
}
Profile[] coreProfiles = new Profile[coreCount];
for (int i = 0; i < coreCount; ++i) {
coreProfiles[i] = new Profile();
}
List<Implementation>[] impls = ui.getExecutableImpls();
for (int coreId = 0; coreId < coreCount; coreId++) {
for (Implementation impl : impls[coreId]) {
String signature = CoreManager.getSignature(coreId, impl.getImplementationId());
boolean isPhantomSignature = signature.endsWith(")");
if (!isPhantomSignature) {
// Phantom signatures are used for external execution wrappers (MPI, OMPSs, etc.)
coreGlobalProfiles[coreId].accumulate(ui.getProfile(impl));
coreProfiles[coreId].accumulate(ui.getProfile(impl));
}
}
}
coreProfilesPerWorker.put(ui.getName(), coreProfiles);
}
// Process information in output format
logger.warn("------- COMPSs Task Execution Summary per Worker ------");
for (Entry<String, Profile[]> workerInfo : coreProfilesPerWorker.entrySet()) {
String workerName = workerInfo.getKey();
Profile[] workerCoreProfiles = workerInfo.getValue();
logger.warn("--- Summary for COMPSs Worker " + workerName);
long totalExecutedTasksInWorker = 0;
for (Entry<String, Integer> entry : CoreManager.getSignaturesToId().entrySet()) {
String signature = entry.getKey();
boolean isPhantomSignature = signature.endsWith(")");
if (!isPhantomSignature) {
int coreId = entry.getValue();
long executionCount = workerCoreProfiles[coreId].getExecutionCount();
totalExecutedTasksInWorker += executionCount;
String info = executionCount + " " + signature + " tasks have been executed";
logger.warn(info);
}
}
logger.warn("--- Total executed tasks in COMPSs Worker " + workerName + ": " + totalExecutedTasksInWorker);
}
logger.warn("-------------------------------------------------------");
logger.warn("");
logger.warn("------------ COMPSs Task Execution Summary ------------");
long totalExecutedTasks = 0;
for (Entry<String, Integer> entry : CoreManager.getSignaturesToId().entrySet()) {
String signature = entry.getKey();
boolean isPhantomSignature = signature.endsWith(")");
if (!isPhantomSignature) {
int coreId = entry.getValue();
long executionCount = coreGlobalProfiles[coreId].getExecutionCount();
totalExecutedTasks += executionCount;
String info = executionCount + " " + signature + " tasks have been executed";
logger.warn(info);
}
}
logger.warn("Total executed tasks: " + totalExecutedTasks);
logger.warn("-------------------------------------------------------");
}
use of es.bsc.compss.scheduler.types.Profile in project compss by bsc-wdc.
the class JSONStateManager method addResourceJSON.
public void addResourceJSON(ResourceScheduler<? extends WorkerResourceDescription> rs) {
// Increasing Implementation stats
int coreCount = CoreManager.getCoreCount();
for (int coreId = 0; coreId < coreCount; coreId++) {
for (int implId = 0; implId < CoreManager.getNumberCoreImplementations(coreId); implId++) {
JSONObject implJSON = getJSONForImplementation(coreId, implId);
Profile p = rs.getProfile(coreId, implId);
if (implJSON == null) {
addImplementationJSON(coreId, implId, p);
} else {
accumulateImplementationJSON(coreId, implId, p);
}
}
}
// Attaching new resource to the resources
JSONObject resources = getJSONForResources();
resources.put(rs.getName(), rs.toJSONObject());
}
use of es.bsc.compss.scheduler.types.Profile in project compss by bsc-wdc.
the class TaskScheduler method updateResourceJSON.
public void updateResourceJSON(ResourceScheduler<? extends WorkerResourceDescription> rs) {
JSONObject difference = jsm.updateResourceJSON(rs);
JSONObject implsdiff = difference.getJSONObject("implementations");
// Increasing Implementation stats
int coreCount = CoreManager.getCoreCount();
for (int coreId = 0; coreId < coreCount; coreId++) {
for (int implId = 0; implId < CoreManager.getNumberCoreImplementations(coreId); implId++) {
JSONObject implJSON = jsm.getJSONForImplementation(coreId, implId);
Profile p = generateProfile(implsdiff.getJSONObject(CoreManager.getSignature(coreId, implId)));
if (implJSON == null) {
jsm.addImplementationJSON(coreId, implId, p);
} else {
jsm.accumulateImplementationJSON(coreId, implId, p);
}
}
}
}
Aggregations