Search in sources :

Example 16 with MRJobInstruction

use of org.apache.sysml.runtime.instructions.MRJobInstruction in project incubator-systemml by apache.

the class Statistics method getCPHeavyHitterCode.

public static String getCPHeavyHitterCode(Instruction inst) {
    String opcode = null;
    if (inst instanceof MRJobInstruction) {
        MRJobInstruction mrinst = (MRJobInstruction) inst;
        opcode = "MR-Job_" + mrinst.getJobType();
    } else if (inst instanceof SPInstruction) {
        opcode = "SP_" + InstructionUtils.getOpCode(inst.toString());
        if (inst instanceof FunctionCallCPInstruction) {
            FunctionCallCPInstruction extfunct = (FunctionCallCPInstruction) inst;
            opcode = extfunct.getFunctionName();
        }
    } else // CPInstructions
    {
        opcode = InstructionUtils.getOpCode(inst.toString());
        if (inst instanceof FunctionCallCPInstruction) {
            FunctionCallCPInstruction extfunct = (FunctionCallCPInstruction) inst;
            opcode = extfunct.getFunctionName();
        }
    }
    return opcode;
}
Also used : SPInstruction(org.apache.sysml.runtime.instructions.spark.SPInstruction) MRJobInstruction(org.apache.sysml.runtime.instructions.MRJobInstruction) FunctionCallCPInstruction(org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction)

Example 17 with MRJobInstruction

use of org.apache.sysml.runtime.instructions.MRJobInstruction in project incubator-systemml by apache.

the class ResourceOptimizer method annotateMRJobInstructions.

private static ArrayList<Instruction> annotateMRJobInstructions(ArrayList<Instruction> inst, long cp, long mr) {
    // check for empty instruction lists (e.g., predicates)
    if (inst == null || !COSTS_MAX_PARALLELISM)
        return inst;
    try {
        for (int i = 0; i < inst.size(); i++) {
            Instruction linst = inst.get(i);
            if (linst instanceof MRJobInstruction) {
                // copy mr job instruction
                MRJobResourceInstruction newlinst = new MRJobResourceInstruction((MRJobInstruction) linst);
                // compute and annotate
                long maxMemPerNode = (long) YarnClusterAnalyzer.getMaxAllocationBytes();
                long nNodes = YarnClusterAnalyzer.getNumNodes();
                long totalMem = nNodes * maxMemPerNode;
                long maxMRTasks = (long) (totalMem - DMLYarnClient.computeMemoryAllocation(cp)) / (long) DMLYarnClient.computeMemoryAllocation(mr);
                newlinst.setMaxMRTasks(maxMRTasks);
                // write enhanced instruction back
                inst.set(i, newlinst);
            }
        }
    } catch (Exception ex) {
        throw new DMLRuntimeException(ex);
    }
    return inst;
}
Also used : MRJobInstruction(org.apache.sysml.runtime.instructions.MRJobInstruction) MRJobInstruction(org.apache.sysml.runtime.instructions.MRJobInstruction) Instruction(org.apache.sysml.runtime.instructions.Instruction) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException) IOException(java.io.IOException) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException)

Aggregations

MRJobInstruction (org.apache.sysml.runtime.instructions.MRJobInstruction)17 Instruction (org.apache.sysml.runtime.instructions.Instruction)10 CPInstruction (org.apache.sysml.runtime.instructions.cp.CPInstruction)7 VariableCPInstruction (org.apache.sysml.runtime.instructions.cp.VariableCPInstruction)6 ArrayList (java.util.ArrayList)5 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)4 BreakPointInstruction (org.apache.sysml.runtime.instructions.cp.BreakPointInstruction)4 SPInstruction (org.apache.sysml.runtime.instructions.spark.SPInstruction)4 FunctionCallCPInstruction (org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction)3 MRInstruction (org.apache.sysml.runtime.instructions.mr.MRInstruction)3 ExternalFunctionInvocationInstruction (org.apache.sysml.udf.ExternalFunctionInvocationInstruction)3 HashMap (java.util.HashMap)2 DataIdentifier (org.apache.sysml.parser.DataIdentifier)2 MatrixObject (org.apache.sysml.runtime.controlprogram.caching.MatrixObject)2 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 StringTokenizer (java.util.StringTokenizer)1 Data (org.apache.sysml.lops.Data)1 Lop (org.apache.sysml.lops.Lop)1 LopsException (org.apache.sysml.lops.LopsException)1