Search in sources :

Example 1 with SpoofCPInstruction

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

the class ProgramConverter method serializeInstructions.

@SuppressWarnings("all")
private static String serializeInstructions(ArrayList<Instruction> inst, HashMap<String, byte[]> clsMap) throws DMLRuntimeException {
    StringBuilder sb = new StringBuilder();
    int count = 0;
    for (Instruction linst : inst) {
        //check that only cp instruction are transmitted 
        if (!(linst instanceof CPInstruction || linst instanceof ExternalFunctionInvocationInstruction))
            throw new DMLRuntimeException(NOT_SUPPORTED_MR_INSTRUCTION + " " + linst.getClass().getName() + "\n" + linst);
        //obtain serialized version of generated classes
        if (linst instanceof SpoofCPInstruction) {
            Class<?> cla = ((SpoofCPInstruction) linst).getOperatorClass();
            clsMap.put(cla.getName(), CodegenUtils.getClassData(cla.getName()));
        }
        if (count > 0)
            sb.append(ELEMENT_DELIM);
        sb.append(checkAndReplaceLiterals(linst.toString()));
        count++;
    }
    return sb.toString();
}
Also used : CPInstruction(org.apache.sysml.runtime.instructions.cp.CPInstruction) SpoofCPInstruction(org.apache.sysml.runtime.instructions.cp.SpoofCPInstruction) VariableCPInstruction(org.apache.sysml.runtime.instructions.cp.VariableCPInstruction) FunctionCallCPInstruction(org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction) ExternalFunctionInvocationInstruction(org.apache.sysml.udf.ExternalFunctionInvocationInstruction) SpoofCPInstruction(org.apache.sysml.runtime.instructions.cp.SpoofCPInstruction) GPUInstruction(org.apache.sysml.runtime.instructions.gpu.GPUInstruction) MRJobInstruction(org.apache.sysml.runtime.instructions.MRJobInstruction) CPInstruction(org.apache.sysml.runtime.instructions.cp.CPInstruction) ExternalFunctionInvocationInstruction(org.apache.sysml.udf.ExternalFunctionInvocationInstruction) SpoofCPInstruction(org.apache.sysml.runtime.instructions.cp.SpoofCPInstruction) Instruction(org.apache.sysml.runtime.instructions.Instruction) SPInstruction(org.apache.sysml.runtime.instructions.spark.SPInstruction) VariableCPInstruction(org.apache.sysml.runtime.instructions.cp.VariableCPInstruction) FunctionCallCPInstruction(org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction) MRInstruction(org.apache.sysml.runtime.instructions.mr.MRInstruction) DMLRuntimeException(org.apache.sysml.runtime.DMLRuntimeException)

Aggregations

DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)1 Instruction (org.apache.sysml.runtime.instructions.Instruction)1 MRJobInstruction (org.apache.sysml.runtime.instructions.MRJobInstruction)1 CPInstruction (org.apache.sysml.runtime.instructions.cp.CPInstruction)1 FunctionCallCPInstruction (org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction)1 SpoofCPInstruction (org.apache.sysml.runtime.instructions.cp.SpoofCPInstruction)1 VariableCPInstruction (org.apache.sysml.runtime.instructions.cp.VariableCPInstruction)1 GPUInstruction (org.apache.sysml.runtime.instructions.gpu.GPUInstruction)1 MRInstruction (org.apache.sysml.runtime.instructions.mr.MRInstruction)1 SPInstruction (org.apache.sysml.runtime.instructions.spark.SPInstruction)1 ExternalFunctionInvocationInstruction (org.apache.sysml.udf.ExternalFunctionInvocationInstruction)1