[SYSTEMML-1988] Fix cloning of prepared scripts, rework CP runtime This patch fixes the shallow cloning of prepared scripts by (1) better handling of external functions (which require a deep copy), and (2) a complete rework of our CP runtime instructions and operators to make them read-only in order to avoid side effects. As a positive side effect of this rework, the runtime is now much easier to debug as side effects are impossible due to final members of all instructions and operators.
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/75b93f26 Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/75b93f26 Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/75b93f26 Branch: refs/heads/master Commit: 75b93f261efc7fe9ec415b5e4f6156c30fe51570 Parents: c1ed791 Author: Matthias Boehm <[email protected]> Authored: Tue Nov 7 01:39:34 2017 -0800 Committer: Matthias Boehm <[email protected]> Committed: Tue Nov 7 12:26:09 2017 -0800 ---------------------------------------------------------------------- .../apache/sysml/api/jmlc/PreparedScript.java | 2 +- .../hops/cost/CostEstimatorStaticRuntime.java | 4 +- .../java/org/apache/sysml/lops/compile/Dag.java | 8 +- .../runtime/controlprogram/ForProgramBlock.java | 6 +- .../sysml/runtime/controlprogram/Program.java | 45 ++- .../instructions/CPInstructionParser.java | 344 +++++++++---------- .../sysml/runtime/instructions/Instruction.java | 16 +- .../runtime/instructions/InstructionParser.java | 4 +- .../runtime/instructions/InstructionUtils.java | 62 ++-- .../runtime/instructions/MRJobInstruction.java | 2 +- .../cp/AggregateBinaryCPInstruction.java | 6 +- .../cp/AggregateTernaryCPInstruction.java | 3 +- .../cp/AggregateUnaryCPInstruction.java | 9 +- .../instructions/cp/AppendCPInstruction.java | 6 +- .../cp/ArithmeticBinaryCPInstruction.java | 3 +- .../instructions/cp/BinaryCPInstruction.java | 8 +- .../cp/BooleanBinaryCPInstruction.java | 3 +- .../cp/BooleanUnaryCPInstruction.java | 3 +- .../instructions/cp/BreakPointInstruction.java | 4 +- .../cp/BuiltinBinaryCPInstruction.java | 11 +- .../runtime/instructions/cp/BuiltinNary.java | 74 ---- .../cp/BuiltinNaryCPInstruction.java | 73 ++++ .../cp/BuiltinUnaryCPInstruction.java | 12 +- .../runtime/instructions/cp/CPInstruction.java | 29 +- .../runtime/instructions/cp/CPOperand.java | 19 - .../cp/CentralMomentCPInstruction.java | 7 +- .../cp/CompressionCPInstruction.java | 4 +- .../cp/ComputationCPInstruction.java | 12 +- .../cp/ConvolutionCPInstruction.java | 79 ++--- .../cp/CovarianceCPInstruction.java | 6 +- .../instructions/cp/DataGenCPInstruction.java | 104 ++---- .../cp/DataPartitionCPInstruction.java | 9 +- .../cp/FunctionCallCPInstruction.java | 29 +- .../instructions/cp/IndexingCPInstruction.java | 6 +- .../instructions/cp/MMChainCPInstruction.java | 9 +- .../instructions/cp/MMTSJCPInstruction.java | 7 +- .../cp/MatrixBuiltinCPInstruction.java | 4 +- .../cp/MatrixBuiltinNaryCPInstruction.java | 2 +- .../cp/MatrixMatrixBuiltinCPInstruction.java | 2 +- .../cp/MatrixReshapeCPInstruction.java | 10 +- .../cp/MatrixScalarBuiltinCPInstruction.java | 4 +- .../cp/MultiReturnBuiltinCPInstruction.java | 11 +- ...ReturnParameterizedBuiltinCPInstruction.java | 5 +- .../instructions/cp/PMMJCPInstruction.java | 4 +- .../cp/ParameterizedBuiltinCPInstruction.java | 10 +- .../instructions/cp/PlusMultCPInstruction.java | 6 +- .../cp/QuantilePickCPInstruction.java | 7 +- .../cp/QuantileSortCPInstruction.java | 3 +- .../cp/QuaternaryCPInstruction.java | 7 +- .../cp/RelationalBinaryCPInstruction.java | 3 +- .../instructions/cp/ReorgCPInstruction.java | 21 +- .../cp/ScalarBuiltinCPInstruction.java | 2 +- .../cp/ScalarBuiltinNaryCPInstruction.java | 2 +- .../cp/ScalarMatrixArithmeticCPInstruction.java | 2 +- .../cp/ScalarMatrixRelationalCPInstruction.java | 2 +- .../cp/ScalarScalarBuiltinCPInstruction.java | 2 +- .../instructions/cp/SpoofCPInstruction.java | 2 +- .../cp/StringInitCPInstruction.java | 8 +- .../instructions/cp/TernaryCPInstruction.java | 14 +- .../cp/UaggOuterChainCPInstruction.java | 11 +- .../instructions/cp/UnaryCPInstruction.java | 12 +- .../instructions/cp/VariableCPInstruction.java | 79 ++--- .../instructions/gpu/GPUInstruction.java | 2 +- .../ScalarMatrixArithmeticGPUInstruction.java | 2 +- ...larMatrixRelationalBinaryGPUInstruction.java | 2 +- .../runtime/instructions/mr/MRInstruction.java | 2 +- .../instructions/mr/ScalarInstruction.java | 3 - .../instructions/spark/BinarySPInstruction.java | 2 +- .../instructions/spark/SPInstruction.java | 2 +- .../operators/AggregateBinaryOperator.java | 21 +- .../matrix/operators/AggregateOperator.java | 31 +- .../operators/AggregateTernaryOperator.java | 16 +- .../operators/AggregateUnaryOperator.java | 27 +- .../matrix/operators/BinaryOperator.java | 14 +- .../runtime/matrix/operators/CMOperator.java | 9 +- .../runtime/matrix/operators/COVOperator.java | 10 +- .../matrix/operators/LeftScalarOperator.java | 18 +- .../runtime/matrix/operators/Operator.java | 11 +- .../matrix/operators/QuaternaryOperator.java | 54 +-- .../matrix/operators/ReIndexOperator.java | 6 +- .../runtime/matrix/operators/ReorgOperator.java | 10 +- .../matrix/operators/RightScalarOperator.java | 21 +- .../matrix/operators/ScalarOperator.java | 29 +- .../matrix/operators/SimpleOperator.java | 3 +- .../runtime/matrix/operators/UnaryOperator.java | 27 +- .../matrix/operators/ZeroOutOperator.java | 6 +- .../codegen/CPlanVectorPrimitivesTest.java | 4 +- .../compress/LargeParUnaryAggregateTest.java | 26 +- .../compress/ParUnaryAggregateTest.java | 26 +- .../jmlc/JMLCClonedPreparedScriptTest.java | 57 ++- 90 files changed, 775 insertions(+), 929 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java b/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java index c23ef92..3dc0db7 100644 --- a/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java +++ b/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java @@ -80,7 +80,7 @@ public class PreparedScript private PreparedScript(PreparedScript that) { //shallow copy, except for a separate symbol table //and related meta data of reused inputs - _prog = that._prog; + _prog = that._prog.clone(false); _vars = new LocalVariableMap(); for(Entry<String, Data> e : that._vars.entrySet()) _vars.put(e.getKey(), e.getValue()); http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java b/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java index f3ce99d..33df1d1 100644 --- a/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java +++ b/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java @@ -41,7 +41,7 @@ import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.instructions.MRInstructionParser; import org.apache.sysml.runtime.instructions.MRJobInstruction; import org.apache.sysml.runtime.instructions.cp.CPInstruction; -import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPINSTRUCTION_TYPE; +import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPType; import org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction; import org.apache.sysml.runtime.instructions.cp.VariableCPInstruction; import org.apache.sysml.runtime.instructions.mr.BinaryMRInstructionBase; @@ -789,7 +789,7 @@ public class CostEstimatorStaticRuntime extends CostEstimator //NOTE: all instruction types that are equivalent in CP and MR are only //included in CP to prevent redundancy - CPINSTRUCTION_TYPE cptype = CPInstructionParser.String2CPInstructionType.get(optype); + CPType cptype = CPInstructionParser.String2CPInstructionType.get(optype); if( cptype != null ) //for CP Ops and equivalent MR ops { //general approach: count of floating point *, /, +, -, ^, builtin ; http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/lops/compile/Dag.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/lops/compile/Dag.java b/src/main/java/org/apache/sysml/lops/compile/Dag.java index 4edf230..9306a24 100644 --- a/src/main/java/org/apache/sysml/lops/compile/Dag.java +++ b/src/main/java/org/apache/sysml/lops/compile/Dag.java @@ -67,12 +67,12 @@ import org.apache.sysml.runtime.controlprogram.parfor.ProgramConverter; import org.apache.sysml.runtime.controlprogram.parfor.util.IDSequence; import org.apache.sysml.runtime.instructions.CPInstructionParser; import org.apache.sysml.runtime.instructions.Instruction; -import org.apache.sysml.runtime.instructions.Instruction.INSTRUCTION_TYPE; +import org.apache.sysml.runtime.instructions.Instruction.IType; import org.apache.sysml.runtime.instructions.InstructionParser; import org.apache.sysml.runtime.instructions.MRJobInstruction; import org.apache.sysml.runtime.instructions.SPInstructionParser; import org.apache.sysml.runtime.instructions.cp.CPInstruction; -import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPINSTRUCTION_TYPE; +import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPType; import org.apache.sysml.runtime.instructions.cp.VariableCPInstruction; import org.apache.sysml.runtime.matrix.MatrixCharacteristics; import org.apache.sysml.runtime.matrix.data.InputInfo; @@ -1240,8 +1240,8 @@ public class Dag<N extends Lop> private static void excludeRemoveInstruction(String varName, ArrayList<Instruction> deleteInst) { for(int i=0; i < deleteInst.size(); i++) { Instruction inst = deleteInst.get(i); - if ((inst.getType() == INSTRUCTION_TYPE.CONTROL_PROGRAM || inst.getType() == INSTRUCTION_TYPE.SPARK) - && ((CPInstruction)inst).getCPInstructionType() == CPINSTRUCTION_TYPE.Variable + if ((inst.getType() == IType.CONTROL_PROGRAM || inst.getType() == IType.SPARK) + && ((CPInstruction)inst).getCPInstructionType() == CPType.Variable && ((VariableCPInstruction)inst).isRemoveVariable(varName) ) { deleteInst.remove(i); } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java index 29dfdfd..ec7a16f 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java @@ -42,7 +42,7 @@ public class ForProgramBlock extends ProgramBlock protected ArrayList<Instruction> _incrementInstructions; protected ArrayList <Instruction> _exitInstructions; protected ArrayList<ProgramBlock> _childBlocks; - protected String _iterPredVar; + protected final String _iterPredVar; public ForProgramBlock(Program prog, String iterPredVar) { super(prog); @@ -99,10 +99,6 @@ public class ForProgramBlock extends ProgramBlock return _iterPredVar; } - public void setIterVar(String iterPredVar) { - _iterPredVar = iterPredVar; - } - @Override public void execute(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java b/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java index 3867659..9dd4b9c 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java @@ -23,28 +23,27 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; +import org.apache.commons.lang.NotImplementedException; import org.apache.sysml.parser.DMLProgram; import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.DMLScriptException; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; - public class Program { - public static final String KEY_DELIM = "::"; public ArrayList<ProgramBlock> _programBlocks; private HashMap<String, HashMap<String,FunctionProgramBlock>> _namespaceFunctions; - public Program() throws DMLRuntimeException { - _namespaceFunctions = new HashMap<>(); + public Program() { + _namespaceFunctions = new HashMap<>(); _programBlocks = new ArrayList<>(); } public synchronized void addFunctionProgramBlock(String namespace, String fname, FunctionProgramBlock fpb) - { + { if (namespace == null) namespace = DMLProgram.DEFAULT_NAMESPACE; @@ -128,4 +127,40 @@ public class Program ec.clearDebugProgramCounters(); } + + public Program clone(boolean deep) { + if( deep ) + throw new NotImplementedException(); + Program ret = new Program(); + //shallow copy of all program blocks + ret._programBlocks.addAll(_programBlocks); + //shallow copy of all functions, except external + //functions, which require a deep copy + for( Entry<String, HashMap<String, FunctionProgramBlock>> e1 : _namespaceFunctions.entrySet() ) + for( Entry<String, FunctionProgramBlock> e2 : e1.getValue().entrySet() ) { + FunctionProgramBlock fpb = e2.getValue(); + if( fpb instanceof ExternalFunctionProgramBlock ) + fpb = createPartialDeepCopy(ret, (ExternalFunctionProgramBlock) fpb); + ret.addFunctionProgramBlock(e1.getKey(), e2.getKey(), fpb); + } + return ret; + } + + @Override + public Object clone() { + return clone(true); + } + + private static ExternalFunctionProgramBlock createPartialDeepCopy(Program prog, ExternalFunctionProgramBlock efpb) { + try { + return ( efpb instanceof ExternalFunctionProgramBlockCP ) ? + new ExternalFunctionProgramBlockCP(prog, efpb._inputParams, + efpb._outputParams, efpb._otherParams, efpb._baseDir) : + new ExternalFunctionProgramBlock(prog, efpb._inputParams, + efpb._outputParams, efpb._otherParams, efpb._baseDir); + } + catch(DMLRuntimeException ex) { + throw new RuntimeException(ex); + } + } } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java index 97e1bcd..edd1136 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java @@ -37,10 +37,10 @@ import org.apache.sysml.runtime.instructions.cp.ArithmeticBinaryCPInstruction; import org.apache.sysml.runtime.instructions.cp.BooleanBinaryCPInstruction; import org.apache.sysml.runtime.instructions.cp.BooleanUnaryCPInstruction; import org.apache.sysml.runtime.instructions.cp.BuiltinBinaryCPInstruction; -import org.apache.sysml.runtime.instructions.cp.BuiltinNary; +import org.apache.sysml.runtime.instructions.cp.BuiltinNaryCPInstruction; import org.apache.sysml.runtime.instructions.cp.BuiltinUnaryCPInstruction; import org.apache.sysml.runtime.instructions.cp.CPInstruction; -import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPINSTRUCTION_TYPE; +import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPType; import org.apache.sysml.runtime.instructions.cp.CentralMomentCPInstruction; import org.apache.sysml.runtime.instructions.cp.CompressionCPInstruction; import org.apache.sysml.runtime.instructions.cp.ConvolutionCPInstruction; @@ -73,218 +73,218 @@ import org.apache.sysml.runtime.instructions.cpfile.ParameterizedBuiltinCPFileIn public class CPInstructionParser extends InstructionParser { - public static final HashMap<String, CPINSTRUCTION_TYPE> String2CPInstructionType; - public static final HashMap<String, CPINSTRUCTION_TYPE> String2CPFileInstructionType; + public static final HashMap<String, CPType> String2CPInstructionType; + public static final HashMap<String, CPType> String2CPFileInstructionType; static { String2CPInstructionType = new HashMap<>(); - String2CPInstructionType.put( "ba+*" , CPINSTRUCTION_TYPE.AggregateBinary); - String2CPInstructionType.put( "tak+*" , CPINSTRUCTION_TYPE.AggregateTernary); - String2CPInstructionType.put( "tack+*" , CPINSTRUCTION_TYPE.AggregateTernary); + String2CPInstructionType.put( "ba+*" , CPType.AggregateBinary); + String2CPInstructionType.put( "tak+*" , CPType.AggregateTernary); + String2CPInstructionType.put( "tack+*" , CPType.AggregateTernary); - String2CPInstructionType.put( "uak+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uark+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uack+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uasqk+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uarsqk+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uacsqk+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uamean" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uarmean" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uacmean" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uavar" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uarvar" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uacvar" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uamax" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uarmax" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uarimax", CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uacmax" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uamin" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uarmin" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uarimin" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uacmin" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "ua+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uar+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uac+" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "ua*" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uatrace" , CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "uaktrace", CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "nrow" ,CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "ncol" ,CPINSTRUCTION_TYPE.AggregateUnary); - String2CPInstructionType.put( "length" ,CPINSTRUCTION_TYPE.AggregateUnary); + String2CPInstructionType.put( "uak+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uark+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uack+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uasqk+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uarsqk+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uacsqk+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uamean" , CPType.AggregateUnary); + String2CPInstructionType.put( "uarmean" , CPType.AggregateUnary); + String2CPInstructionType.put( "uacmean" , CPType.AggregateUnary); + String2CPInstructionType.put( "uavar" , CPType.AggregateUnary); + String2CPInstructionType.put( "uarvar" , CPType.AggregateUnary); + String2CPInstructionType.put( "uacvar" , CPType.AggregateUnary); + String2CPInstructionType.put( "uamax" , CPType.AggregateUnary); + String2CPInstructionType.put( "uarmax" , CPType.AggregateUnary); + String2CPInstructionType.put( "uarimax", CPType.AggregateUnary); + String2CPInstructionType.put( "uacmax" , CPType.AggregateUnary); + String2CPInstructionType.put( "uamin" , CPType.AggregateUnary); + String2CPInstructionType.put( "uarmin" , CPType.AggregateUnary); + String2CPInstructionType.put( "uarimin" , CPType.AggregateUnary); + String2CPInstructionType.put( "uacmin" , CPType.AggregateUnary); + String2CPInstructionType.put( "ua+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uar+" , CPType.AggregateUnary); + String2CPInstructionType.put( "uac+" , CPType.AggregateUnary); + String2CPInstructionType.put( "ua*" , CPType.AggregateUnary); + String2CPInstructionType.put( "uatrace" , CPType.AggregateUnary); + String2CPInstructionType.put( "uaktrace", CPType.AggregateUnary); + String2CPInstructionType.put( "nrow" ,CPType.AggregateUnary); + String2CPInstructionType.put( "ncol" ,CPType.AggregateUnary); + String2CPInstructionType.put( "length" ,CPType.AggregateUnary); - String2CPInstructionType.put( "uaggouterchain", CPINSTRUCTION_TYPE.UaggOuterChain); + String2CPInstructionType.put( "uaggouterchain", CPType.UaggOuterChain); // Arithmetic Instruction Opcodes - String2CPInstructionType.put( "+" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "-" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "*" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "/" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "%%" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "%/%" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "^" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "1-*" , CPINSTRUCTION_TYPE.ArithmeticBinary); //special * case - String2CPInstructionType.put( "^2" , CPINSTRUCTION_TYPE.ArithmeticBinary); //special ^ case - String2CPInstructionType.put( "*2" , CPINSTRUCTION_TYPE.ArithmeticBinary); //special * case - String2CPInstructionType.put( "-nz" , CPINSTRUCTION_TYPE.ArithmeticBinary); //special - case - String2CPInstructionType.put( "+*" , CPINSTRUCTION_TYPE.ArithmeticBinary); - String2CPInstructionType.put( "-*" , CPINSTRUCTION_TYPE.ArithmeticBinary); + String2CPInstructionType.put( "+" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "-" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "*" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "/" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "%%" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "%/%" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "^" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "1-*" , CPType.ArithmeticBinary); //special * case + String2CPInstructionType.put( "^2" , CPType.ArithmeticBinary); //special ^ case + String2CPInstructionType.put( "*2" , CPType.ArithmeticBinary); //special * case + String2CPInstructionType.put( "-nz" , CPType.ArithmeticBinary); //special - case + String2CPInstructionType.put( "+*" , CPType.ArithmeticBinary); + String2CPInstructionType.put( "-*" , CPType.ArithmeticBinary); // Boolean Instruction Opcodes - String2CPInstructionType.put( "&&" , CPINSTRUCTION_TYPE.BooleanBinary); - String2CPInstructionType.put( "||" , CPINSTRUCTION_TYPE.BooleanBinary); + String2CPInstructionType.put( "&&" , CPType.BooleanBinary); + String2CPInstructionType.put( "||" , CPType.BooleanBinary); - String2CPInstructionType.put( "!" , CPINSTRUCTION_TYPE.BooleanUnary); + String2CPInstructionType.put( "!" , CPType.BooleanUnary); // Relational Instruction Opcodes - String2CPInstructionType.put( "==" , CPINSTRUCTION_TYPE.RelationalBinary); - String2CPInstructionType.put( "!=" , CPINSTRUCTION_TYPE.RelationalBinary); - String2CPInstructionType.put( "<" , CPINSTRUCTION_TYPE.RelationalBinary); - String2CPInstructionType.put( ">" , CPINSTRUCTION_TYPE.RelationalBinary); - String2CPInstructionType.put( "<=" , CPINSTRUCTION_TYPE.RelationalBinary); - String2CPInstructionType.put( ">=" , CPINSTRUCTION_TYPE.RelationalBinary); + String2CPInstructionType.put( "==" , CPType.RelationalBinary); + String2CPInstructionType.put( "!=" , CPType.RelationalBinary); + String2CPInstructionType.put( "<" , CPType.RelationalBinary); + String2CPInstructionType.put( ">" , CPType.RelationalBinary); + String2CPInstructionType.put( "<=" , CPType.RelationalBinary); + String2CPInstructionType.put( ">=" , CPType.RelationalBinary); // Builtin Instruction Opcodes - String2CPInstructionType.put( "log" , CPINSTRUCTION_TYPE.Builtin); - String2CPInstructionType.put( "log_nz" , CPINSTRUCTION_TYPE.Builtin); + String2CPInstructionType.put( "log" , CPType.Builtin); + String2CPInstructionType.put( "log_nz" , CPType.Builtin); - String2CPInstructionType.put( "max" , CPINSTRUCTION_TYPE.BuiltinBinary); - String2CPInstructionType.put( "min" , CPINSTRUCTION_TYPE.BuiltinBinary); - String2CPInstructionType.put( "solve" , CPINSTRUCTION_TYPE.BuiltinBinary); + String2CPInstructionType.put( "max" , CPType.BuiltinBinary); + String2CPInstructionType.put( "min" , CPType.BuiltinBinary); + String2CPInstructionType.put( "solve" , CPType.BuiltinBinary); - String2CPInstructionType.put( "exp" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "abs" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "sin" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "cos" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "tan" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "sinh" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "cosh" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "tanh" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "asin" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "acos" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "atan" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "sign" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "sqrt" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "plogp" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "print" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "round" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "ceil" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "floor" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "ucumk+", CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "ucum*" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "ucummin", CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "ucummax", CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "stop" , CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "inverse", CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "cholesky",CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "sprop", CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "sigmoid", CPINSTRUCTION_TYPE.BuiltinUnary); - String2CPInstructionType.put( "sel+", CPINSTRUCTION_TYPE.BuiltinUnary); + String2CPInstructionType.put( "exp" , CPType.BuiltinUnary); + String2CPInstructionType.put( "abs" , CPType.BuiltinUnary); + String2CPInstructionType.put( "sin" , CPType.BuiltinUnary); + String2CPInstructionType.put( "cos" , CPType.BuiltinUnary); + String2CPInstructionType.put( "tan" , CPType.BuiltinUnary); + String2CPInstructionType.put( "sinh" , CPType.BuiltinUnary); + String2CPInstructionType.put( "cosh" , CPType.BuiltinUnary); + String2CPInstructionType.put( "tanh" , CPType.BuiltinUnary); + String2CPInstructionType.put( "asin" , CPType.BuiltinUnary); + String2CPInstructionType.put( "acos" , CPType.BuiltinUnary); + String2CPInstructionType.put( "atan" , CPType.BuiltinUnary); + String2CPInstructionType.put( "sign" , CPType.BuiltinUnary); + String2CPInstructionType.put( "sqrt" , CPType.BuiltinUnary); + String2CPInstructionType.put( "plogp" , CPType.BuiltinUnary); + String2CPInstructionType.put( "print" , CPType.BuiltinUnary); + String2CPInstructionType.put( "round" , CPType.BuiltinUnary); + String2CPInstructionType.put( "ceil" , CPType.BuiltinUnary); + String2CPInstructionType.put( "floor" , CPType.BuiltinUnary); + String2CPInstructionType.put( "ucumk+", CPType.BuiltinUnary); + String2CPInstructionType.put( "ucum*" , CPType.BuiltinUnary); + String2CPInstructionType.put( "ucummin", CPType.BuiltinUnary); + String2CPInstructionType.put( "ucummax", CPType.BuiltinUnary); + String2CPInstructionType.put( "stop" , CPType.BuiltinUnary); + String2CPInstructionType.put( "inverse", CPType.BuiltinUnary); + String2CPInstructionType.put( "cholesky",CPType.BuiltinUnary); + String2CPInstructionType.put( "sprop", CPType.BuiltinUnary); + String2CPInstructionType.put( "sigmoid", CPType.BuiltinUnary); + String2CPInstructionType.put( "sel+", CPType.BuiltinUnary); - String2CPInstructionType.put( "printf" , CPINSTRUCTION_TYPE.BuiltinNary); - String2CPInstructionType.put( "cbind" , CPINSTRUCTION_TYPE.BuiltinNary); - String2CPInstructionType.put( "rbind" , CPINSTRUCTION_TYPE.BuiltinNary); + String2CPInstructionType.put( "printf" , CPType.BuiltinNary); + String2CPInstructionType.put( "cbind" , CPType.BuiltinNary); + String2CPInstructionType.put( "rbind" , CPType.BuiltinNary); // Parameterized Builtin Functions - String2CPInstructionType.put( "cdf" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "invcdf" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "groupedagg" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "rmempty" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "replace" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "rexpand" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "toString" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "transformapply",CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "transformdecode",CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "transformcolmap",CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "transformmeta",CPINSTRUCTION_TYPE.ParameterizedBuiltin); - String2CPInstructionType.put( "transformencode",CPINSTRUCTION_TYPE.MultiReturnParameterizedBuiltin); + String2CPInstructionType.put( "cdf" , CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "invcdf" , CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "groupedagg" , CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "rmempty" , CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "replace" , CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "rexpand" , CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "toString" , CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "transformapply",CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "transformdecode",CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "transformcolmap",CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "transformmeta",CPType.ParameterizedBuiltin); + String2CPInstructionType.put( "transformencode",CPType.MultiReturnParameterizedBuiltin); // Variable Instruction Opcodes - String2CPInstructionType.put( "assignvar" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "cpvar" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "mvvar" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "rmvar" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "rmfilevar" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( UnaryCP.CAST_AS_SCALAR_OPCODE, CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( UnaryCP.CAST_AS_MATRIX_OPCODE, CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( UnaryCP.CAST_AS_FRAME_OPCODE, CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( UnaryCP.CAST_AS_DOUBLE_OPCODE, CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( UnaryCP.CAST_AS_INT_OPCODE, CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( UnaryCP.CAST_AS_BOOLEAN_OPCODE, CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "attachfiletovar" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "read" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "write" , CPINSTRUCTION_TYPE.Variable); - String2CPInstructionType.put( "createvar" , CPINSTRUCTION_TYPE.Variable); + String2CPInstructionType.put( "assignvar" , CPType.Variable); + String2CPInstructionType.put( "cpvar" , CPType.Variable); + String2CPInstructionType.put( "mvvar" , CPType.Variable); + String2CPInstructionType.put( "rmvar" , CPType.Variable); + String2CPInstructionType.put( "rmfilevar" , CPType.Variable); + String2CPInstructionType.put( UnaryCP.CAST_AS_SCALAR_OPCODE, CPType.Variable); + String2CPInstructionType.put( UnaryCP.CAST_AS_MATRIX_OPCODE, CPType.Variable); + String2CPInstructionType.put( UnaryCP.CAST_AS_FRAME_OPCODE, CPType.Variable); + String2CPInstructionType.put( UnaryCP.CAST_AS_DOUBLE_OPCODE, CPType.Variable); + String2CPInstructionType.put( UnaryCP.CAST_AS_INT_OPCODE, CPType.Variable); + String2CPInstructionType.put( UnaryCP.CAST_AS_BOOLEAN_OPCODE, CPType.Variable); + String2CPInstructionType.put( "attachfiletovar" , CPType.Variable); + String2CPInstructionType.put( "read" , CPType.Variable); + String2CPInstructionType.put( "write" , CPType.Variable); + String2CPInstructionType.put( "createvar" , CPType.Variable); // Reorg Instruction Opcodes (repositioning of existing values) - String2CPInstructionType.put( "r'" , CPINSTRUCTION_TYPE.Reorg); - String2CPInstructionType.put( "rev" , CPINSTRUCTION_TYPE.Reorg); - String2CPInstructionType.put( "rdiag" , CPINSTRUCTION_TYPE.Reorg); - String2CPInstructionType.put( "rshape" , CPINSTRUCTION_TYPE.MatrixReshape); - String2CPInstructionType.put( "rsort" , CPINSTRUCTION_TYPE.Reorg); + String2CPInstructionType.put( "r'" , CPType.Reorg); + String2CPInstructionType.put( "rev" , CPType.Reorg); + String2CPInstructionType.put( "rdiag" , CPType.Reorg); + String2CPInstructionType.put( "rshape" , CPType.MatrixReshape); + String2CPInstructionType.put( "rsort" , CPType.Reorg); // Opcodes related to convolutions - String2CPInstructionType.put( "relu_backward" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "relu_maxpooling" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "relu_maxpooling_backward" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "maxpooling" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "maxpooling_backward" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "conv2d" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "conv2d_bias_add" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "conv2d_backward_filter" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "conv2d_backward_data" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "bias_add" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "bias_multiply" , CPINSTRUCTION_TYPE.Convolution); - String2CPInstructionType.put( "channel_sums" , CPINSTRUCTION_TYPE.Convolution); + String2CPInstructionType.put( "relu_backward" , CPType.Convolution); + String2CPInstructionType.put( "relu_maxpooling" , CPType.Convolution); + String2CPInstructionType.put( "relu_maxpooling_backward" , CPType.Convolution); + String2CPInstructionType.put( "maxpooling" , CPType.Convolution); + String2CPInstructionType.put( "maxpooling_backward" , CPType.Convolution); + String2CPInstructionType.put( "conv2d" , CPType.Convolution); + String2CPInstructionType.put( "conv2d_bias_add" , CPType.Convolution); + String2CPInstructionType.put( "conv2d_backward_filter" , CPType.Convolution); + String2CPInstructionType.put( "conv2d_backward_data" , CPType.Convolution); + String2CPInstructionType.put( "bias_add" , CPType.Convolution); + String2CPInstructionType.put( "bias_multiply" , CPType.Convolution); + String2CPInstructionType.put( "channel_sums" , CPType.Convolution); // Quaternary instruction opcodes - String2CPInstructionType.put( "wsloss" , CPINSTRUCTION_TYPE.Quaternary); - String2CPInstructionType.put( "wsigmoid", CPINSTRUCTION_TYPE.Quaternary); - String2CPInstructionType.put( "wdivmm" , CPINSTRUCTION_TYPE.Quaternary); - String2CPInstructionType.put( "wcemm" , CPINSTRUCTION_TYPE.Quaternary); - String2CPInstructionType.put( "wumm" , CPINSTRUCTION_TYPE.Quaternary); + String2CPInstructionType.put( "wsloss" , CPType.Quaternary); + String2CPInstructionType.put( "wsigmoid", CPType.Quaternary); + String2CPInstructionType.put( "wdivmm" , CPType.Quaternary); + String2CPInstructionType.put( "wcemm" , CPType.Quaternary); + String2CPInstructionType.put( "wumm" , CPType.Quaternary); // User-defined function Opcodes - String2CPInstructionType.put( "extfunct" , CPINSTRUCTION_TYPE.External); + String2CPInstructionType.put( "extfunct" , CPType.External); - String2CPInstructionType.put( Append.OPCODE, CPINSTRUCTION_TYPE.Append); + String2CPInstructionType.put( Append.OPCODE, CPType.Append); // data generation opcodes - String2CPInstructionType.put( DataGen.RAND_OPCODE , CPINSTRUCTION_TYPE.Rand); - String2CPInstructionType.put( DataGen.SEQ_OPCODE , CPINSTRUCTION_TYPE.Rand); - String2CPInstructionType.put( DataGen.SINIT_OPCODE , CPINSTRUCTION_TYPE.StringInit); - String2CPInstructionType.put( DataGen.SAMPLE_OPCODE , CPINSTRUCTION_TYPE.Rand); + String2CPInstructionType.put( DataGen.RAND_OPCODE , CPType.Rand); + String2CPInstructionType.put( DataGen.SEQ_OPCODE , CPType.Rand); + String2CPInstructionType.put( DataGen.SINIT_OPCODE , CPType.StringInit); + String2CPInstructionType.put( DataGen.SAMPLE_OPCODE , CPType.Rand); - String2CPInstructionType.put( "ctable", CPINSTRUCTION_TYPE.Ternary); - String2CPInstructionType.put( "ctableexpand", CPINSTRUCTION_TYPE.Ternary); + String2CPInstructionType.put( "ctable", CPType.Ternary); + String2CPInstructionType.put( "ctableexpand", CPType.Ternary); //central moment, covariance, quantiles (sort/pick) - String2CPInstructionType.put( "cm" , CPINSTRUCTION_TYPE.CentralMoment); - String2CPInstructionType.put( "cov" , CPINSTRUCTION_TYPE.Covariance); - String2CPInstructionType.put( "qsort" , CPINSTRUCTION_TYPE.QSort); - String2CPInstructionType.put( "qpick" , CPINSTRUCTION_TYPE.QPick); + String2CPInstructionType.put( "cm" , CPType.CentralMoment); + String2CPInstructionType.put( "cov" , CPType.Covariance); + String2CPInstructionType.put( "qsort" , CPType.QSort); + String2CPInstructionType.put( "qpick" , CPType.QPick); - String2CPInstructionType.put( RightIndex.OPCODE, CPINSTRUCTION_TYPE.MatrixIndexing); - String2CPInstructionType.put( LeftIndex.OPCODE, CPINSTRUCTION_TYPE.MatrixIndexing); + String2CPInstructionType.put( RightIndex.OPCODE, CPType.MatrixIndexing); + String2CPInstructionType.put( LeftIndex.OPCODE, CPType.MatrixIndexing); - String2CPInstructionType.put( "tsmm" , CPINSTRUCTION_TYPE.MMTSJ); - String2CPInstructionType.put( "pmm" , CPINSTRUCTION_TYPE.PMMJ); - String2CPInstructionType.put( "mmchain" , CPINSTRUCTION_TYPE.MMChain); + String2CPInstructionType.put( "tsmm" , CPType.MMTSJ); + String2CPInstructionType.put( "pmm" , CPType.PMMJ); + String2CPInstructionType.put( "mmchain" , CPType.MMChain); - String2CPInstructionType.put( "qr", CPINSTRUCTION_TYPE.MultiReturnBuiltin); - String2CPInstructionType.put( "lu", CPINSTRUCTION_TYPE.MultiReturnBuiltin); - String2CPInstructionType.put( "eigen", CPINSTRUCTION_TYPE.MultiReturnBuiltin); - String2CPInstructionType.put( "svd", CPINSTRUCTION_TYPE.MultiReturnBuiltin); + String2CPInstructionType.put( "qr", CPType.MultiReturnBuiltin); + String2CPInstructionType.put( "lu", CPType.MultiReturnBuiltin); + String2CPInstructionType.put( "eigen", CPType.MultiReturnBuiltin); + String2CPInstructionType.put( "svd", CPType.MultiReturnBuiltin); - String2CPInstructionType.put( "partition", CPINSTRUCTION_TYPE.Partition); - String2CPInstructionType.put( "compress", CPINSTRUCTION_TYPE.Compression); - String2CPInstructionType.put( "spoof", CPINSTRUCTION_TYPE.SpoofFused); + String2CPInstructionType.put( "partition", CPType.Partition); + String2CPInstructionType.put( "compress", CPType.Compression); + String2CPInstructionType.put( "spoof", CPType.SpoofFused); //CP FILE instruction String2CPFileInstructionType = new HashMap<>(); - String2CPFileInstructionType.put( "rmempty" , CPINSTRUCTION_TYPE.ParameterizedBuiltin); + String2CPFileInstructionType.put( "rmempty" , CPType.ParameterizedBuiltin); } public static CPInstruction parseSingleInstruction (String str ) @@ -293,7 +293,7 @@ public class CPInstructionParser extends InstructionParser if ( str == null || str.isEmpty() ) return null; - CPINSTRUCTION_TYPE cptype = InstructionUtils.getCPType(str); + CPType cptype = InstructionUtils.getCPType(str); if ( cptype == null ) throw new DMLRuntimeException("Unable derive cptype for instruction: " + str); CPInstruction cpinst = parseSingleInstruction(cptype, str); @@ -302,7 +302,7 @@ public class CPInstructionParser extends InstructionParser return cpinst; } - public static CPInstruction parseSingleInstruction ( CPINSTRUCTION_TYPE cptype, String str ) + public static CPInstruction parseSingleInstruction ( CPType cptype, String str ) throws DMLRuntimeException { ExecType execType = null; @@ -347,7 +347,7 @@ public class CPInstructionParser extends InstructionParser return BuiltinUnaryCPInstruction.parseInstruction(str); case BuiltinNary: - return BuiltinNary.parseInstruction(str); + return BuiltinNaryCPInstruction.parseInstruction(str); case Reorg: return ReorgCPInstruction.parseInstruction(str); http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java b/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java index 5583b61..1171e80 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java @@ -30,7 +30,7 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; public abstract class Instruction { - public enum INSTRUCTION_TYPE { + public enum IType { CONTROL_PROGRAM, MAPREDUCE, MAPREDUCE_JOB, @@ -50,7 +50,7 @@ public abstract class Instruction public static final String GPU_INST_PREFIX = "gpu_"; //basic instruction meta data - protected INSTRUCTION_TYPE type = null; + protected IType type = null; protected String instString = null; protected String instOpcode = null; private String extendedOpcode = null; @@ -83,11 +83,11 @@ public abstract class Instruction return endCol; } - public void setType (INSTRUCTION_TYPE tp ) { + public void setType (IType tp ) { type = tp; } - public INSTRUCTION_TYPE getType() { + public IType getType() { return type; } @@ -179,18 +179,18 @@ public abstract class Instruction scriptInfo = " [" + filename + " " + beginLine + ":" + beginCol + "-" + endLine + ":" + endCol + "]"; else scriptInfo = " [" + beginLine + ":" + beginCol + "-" + endLine + ":" + endCol + "]"; - if( type == INSTRUCTION_TYPE.SPARK ) + if( type == IType.SPARK ) extendedOpcode = SP_INST_PREFIX + getOpcode() + scriptInfo; - else if( type == INSTRUCTION_TYPE.GPU ) + else if( type == IType.GPU ) extendedOpcode = GPU_INST_PREFIX + getOpcode() + scriptInfo; else extendedOpcode = getOpcode() + scriptInfo; } else { // This ensures that there is no overhead if finegrained statistics is disabled - if( type == INSTRUCTION_TYPE.SPARK ) + if( type == IType.SPARK ) extendedOpcode = SP_INST_PREFIX + getOpcode(); - else if( type == INSTRUCTION_TYPE.GPU ) + else if( type == IType.GPU ) extendedOpcode = GPU_INST_PREFIX + getOpcode(); else extendedOpcode = getOpcode(); http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java index 251d37d..b38ccff 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java @@ -21,7 +21,7 @@ package org.apache.sysml.runtime.instructions; import org.apache.sysml.lops.LopProperties.ExecType; import org.apache.sysml.runtime.DMLRuntimeException; -import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPINSTRUCTION_TYPE; +import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPType; import org.apache.sysml.runtime.instructions.gpu.GPUInstruction.GPUINSTRUCTION_TYPE; import org.apache.sysml.runtime.instructions.mr.MRInstruction.MRINSTRUCTION_TYPE; import org.apache.sysml.runtime.instructions.spark.SPInstruction.SPINSTRUCTION_TYPE; @@ -39,7 +39,7 @@ public class InstructionParser if ( execType.equalsIgnoreCase(ExecType.CP.toString()) || execType.equalsIgnoreCase(ExecType.CP_FILE.toString()) ) { - CPINSTRUCTION_TYPE cptype = InstructionUtils.getCPType(str); + CPType cptype = InstructionUtils.getCPType(str); if( cptype == null ) throw new DMLRuntimeException("Unknown CP instruction: " + str); return CPInstructionParser.parseSingleInstruction (cptype, str); http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java b/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java index 2a990d4..c564e67 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java @@ -72,7 +72,7 @@ import org.apache.sysml.runtime.functionobjects.ReduceAll; import org.apache.sysml.runtime.functionobjects.ReduceCol; import org.apache.sysml.runtime.functionobjects.ReduceDiag; import org.apache.sysml.runtime.functionobjects.ReduceRow; -import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPINSTRUCTION_TYPE; +import org.apache.sysml.runtime.instructions.cp.CPInstruction.CPType; import org.apache.sysml.runtime.instructions.gpu.GPUInstruction.GPUINSTRUCTION_TYPE; import org.apache.sysml.runtime.instructions.mr.MRInstruction.MRINSTRUCTION_TYPE; import org.apache.sysml.runtime.instructions.spark.SPInstruction.SPINSTRUCTION_TYPE; @@ -202,7 +202,7 @@ public class InstructionUtils return SPInstructionParser.String2SPInstructionType.get( getOpCode(str) ); } - public static CPINSTRUCTION_TYPE getCPType( String str ) { + public static CPType getCPType( String str ) { return CPInstructionParser.String2CPInstructionType.get( getOpCode(str) ); } @@ -244,131 +244,135 @@ public class InstructionUtils return false; } - public static AggregateUnaryOperator parseBasicAggregateUnaryOperator(String opcode) + public static AggregateUnaryOperator parseBasicAggregateUnaryOperator(String opcode) { + return parseBasicAggregateUnaryOperator(opcode, 1); + } + + public static AggregateUnaryOperator parseBasicAggregateUnaryOperator(String opcode, int numThreads) { AggregateUnaryOperator aggun = null; if ( opcode.equalsIgnoreCase("uak+") ) { AggregateOperator agg = new AggregateOperator(0, KahanPlus.getKahanPlusFnObject(), true, CorrectionLocationType.LASTCOLUMN); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uark+") ) { // RowSums AggregateOperator agg = new AggregateOperator(0, KahanPlus.getKahanPlusFnObject(), true, CorrectionLocationType.LASTCOLUMN); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uack+") ) { // ColSums AggregateOperator agg = new AggregateOperator(0, KahanPlus.getKahanPlusFnObject(), true, CorrectionLocationType.LASTROW); - aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uasqk+") ) { AggregateOperator agg = new AggregateOperator(0, KahanPlusSq.getKahanPlusSqFnObject(), true, CorrectionLocationType.LASTCOLUMN); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uarsqk+") ) { // RowSums AggregateOperator agg = new AggregateOperator(0, KahanPlusSq.getKahanPlusSqFnObject(), true, CorrectionLocationType.LASTCOLUMN); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uacsqk+") ) { // ColSums AggregateOperator agg = new AggregateOperator(0, KahanPlusSq.getKahanPlusSqFnObject(), true, CorrectionLocationType.LASTROW); - aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uamean") ) { // Mean AggregateOperator agg = new AggregateOperator(0, Mean.getMeanFnObject(), true, CorrectionLocationType.LASTTWOCOLUMNS); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uarmean") ) { // RowMeans AggregateOperator agg = new AggregateOperator(0, Mean.getMeanFnObject(), true, CorrectionLocationType.LASTTWOCOLUMNS); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uacmean") ) { // ColMeans AggregateOperator agg = new AggregateOperator(0, Mean.getMeanFnObject(), true, CorrectionLocationType.LASTTWOROWS); - aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uavar") ) { // Variance CM varFn = CM.getCMFnObject(AggregateOperationTypes.VARIANCE); CorrectionLocationType cloc = CorrectionLocationType.LASTFOURCOLUMNS; AggregateOperator agg = new AggregateOperator(0, varFn, true, cloc); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uarvar") ) { // RowVariances CM varFn = CM.getCMFnObject(AggregateOperationTypes.VARIANCE); CorrectionLocationType cloc = CorrectionLocationType.LASTFOURCOLUMNS; AggregateOperator agg = new AggregateOperator(0, varFn, true, cloc); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uacvar") ) { // ColVariances CM varFn = CM.getCMFnObject(AggregateOperationTypes.VARIANCE); CorrectionLocationType cloc = CorrectionLocationType.LASTFOURROWS; AggregateOperator agg = new AggregateOperator(0, varFn, true, cloc); - aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("ua+") ) { AggregateOperator agg = new AggregateOperator(0, Plus.getPlusFnObject()); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uar+") ) { // RowSums AggregateOperator agg = new AggregateOperator(0, Plus.getPlusFnObject()); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uac+") ) { // ColSums AggregateOperator agg = new AggregateOperator(0, Plus.getPlusFnObject()); - aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("ua*") ) { AggregateOperator agg = new AggregateOperator(1, Multiply.getMultiplyFnObject()); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uamax") ) { AggregateOperator agg = new AggregateOperator(-Double.MAX_VALUE, Builtin.getBuiltinFnObject("max")); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uamin") ) { AggregateOperator agg = new AggregateOperator(Double.MAX_VALUE, Builtin.getBuiltinFnObject("min")); - aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceAll.getReduceAllFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uatrace") ) { AggregateOperator agg = new AggregateOperator(0, Plus.getPlusFnObject()); - aggun = new AggregateUnaryOperator(agg, ReduceDiag.getReduceDiagFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceDiag.getReduceDiagFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uaktrace") ) { AggregateOperator agg = new AggregateOperator(0, KahanPlus.getKahanPlusFnObject(), true, CorrectionLocationType.LASTCOLUMN); - aggun = new AggregateUnaryOperator(agg, ReduceDiag.getReduceDiagFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceDiag.getReduceDiagFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uarmax") ) { AggregateOperator agg = new AggregateOperator(-Double.MAX_VALUE, Builtin.getBuiltinFnObject("max")); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if (opcode.equalsIgnoreCase("uarimax") ) { AggregateOperator agg = new AggregateOperator(-Double.MAX_VALUE, Builtin.getBuiltinFnObject("maxindex"), true, CorrectionLocationType.LASTCOLUMN); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uarmin") ) { AggregateOperator agg = new AggregateOperator(Double.MAX_VALUE, Builtin.getBuiltinFnObject("min")); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if (opcode.equalsIgnoreCase("uarimin") ) { AggregateOperator agg = new AggregateOperator(Double.MAX_VALUE, Builtin.getBuiltinFnObject("minindex"), true, CorrectionLocationType.LASTCOLUMN); - aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceCol.getReduceColFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uacmax") ) { AggregateOperator agg = new AggregateOperator(-Double.MAX_VALUE, Builtin.getBuiltinFnObject("max")); - aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject(), numThreads); } else if ( opcode.equalsIgnoreCase("uacmin") ) { AggregateOperator agg = new AggregateOperator(Double.MAX_VALUE, Builtin.getBuiltinFnObject("min")); - aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject()); + aggun = new AggregateUnaryOperator(agg, ReduceRow.getReduceRowFnObject(), numThreads); } return aggun; http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java index eceebba..88a309d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java @@ -127,7 +127,7 @@ public class MRJobInstruction extends Instruction public MRJobInstruction(JobType type) { - setType(Instruction.INSTRUCTION_TYPE.MAPREDUCE_JOB); + setType(Instruction.IType.MAPREDUCE_JOB); jobType = type; instOpcode = "MR-Job_"+getJobType(); } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java index 100384f..4f542d6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java @@ -34,10 +34,8 @@ import org.apache.sysml.runtime.matrix.operators.Operator; public class AggregateBinaryCPInstruction extends BinaryCPInstruction { - private AggregateBinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, - String istr) { - super(op, in1, in2, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.AggregateBinary; + private AggregateBinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { + super(CPType.AggregateBinary, op, in1, in2, out, opcode, istr); } public static AggregateBinaryCPInstruction parseInstruction( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java index a5cd372..c087016 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java @@ -30,8 +30,7 @@ public class AggregateTernaryCPInstruction extends ComputationCPInstruction { private AggregateTernaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, String istr) { - super(op, in1, in2, in3, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.AggregateTernary; + super(CPType.AggregateTernary, op, in1, in2, in3, out, opcode, istr); } public static AggregateTernaryCPInstruction parseInstruction( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java index 8a26e25..132ec0a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java @@ -43,8 +43,7 @@ public class AggregateUnaryCPInstruction extends UnaryCPInstruction { protected AggregateUnaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, String istr) { - super(op, in1, in2, in3, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.AggregateUnary; + super(CPType.AggregateUnary, op, in1, in2, in3, out, opcode, istr); } public static AggregateUnaryCPInstruction parseInstruction(String str) @@ -61,9 +60,9 @@ public class AggregateUnaryCPInstruction extends UnaryCPInstruction { } else //DEFAULT BEHAVIOR { - AggregateUnaryOperator aggun = InstructionUtils.parseBasicAggregateUnaryOperator(opcode); - aggun.setNumThreads( Integer.parseInt(parts[3]) ); - return new AggregateUnaryCPInstruction(aggun, in1, out, opcode, str); + AggregateUnaryOperator aggun = InstructionUtils + .parseBasicAggregateUnaryOperator(opcode, Integer.parseInt(parts[3])); + return new AggregateUnaryCPInstruction(aggun, in1, out, opcode, str); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java index 74b2d6d..1754024 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java @@ -36,13 +36,11 @@ public abstract class AppendCPInstruction extends BinaryCPInstruction } //type (matrix cbind / scalar string concatenation) - protected AppendType _type; + protected final AppendType _type; protected AppendCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, AppendType type, String opcode, String istr) { - super(op, in1, in2, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.Append; - + super(CPType.Append, op, in1, in2, out, opcode, istr); _type = type; } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java index 5507393..ade199a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java @@ -30,8 +30,7 @@ public abstract class ArithmeticBinaryCPInstruction extends BinaryCPInstruction protected ArithmeticBinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { - super(op, in1, in2, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.ArithmeticBinary; + super(CPType.ArithmeticBinary, op, in1, in2, out, opcode, istr); } public static ArithmeticBinaryCPInstruction parseInstruction ( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java index 9c3470c..7d7382b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java @@ -26,14 +26,14 @@ import org.apache.sysml.runtime.matrix.operators.Operator; public abstract class BinaryCPInstruction extends ComputationCPInstruction { - protected BinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + protected BinaryCPInstruction(CPType type, Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { - super(op, in1, in2, out, opcode, istr); + super(type, op, in1, in2, out, opcode, istr); } - protected BinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + protected BinaryCPInstruction(CPType type, Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, String istr) { - super(op, in1, in2, in3, out, opcode, istr); + super(type, op, in1, in2, in3, out, opcode, istr); } protected static String parseBinaryInstruction(String instr, CPOperand in1, CPOperand in2, CPOperand out) http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java index 230ecea..9560470 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java @@ -31,8 +31,7 @@ public class BooleanBinaryCPInstruction extends BinaryCPInstruction { private BooleanBinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { - super(op, in1, in2, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.BooleanBinary; + super(CPType.BooleanBinary, op, in1, in2, out, opcode, istr); } public static BooleanBinaryCPInstruction parseInstruction (String str) http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java index 9143179..e8d31c1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java @@ -29,8 +29,7 @@ import org.apache.sysml.runtime.matrix.operators.SimpleOperator; public class BooleanUnaryCPInstruction extends UnaryCPInstruction { private BooleanUnaryCPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String instr) { - super(op, in, out, opcode, instr); - _cptype = CPINSTRUCTION_TYPE.BooleanUnary; + super(CPType.BooleanUnary, op, in, out, opcode, instr); } public static BooleanUnaryCPInstruction parseInstruction (String str) http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java index 235a6f2..72dfd7e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java @@ -43,7 +43,7 @@ public class BreakPointInstruction extends Instruction * Constructor for a breakpoint instruction */ public BreakPointInstruction() { - type = INSTRUCTION_TYPE.BREAKPOINT; + type = IType.BREAKPOINT; bpStatus = BPINSTRUCTION_STATUS.ENABLED; } @@ -53,7 +53,7 @@ public class BreakPointInstruction extends Instruction * @param status Breakpoint instruction status */ public BreakPointInstruction(BPINSTRUCTION_STATUS status) { - type = INSTRUCTION_TYPE.BREAKPOINT; + type = IType.BREAKPOINT; bpStatus = status; } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java index 4f83714..eca6e94 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java @@ -29,19 +29,12 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.RightScalarOperator; public abstract class BuiltinBinaryCPInstruction extends BinaryCPInstruction { - private int _arity; - protected BuiltinBinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, int arity, + protected BuiltinBinaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { - super(op, in1, in2, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.BuiltinBinary; - _arity = arity; + super(CPType.BuiltinBinary, op, in1, in2, out, opcode, istr); } - public int getArity() { - return _arity; - } - public static BuiltinBinaryCPInstruction parseInstruction ( String str ) throws DMLRuntimeException { CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNary.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNary.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNary.java deleted file mode 100644 index 1bacc70..0000000 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNary.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.sysml.runtime.instructions.cp; - -import org.apache.sysml.lops.Nary; -import org.apache.sysml.runtime.DMLRuntimeException; -import org.apache.sysml.runtime.functionobjects.Builtin; -import org.apache.sysml.runtime.functionobjects.ValueFunction; -import org.apache.sysml.runtime.instructions.InstructionUtils; -import org.apache.sysml.runtime.matrix.operators.Operator; -import org.apache.sysml.runtime.matrix.operators.SimpleOperator; - -/** - * Instruction to handle a variable number of input operands. It parses an - * instruction string to generate an object that is a subclass of - * BuiltinMultipleCPInstruction. Currently the only subclass of - * BuiltinMultipleCPInstruction is ScalarBuiltinMultipleCPInstruction. The - * ScalarBuiltinMultipleCPInstruction class is responsible for printf-style - * Java-based string formatting. - * - */ -public abstract class BuiltinNary extends CPInstruction -{ - public CPOperand output; - public CPOperand[] inputs; - - public BuiltinNary(Operator op, String opcode, String istr, CPOperand output, CPOperand... inputs) { - super(op, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.BuiltinNary; - this.output = output; - this.inputs = inputs; - } - - public static BuiltinNary parseInstruction(String str) throws DMLRuntimeException { - String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); - String opcode = parts[0]; - CPOperand outputOperand = new CPOperand(parts[parts.length - 1]); - CPOperand[] inputOperands = null; - if (parts.length > 2) { - inputOperands = new CPOperand[parts.length - 2]; - for (int i = 1; i < parts.length-1; i++) - inputOperands[i-1] = new CPOperand(parts[i]); - } - - if( Nary.OperationType.PRINTF.name().equalsIgnoreCase(opcode) ) { - ValueFunction func = Builtin.getBuiltinFnObject(opcode); - return new ScalarBuiltinNaryCPInstruction(new SimpleOperator(func), - opcode, str, outputOperand, inputOperands); - } - else if( opcode.equals("cbind") || opcode.equals("rbind") ) { - return new MatrixBuiltinNaryCPInstruction(null, - opcode, str, outputOperand, inputOperands); - } - - throw new DMLRuntimeException("Opcode (" + opcode + ") not recognized in BuiltinMultipleCPInstruction"); - } -} http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java new file mode 100644 index 0000000..1ed6055 --- /dev/null +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.sysml.runtime.instructions.cp; + +import org.apache.sysml.lops.Nary; +import org.apache.sysml.runtime.DMLRuntimeException; +import org.apache.sysml.runtime.functionobjects.Builtin; +import org.apache.sysml.runtime.functionobjects.ValueFunction; +import org.apache.sysml.runtime.instructions.InstructionUtils; +import org.apache.sysml.runtime.matrix.operators.Operator; +import org.apache.sysml.runtime.matrix.operators.SimpleOperator; + +/** + * Instruction to handle a variable number of input operands. It parses an + * instruction string to generate an object that is a subclass of + * BuiltinMultipleCPInstruction. Currently the only subclass of + * BuiltinMultipleCPInstruction is ScalarBuiltinMultipleCPInstruction. The + * ScalarBuiltinMultipleCPInstruction class is responsible for printf-style + * Java-based string formatting. + * + */ +public abstract class BuiltinNaryCPInstruction extends CPInstruction +{ + protected final CPOperand output; + protected final CPOperand[] inputs; + + public BuiltinNaryCPInstruction(Operator op, String opcode, String istr, CPOperand output, CPOperand... inputs) { + super(CPType.BuiltinNary, op, opcode, istr); + this.output = output; + this.inputs = inputs; + } + + public static BuiltinNaryCPInstruction parseInstruction(String str) throws DMLRuntimeException { + String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); + String opcode = parts[0]; + CPOperand outputOperand = new CPOperand(parts[parts.length - 1]); + CPOperand[] inputOperands = null; + if (parts.length > 2) { + inputOperands = new CPOperand[parts.length - 2]; + for (int i = 1; i < parts.length-1; i++) + inputOperands[i-1] = new CPOperand(parts[i]); + } + + if( Nary.OperationType.PRINTF.name().equalsIgnoreCase(opcode) ) { + ValueFunction func = Builtin.getBuiltinFnObject(opcode); + return new ScalarBuiltinNaryCPInstruction(new SimpleOperator(func), + opcode, str, outputOperand, inputOperands); + } + else if( opcode.equals("cbind") || opcode.equals("rbind") ) { + return new MatrixBuiltinNaryCPInstruction(null, + opcode, str, outputOperand, inputOperands); + } + + throw new DMLRuntimeException("Opcode (" + opcode + ") not recognized in BuiltinMultipleCPInstruction"); + } +} http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java index 42db461..6b055a4 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java @@ -33,19 +33,11 @@ import org.apache.sysml.runtime.matrix.operators.UnaryOperator; public abstract class BuiltinUnaryCPInstruction extends UnaryCPInstruction { - int arity; - - protected BuiltinUnaryCPInstruction(Operator op, CPOperand in, CPOperand out, int _arity, String opcode, + protected BuiltinUnaryCPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { - super(op, in, out, opcode, istr); - _cptype = CPINSTRUCTION_TYPE.BuiltinUnary; - arity = _arity; + super(CPType.BuiltinUnary, op, in, out, opcode, istr); } - public int getArity() { - return arity; - } - public static BuiltinUnaryCPInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/CPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/CPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/CPInstruction.java index d7fc623..0b27768 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/CPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/CPInstruction.java @@ -29,7 +29,7 @@ import org.apache.sysml.runtime.matrix.operators.Operator; public abstract class CPInstruction extends Instruction { - public enum CPINSTRUCTION_TYPE { INVALID, + public enum CPType { INVALID, AggregateUnary, AggregateBinary, AggregateTernary, ArithmeticBinary, Ternary, Quaternary, BooleanBinary, BooleanUnary, BuiltinBinary, BuiltinUnary, BuiltinNary, MultiReturnParameterizedBuiltin, ParameterizedBuiltin, MultiReturnBuiltin, @@ -37,10 +37,9 @@ public abstract class CPInstruction extends Instruction MatrixIndexing, MMTSJ, PMMJ, MMChain, MatrixReshape, Partition, Compression, SpoofFused, StringInit, CentralMoment, Covariance, UaggOuterChain, Convolution } - protected CPINSTRUCTION_TYPE _cptype; - protected Operator _optr; - - protected boolean _requiresLabelUpdate = false; + protected final CPType _cptype; + protected final Operator _optr; + protected final boolean _requiresLabelUpdate; // Generic miscellaneous timers that are applicable to all CP (and few SP) instructions public final static String MISC_TIMER_GET_SPARSE_MB = "aqrs"; // time spent in bringing input sparse matrix block @@ -59,8 +58,14 @@ public abstract class CPInstruction extends Instruction public final static String MISC_TIMER_CSR_LIX_COPY = "csrlix";// time spent in CSR-specific method to address performance issues due to repeated re-shifting on update-in-place. public final static String MISC_TIMER_LIX_COPY = "lixcp";// time spent in range copy - protected CPInstruction(String opcode, String istr) { - type = INSTRUCTION_TYPE.CONTROL_PROGRAM; + protected CPInstruction(CPType type, String opcode, String istr) { + this(type, null, opcode, istr); + } + + protected CPInstruction(CPType type, Operator op, String opcode, String istr) { + _cptype = type; + _optr = op; + super.type = IType.CONTROL_PROGRAM; instString = istr; // prepare opcode and update requirement for repeated usage @@ -68,18 +73,12 @@ public abstract class CPInstruction extends Instruction _requiresLabelUpdate = super.requiresLabelUpdate(); } - protected CPInstruction(Operator op, String opcode, String istr) { - this(opcode, istr); - _optr = op; - } - - public CPINSTRUCTION_TYPE getCPInstructionType() { + public CPType getCPInstructionType() { return _cptype; } @Override - public boolean requiresLabelUpdate() - { + public boolean requiresLabelUpdate() { return _requiresLabelUpdate; } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/CPOperand.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/CPOperand.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/CPOperand.java index 6fb5753..c39b617 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/CPOperand.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/CPOperand.java @@ -28,7 +28,6 @@ import org.apache.sysml.runtime.instructions.Instruction; public class CPOperand { - private String _name; private ValueType _valueType; private DataType _dataType; @@ -73,18 +72,6 @@ public class CPOperand public void setName(String name) { _name = name; } - - public void setValueType(ValueType vt) { - _valueType = vt; - } - - public void setDataType(DataType dt) { - _dataType = dt; - } - - public void setLiteral(boolean literal) { - _isLiteral = literal; - } public void split(String str){ String[] opr = str.split(Instruction.VALUETYPE_PREFIX); @@ -106,12 +93,6 @@ public class CPOperand } } - public void copy(CPOperand o){ - _name = o.getName(); - _valueType = o.getValueType(); - _dataType = o.getDataType(); - } - @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java index b8ba345..aa3fd86 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java @@ -107,9 +107,8 @@ public class CentralMomentCPInstruction extends AggregateUnaryCPInstruction { ScalarObject order = ec.getScalarInput(scalarInput.getName(), scalarInput.getValueType(), scalarInput.isLiteral()); CMOperator cm_op = ((CMOperator)_optr); - if ( cm_op.getAggOpType() == AggregateOperationTypes.INVALID ) { - ((CMOperator)_optr).setCMAggOp((int)order.getLongValue()); - } + if ( cm_op.getAggOpType() == AggregateOperationTypes.INVALID ) + cm_op = cm_op.setCMAggOp((int)order.getLongValue()); CM_COV_Object cmobj = null; if (input3 == null ) { @@ -123,7 +122,7 @@ public class CentralMomentCPInstruction extends AggregateUnaryCPInstruction { ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); - double val = cmobj.getRequiredResult(_optr); + double val = cmobj.getRequiredResult(cm_op); DoubleObject ret = new DoubleObject(output_name, val); ec.setScalarOutput(output_name, ret); } http://git-wip-us.apache.org/repos/asf/systemml/blob/75b93f26/src/main/java/org/apache/sysml/runtime/instructions/cp/CompressionCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/CompressionCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/CompressionCPInstruction.java index 6169076..d9f6c32 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/CompressionCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/CompressionCPInstruction.java @@ -31,7 +31,7 @@ import org.apache.sysml.runtime.matrix.operators.Operator; public class CompressionCPInstruction extends UnaryCPInstruction { private CompressionCPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { - super(op, in, null, null, out, opcode, istr); + super(CPType.Compression, op, in, null, null, out, opcode, istr); } public static Instruction parseInstruction(String str) @@ -42,7 +42,7 @@ public class CompressionCPInstruction extends UnaryCPInstruction { CPOperand in1 = new CPOperand(parts[1]); CPOperand out = new CPOperand(parts[2]); - return new CompressionCPInstruction(null, in1, out, opcode, str); + return new CompressionCPInstruction(null, in1, out, opcode, str); } @Override
