Repository: systemml
Updated Branches:
  refs/heads/master ea77cb456 -> 4d1ee8e19


http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java
index ba28866..09cb78a 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/SPInstruction.java
@@ -29,7 +29,7 @@ import org.apache.sysml.utils.Statistics;
 
 public abstract class SPInstruction extends Instruction {
 
-       public enum SPINSTRUCTION_TYPE { 
+       public enum SPType { 
                MAPMM, MAPMMCHAIN, CPMM, RMM, TSMM, TSMM2, PMM, ZIPMM, PMAPMM, 
//matrix multiplication instructions  
                MatrixIndexing, Reorg, ArithmeticBinary, RelationalBinary,
                AggregateUnary, AggregateTernary, Reblock, CSVReblock, 
@@ -37,35 +37,34 @@ public abstract class SPInstruction extends Instruction {
                CentralMoment, Covariance, QSort, QPick, 
                ParameterizedBuiltin, MAppend, RAppend, GAppend, 
GAlignedAppend, Rand, 
                MatrixReshape, Ternary, Quaternary, CumsumAggregate, 
CumsumOffset, BinUaggChain, UaggOuterChain, 
-               Write, SpoofFused, INVALID, 
-               Convolution
+               Write, SpoofFused, Convolution
        }
 
-       protected SPINSTRUCTION_TYPE _sptype;
-       protected Operator _optr;
-       protected boolean _requiresLabelUpdate = false;
+       protected final SPType _sptype;
+       protected final Operator _optr;
+       protected final boolean _requiresLabelUpdate;
 
-       protected SPInstruction(String opcode, String istr) {
-               type = IType.SPARK;
-               instString = istr;
-               instOpcode = opcode;
-
-               // update requirement for repeated usage
-               _requiresLabelUpdate = super.requiresLabelUpdate();
+       protected SPInstruction(SPType type, String opcode, String istr) {
+               this(type, null, opcode, istr);
        }
 
-       protected SPInstruction(Operator op, String opcode, String istr) {
-               this(opcode, istr);
+       protected SPInstruction(SPType type, Operator op, String opcode, String 
istr) {
+               _sptype = type;
                _optr = op;
+               super.type = IType.SPARK;
+               instString = istr;
+
+               // prepare opcode and update requirement for repeated usage
+               instOpcode = opcode;
+               _requiresLabelUpdate = super.requiresLabelUpdate();
        }
 
-       public SPINSTRUCTION_TYPE getSPInstructionType() {
+       public SPType getSPInstructionType() {
                return _sptype;
        }
        
        @Override
-       public boolean requiresLabelUpdate()
-       {
+       public boolean requiresLabelUpdate() {
                return _requiresLabelUpdate;
        }
 
@@ -88,7 +87,7 @@ public abstract class SPInstruction extends Instruction {
                        String updInst = RunMRJobs.updateLabels(tmp.toString(), 
ec.getVariables());
                        tmp = 
SPInstructionParser.parseSingleInstruction(updInst);
                }
-                               
+               
                return tmp;
        }
 
@@ -106,5 +105,4 @@ public abstract class SPInstruction extends Instruction {
                //default post-process behavior
                super.postprocessInstruction(ec);
        }
-       
 }

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
index a1b368d..da39471 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/SpoofSPInstruction.java
@@ -75,10 +75,9 @@ public class SpoofSPInstruction extends SPInstruction {
 
        private SpoofSPInstruction(Class<?> cls, byte[] classBytes, CPOperand[] 
in, CPOperand out, String opcode,
                        String str) {
-               super(opcode, str);
+               super(SPType.SpoofFused, opcode, str);
                _class = cls;
                _classBytes = classBytes;
-               _sptype = SPINSTRUCTION_TYPE.SpoofFused;
                _in = in;
                _out = out;
        }

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java
index 5629076..7bc4cb5 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/TernarySPInstruction.java
@@ -64,7 +64,7 @@ public class TernarySPInstruction extends 
ComputationSPInstruction {
        private TernarySPInstruction(Operator op, CPOperand in1, CPOperand in2, 
CPOperand in3, CPOperand out,
                        String outputDim1, boolean dim1Literal, String 
outputDim2, boolean dim2Literal, boolean isExpand,
                        boolean ignoreZeros, String opcode, String istr) {
-               super(op, in1, in2, in3, out, opcode, istr);
+               super(SPType.Ternary, op, in1, in2, in3, out, opcode, istr);
                _outDim1 = outputDim1;
                _dim1Literal = dim1Literal;
                _outDim2 = outputDim2;

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java
index e52fbdc..344e002 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/Tsmm2SPInstruction.java
@@ -57,8 +57,7 @@ public class Tsmm2SPInstruction extends UnarySPInstruction {
        private MMTSJType _type = null;
 
        private Tsmm2SPInstruction(Operator op, CPOperand in1, CPOperand out, 
MMTSJType type, String opcode, String istr) {
-               super(op, in1, out, opcode, istr);
-               _sptype = SPINSTRUCTION_TYPE.TSMM2;
+               super(SPType.TSMM2, op, in1, out, opcode, istr);
                _type = type;
        }
 

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java
index 1caaf17..990ed3f 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/TsmmSPInstruction.java
@@ -40,8 +40,7 @@ public class TsmmSPInstruction extends UnarySPInstruction {
        private MMTSJType _type = null;
 
        private TsmmSPInstruction(Operator op, CPOperand in1, CPOperand out, 
MMTSJType type, String opcode, String istr) {
-               super(op, in1, out, opcode, istr);
-               _sptype = SPINSTRUCTION_TYPE.TSMM;
+               super(SPType.TSMM, op, in1, out, opcode, istr);
                _type = type;
        }
 

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java
index 43c2106..a711582 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/UaggOuterChainSPInstruction.java
@@ -69,14 +69,10 @@ public class UaggOuterChainSPInstruction extends 
BinarySPInstruction {
 
        private UaggOuterChainSPInstruction(BinaryOperator bop, 
AggregateUnaryOperator uaggop, AggregateOperator aggop,
                        CPOperand in1, CPOperand in2, CPOperand out, String 
opcode, String istr) {
-               super(bop, in1, in2, out, opcode, istr);
-               _sptype = SPINSTRUCTION_TYPE.UaggOuterChain;
-
+               super(SPType.UaggOuterChain, bop, in1, in2, out, opcode, istr);
                _uaggOp = uaggop;
                _aggOp = aggop;
                _bOp = bop;
-
-               _sptype = SPINSTRUCTION_TYPE.UaggOuterChain;
                instString = istr;
        }
 

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java
index 7cbf0d6..0f58789 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/UnarySPInstruction.java
@@ -26,18 +26,16 @@ import org.apache.sysml.runtime.matrix.operators.Operator;
 
 public abstract class UnarySPInstruction extends ComputationSPInstruction {
 
-       protected UnarySPInstruction(Operator op, CPOperand in, CPOperand out, 
String opcode, String instr) {
-               this(op, in, null, null, out, opcode, instr);
+       protected UnarySPInstruction(SPType type, Operator op, CPOperand in, 
CPOperand out, String opcode, String instr) {
+               this(type, op, in, null, null, out, opcode, instr);
        }
 
-       protected UnarySPInstruction(Operator op, CPOperand in1, CPOperand in2, 
CPOperand out, String opcode,
-                       String instr) {
-               this(op, in1, in2, null, out, opcode, instr);
+       protected UnarySPInstruction(SPType type, Operator op, CPOperand in1, 
CPOperand in2, CPOperand out, String opcode, String instr) {
+               this(type, op, in1, in2, null, out, opcode, instr);
        }
 
-       protected UnarySPInstruction(Operator op, CPOperand in1, CPOperand in2, 
CPOperand in3, CPOperand out, String opcode,
-                       String instr) {
-               super(op, in1, in2, in3, out, opcode, instr);
+       protected UnarySPInstruction(SPType type, Operator op, CPOperand in1, 
CPOperand in2, CPOperand in3, CPOperand out, String opcode, String instr) {
+               super(type, op, in1, in2, in3, out, opcode, instr);
        }
 
        static String parseUnaryInstruction(String instr, CPOperand in,

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java
index 2fb47f9..5894e76 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/WriteSPInstruction.java
@@ -57,11 +57,10 @@ public class WriteSPInstruction extends SPInstruction {
        private FileFormatProperties formatProperties;
 
        private WriteSPInstruction(CPOperand in1, CPOperand in2, CPOperand in3, 
String opcode, String str) {
-               super(opcode, str);
+               super(SPType.Write, opcode, str);
                input1 = in1;
                input2 = in2;
                input3 = in3;
-
                formatProperties = null; // set in case of csv
        }
 

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java
 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java
index 5a6c22c..491934d 100644
--- 
a/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java
+++ 
b/src/main/java/org/apache/sysml/runtime/instructions/spark/ZipmmSPInstruction.java
@@ -47,9 +47,7 @@ public class ZipmmSPInstruction extends BinarySPInstruction {
 
        private ZipmmSPInstruction(Operator op, CPOperand in1, CPOperand in2, 
CPOperand out, boolean tRewrite,
                        String opcode, String istr) {
-               super(op, in1, in2, out, opcode, istr);
-               _sptype = SPINSTRUCTION_TYPE.ZIPMM;
-
+               super(SPType.ZIPMM, op, in1, in2, out, opcode, istr);
                _tRewrite = tRewrite;
        }
 

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/matrix/DataGenMR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/DataGenMR.java 
b/src/main/java/org/apache/sysml/runtime/matrix/DataGenMR.java
index 14ca825..3040dae 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/DataGenMR.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/DataGenMR.java
@@ -44,7 +44,7 @@ import 
org.apache.sysml.runtime.instructions.MRInstructionParser;
 import org.apache.sysml.runtime.instructions.MRJobInstruction;
 import org.apache.sysml.runtime.instructions.mr.DataGenMRInstruction;
 import org.apache.sysml.runtime.instructions.mr.MRInstruction;
-import 
org.apache.sysml.runtime.instructions.mr.MRInstruction.MRINSTRUCTION_TYPE;
+import org.apache.sysml.runtime.instructions.mr.MRInstruction.MRType;
 import org.apache.sysml.runtime.instructions.mr.RandInstruction;
 import org.apache.sysml.runtime.instructions.mr.SeqInstruction;
 import org.apache.sysml.runtime.io.IOUtilFunctions;
@@ -130,7 +130,7 @@ public class DataGenMR
                        
dataGenInsStr=dataGenInsStr+Lop.INSTRUCTION_DELIMITOR+dataGenInstructions[i];
                        
                        MRInstruction mrins = 
MRInstructionParser.parseSingleInstruction(dataGenInstructions[i]);
-                       MRINSTRUCTION_TYPE mrtype = 
mrins.getMRInstructionType();
+                       MRType mrtype = mrins.getMRInstructionType();
                        DataGenMRInstruction genInst = (DataGenMRInstruction) 
mrins;
                        
                        rlens[i]  = genInst.getRows();
@@ -141,7 +141,7 @@ public class DataGenMR
                        maxbrlen = Math.max(maxbrlen, brlens[i]);
                        maxbclen = Math.max(maxbclen, bclens[i]);
 
-                       if ( mrtype == MRINSTRUCTION_TYPE.Rand ) 
+                       if ( mrtype == MRType.Rand ) 
                        {
                                RandInstruction randInst = (RandInstruction) 
mrins;
                                
inputs[i]=LibMatrixDatagen.generateUniqueSeedPath(genInst.getBaseDir());
@@ -186,7 +186,7 @@ public class DataGenMR
                                }
                                inputInfos[i] = InputInfo.TextCellInputInfo;
                        }
-                       else if ( mrtype == MRINSTRUCTION_TYPE.Seq ) {
+                       else if ( mrtype == MRType.Seq ) {
                                SeqInstruction seqInst = (SeqInstruction) mrins;
                                inputs[i]=genInst.getBaseDir() + 
System.currentTimeMillis()+".seqinput";
                                maxsparsity = 1.0; //always dense

http://git-wip-us.apache.org/repos/asf/systemml/blob/4d1ee8e1/src/main/java/org/apache/sysml/runtime/matrix/SortMR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/SortMR.java 
b/src/main/java/org/apache/sysml/runtime/matrix/SortMR.java
index 99d028c..d989721 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/SortMR.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/SortMR.java
@@ -52,6 +52,7 @@ import 
org.apache.sysml.runtime.controlprogram.parfor.stat.InfrastructureAnalyze
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.instructions.MRJobInstruction;
 import org.apache.sysml.runtime.instructions.mr.MRInstruction;
+import org.apache.sysml.runtime.instructions.mr.MRInstruction.MRType;
 import org.apache.sysml.runtime.instructions.mr.UnaryInstruction;
 import org.apache.sysml.runtime.io.IOUtilFunctions;
 import org.apache.sysml.runtime.matrix.data.InputInfo;
@@ -318,7 +319,7 @@ public class SortMR
                        String[] sparts = InstructionUtils.getInstructionParts 
( str );
                        byte in = Byte.parseByte(sparts[1]);
                        byte out = Byte.parseByte(sparts[2]);
-                       return new UnaryInstruction(null, in, out, str);
+                       return new UnaryInstruction(MRType.Sort, null, in, out, 
str);
                }
        }
 

Reply via email to