Search in sources :

Example 1 with MethodType

use of es.bsc.compss.types.implementations.AbstractMethodImplementation.MethodType in project compss by bsc-wdc.

the class JavaExecutor method executeTask.

@Override
public void executeTask(NIOWorker nw, NIOTask nt, String outputsBasename, File taskSandboxWorkingDir, int[] assignedCoreUnits, int[] assignedGPUs) throws JobExecutionException {
    /* Register outputs **************************************** */
    NIOWorker.registerOutputs(outputsBasename);
    /* TRY TO PROCESS THE TASK ******************************** */
    System.out.println("[JAVA EXECUTOR] executeTask - Begin task execution");
    try {
        MethodType methodType = nt.getMethodType();
        Invoker invoker = null;
        switch(methodType) {
            case METHOD:
                invoker = new JavaInvoker(nw, nt, taskSandboxWorkingDir, assignedCoreUnits);
                break;
            case MPI:
                invoker = new MPIInvoker(nw, nt, taskSandboxWorkingDir, assignedCoreUnits);
                break;
            case DECAF:
                invoker = new DecafInvoker(nw, nt, taskSandboxWorkingDir, assignedCoreUnits);
                break;
            case OMPSS:
                invoker = new OmpSsInvoker(nw, nt, taskSandboxWorkingDir, assignedCoreUnits);
                break;
            case OPENCL:
                invoker = new OpenCLInvoker(nw, nt, taskSandboxWorkingDir, assignedCoreUnits);
                break;
            case BINARY:
                invoker = new BinaryInvoker(nw, nt, taskSandboxWorkingDir, assignedCoreUnits);
                break;
            default:
                throw new JobExecutionException("Unrecognised method type");
        }
        invoker.processTask();
    } catch (JobExecutionException jee) {
        System.out.println("[JAVA EXECUTOR] executeTask - Error in task execution");
        System.err.println("[JAVA EXECUTOR] executeTask - Error in task execution");
        jee.printStackTrace();
        throw jee;
    } finally {
        System.out.println("[JAVA EXECUTOR] executeTask - End task execution");
        NIOWorker.unregisterOutputs();
    }
}
Also used : MethodType(es.bsc.compss.types.implementations.AbstractMethodImplementation.MethodType) OmpSsInvoker(es.bsc.compss.nio.worker.executors.util.OmpSsInvoker) JavaInvoker(es.bsc.compss.nio.worker.executors.util.JavaInvoker) JobExecutionException(es.bsc.compss.nio.exceptions.JobExecutionException) Invoker(es.bsc.compss.nio.worker.executors.util.Invoker) BinaryInvoker(es.bsc.compss.nio.worker.executors.util.BinaryInvoker) OpenCLInvoker(es.bsc.compss.nio.worker.executors.util.OpenCLInvoker) OmpSsInvoker(es.bsc.compss.nio.worker.executors.util.OmpSsInvoker) DecafInvoker(es.bsc.compss.nio.worker.executors.util.DecafInvoker) MPIInvoker(es.bsc.compss.nio.worker.executors.util.MPIInvoker) JavaInvoker(es.bsc.compss.nio.worker.executors.util.JavaInvoker) DecafInvoker(es.bsc.compss.nio.worker.executors.util.DecafInvoker) OpenCLInvoker(es.bsc.compss.nio.worker.executors.util.OpenCLInvoker) MPIInvoker(es.bsc.compss.nio.worker.executors.util.MPIInvoker) BinaryInvoker(es.bsc.compss.nio.worker.executors.util.BinaryInvoker)

Example 2 with MethodType

use of es.bsc.compss.types.implementations.AbstractMethodImplementation.MethodType in project compss by bsc-wdc.

the class COMPSsRuntimeImpl method registerCoreElement.

/**
 * Registers a new CoreElement in the COMPSs Runtime
 */
@Override
public void registerCoreElement(String coreElementSignature, String implSignature, String implConstraints, String implType, String... implTypeArgs) {
    LOGGER.info("Registering CoreElement " + coreElementSignature);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("\t - Implementation: " + implSignature);
        LOGGER.debug("\t - Constraints   : " + implConstraints);
        LOGGER.debug("\t - Type          : " + implType);
        LOGGER.debug("\t - ImplTypeArgs  : ");
        for (String implTypeArg : implTypeArgs) {
            LOGGER.debug("\t\t Arg: " + implTypeArg);
        }
    }
    MethodResourceDescription mrd = new MethodResourceDescription(implConstraints);
    MethodType mt;
    switch(implType) {
        case "METHOD":
            mt = MethodType.METHOD;
            break;
        case "MPI":
            mt = MethodType.MPI;
            break;
        case "DECAF":
            mt = MethodType.DECAF;
            break;
        case "BINARY":
            mt = MethodType.BINARY;
            break;
        case "OMPSS":
            mt = MethodType.OMPSS;
            break;
        case "OPENCL":
            mt = MethodType.OPENCL;
            break;
        default:
            ErrorManager.error("Unrecognised method type " + implType);
            return;
    }
    td.registerNewCoreElement(coreElementSignature, implSignature, mrd, mt, implTypeArgs);
}
Also used : MethodType(es.bsc.compss.types.implementations.AbstractMethodImplementation.MethodType) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription)

Aggregations

MethodType (es.bsc.compss.types.implementations.AbstractMethodImplementation.MethodType)2 JobExecutionException (es.bsc.compss.nio.exceptions.JobExecutionException)1 BinaryInvoker (es.bsc.compss.nio.worker.executors.util.BinaryInvoker)1 DecafInvoker (es.bsc.compss.nio.worker.executors.util.DecafInvoker)1 Invoker (es.bsc.compss.nio.worker.executors.util.Invoker)1 JavaInvoker (es.bsc.compss.nio.worker.executors.util.JavaInvoker)1 MPIInvoker (es.bsc.compss.nio.worker.executors.util.MPIInvoker)1 OmpSsInvoker (es.bsc.compss.nio.worker.executors.util.OmpSsInvoker)1 OpenCLInvoker (es.bsc.compss.nio.worker.executors.util.OpenCLInvoker)1 MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)1