http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarBuiltinMultipleCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarBuiltinMultipleCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarBuiltinMultipleCPInstruction.java index 9033228..515359e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarBuiltinMultipleCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarBuiltinMultipleCPInstruction.java @@ -38,7 +38,7 @@ import org.apache.sysml.runtime.matrix.operators.Operator; */ public class ScalarBuiltinMultipleCPInstruction extends BuiltinMultipleCPInstruction { - public ScalarBuiltinMultipleCPInstruction(Operator op, String opcode, String istr, CPOperand output, + protected ScalarBuiltinMultipleCPInstruction(Operator op, String opcode, String istr, CPOperand output, CPOperand... inputs) { super(op, opcode, istr, output, inputs); }
http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java index eb9a4e5..3ad836b 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixArithmeticCPInstruction.java @@ -27,18 +27,13 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ScalarOperator; // TODO rename to MatrixScalar... -public class ScalarMatrixArithmeticCPInstruction extends ArithmeticBinaryCPInstruction -{ - - public ScalarMatrixArithmeticCPInstruction(Operator op, - CPOperand in1, - CPOperand in2, - CPOperand out, - String opcode, - String istr){ +public class ScalarMatrixArithmeticCPInstruction extends ArithmeticBinaryCPInstruction { + + protected ScalarMatrixArithmeticCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java index e0ff4a0..00e6616 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarMatrixRelationalCPInstruction.java @@ -27,15 +27,10 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ScalarOperator; //TODO rename to MatrixScalar... -public class ScalarMatrixRelationalCPInstruction extends RelationalBinaryCPInstruction -{ - - public ScalarMatrixRelationalCPInstruction(Operator op, - CPOperand in1, - CPOperand in2, - CPOperand out, - String opcode, - String istr){ +public class ScalarMatrixRelationalCPInstruction extends RelationalBinaryCPInstruction { + + protected ScalarMatrixRelationalCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarArithmeticCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarArithmeticCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarArithmeticCPInstruction.java index 2d6c7fc..9afef27 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarArithmeticCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarArithmeticCPInstruction.java @@ -25,13 +25,13 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; +public class ScalarScalarArithmeticCPInstruction extends ArithmeticBinaryCPInstruction { -public class ScalarScalarArithmeticCPInstruction extends ArithmeticBinaryCPInstruction -{ - public ScalarScalarArithmeticCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr){ + protected ScalarScalarArithmeticCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException{ ScalarObject so1 = ec.getScalarInput(input1.getName(), input1.getValueType(), input1.isLiteral()); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarBuiltinCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarBuiltinCPInstruction.java index 3126e86..8722358 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarBuiltinCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarBuiltinCPInstruction.java @@ -25,10 +25,10 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; +public class ScalarScalarBuiltinCPInstruction extends BuiltinBinaryCPInstruction { -public class ScalarScalarBuiltinCPInstruction extends BuiltinBinaryCPInstruction -{ - public ScalarScalarBuiltinCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String instr){ + protected ScalarScalarBuiltinCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String instr) { super(op, in1, in2, out, 2, opcode, instr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarRelationalCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarRelationalCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarRelationalCPInstruction.java index be2f493..fa51249 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarRelationalCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarScalarRelationalCPInstruction.java @@ -25,13 +25,12 @@ import org.apache.sysml.runtime.functionobjects.ValueComparisonFunction; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class ScalarScalarRelationalCPInstruction extends RelationalBinaryCPInstruction -{ - public ScalarScalarRelationalCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { +public class ScalarScalarRelationalCPInstruction extends RelationalBinaryCPInstruction { + protected ScalarScalarRelationalCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java index 0e8489b..9252915 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/SpoofCPInstruction.java @@ -29,21 +29,21 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixBlock; -public class SpoofCPInstruction extends ComputationCPInstruction -{ +public class SpoofCPInstruction extends ComputationCPInstruction { private final Class<?> _class; private final SpoofOperator _op; private final int _numThreads; private final CPOperand[] _in; - - public SpoofCPInstruction(SpoofOperator op, Class<?> cla, int k, CPOperand[] in, CPOperand out, String opcode, String str) { + + private SpoofCPInstruction(SpoofOperator op, Class<?> cla, int k, CPOperand[] in, CPOperand out, String opcode, + String str) { super(null, null, null, out, opcode, str); _class = cla; _op = op; _numThreads = k; _in = in; } - + public Class<?> getOperatorClass() { return _class; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java index 055d17c..f8897ba 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java @@ -29,18 +29,15 @@ import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.operators.Operator; -public class StringInitCPInstruction extends UnaryCPInstruction -{ - +public class StringInitCPInstruction extends UnaryCPInstruction { private static final String DELIM = " "; - + private long _rlen = -1; private long _clen = -1; private String _data = null; - - public StringInitCPInstruction( Operator op, CPOperand in, CPOperand out, long rows, long cols, int rpb, int cpb, - String data, String opcode, String inst) - { + + private StringInitCPInstruction(Operator op, CPOperand in, CPOperand out, long rows, long cols, int rpb, int cpb, + String data, String opcode, String inst) { super(op, in, out, opcode, inst); _rlen = rows; _clen = cols; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java index 8327dcd..2e970c1 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/TernaryCPInstruction.java @@ -32,21 +32,17 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.SimpleOperator; import org.apache.sysml.runtime.util.DataConverter; - -public class TernaryCPInstruction extends ComputationCPInstruction -{ - +public class TernaryCPInstruction extends ComputationCPInstruction { private String _outDim1; private String _outDim2; - private boolean _dim1Literal; + private boolean _dim1Literal; private boolean _dim2Literal; private boolean _isExpand; private boolean _ignoreZeros; - - public TernaryCPInstruction(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 ) - { + + private TernaryCPInstruction(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); _outDim1 = outputDim1; _dim1Literal = dim1Literal; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java index 0a6db0d..007fadc 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java @@ -32,20 +32,19 @@ import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; -public class UaggOuterChainCPInstruction extends UnaryCPInstruction -{ - //operators +public class UaggOuterChainCPInstruction extends UnaryCPInstruction { + // operators private AggregateUnaryOperator _uaggOp = null; private BinaryOperator _bOp = null; - public UaggOuterChainCPInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, AggregateOperator aggop, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr ) - { + private UaggOuterChainCPInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, AggregateOperator aggop, + CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { super(bop, in1, in2, out, opcode, istr); _cptype = CPINSTRUCTION_TYPE.UaggOuterChain; - + _uaggOp = uaggop; _bOp = bop; - + instString = istr; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/UnaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/UnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/UnaryCPInstruction.java index f72e2ee..384357a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/UnaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/UnaryCPInstruction.java @@ -25,22 +25,19 @@ import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.SimpleOperator; +public abstract class UnaryCPInstruction extends ComputationCPInstruction { -public abstract class UnaryCPInstruction extends ComputationCPInstruction -{ - - public UnaryCPInstruction(Operator op, CPOperand in, CPOperand out, - String opcode, String instr) { - this (op, in, null, null, out, opcode, instr); + protected UnaryCPInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String instr) { + this(op, in, null, null, out, opcode, instr); } - public UnaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, - String opcode, String instr) { - this (op, in1, in2, null, out, opcode, instr); + protected UnaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String instr) { + this(op, in1, in2, null, out, opcode, instr); } - public UnaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, - String opcode, String instr) { + protected UnaryCPInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, + String instr) { super(op, in1, in2, in3, out, opcode, instr); } @@ -62,7 +59,7 @@ public abstract class UnaryCPInstruction extends ComputationCPInstruction return parse(instr, in1, in2, in3, out); } - static String parse(String instr, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out) throws DMLRuntimeException { + private static String parse(String instr, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out) throws DMLRuntimeException { String[] parts = InstructionUtils.getInstructionPartsWithValueType(instr); // first part is the opcode, last part is the output, middle parts are input operands http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java index c2aa5d5..1ac046a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java @@ -59,10 +59,8 @@ import org.apache.sysml.runtime.util.MapReduceTool; import org.apache.sysml.runtime.util.UtilFunctions; import org.apache.sysml.utils.Statistics; +public class VariableCPInstruction extends CPInstruction { -public class VariableCPInstruction extends CPInstruction -{ - /* * Supported Operations * -------------------- @@ -118,9 +116,9 @@ public class VariableCPInstruction extends CPInstruction static { _uniqueVarID = new IDSequence(true); } - - public VariableCPInstruction (VariableOperationCode op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, int _arity, String sopcode, String istr ) - { + + private VariableCPInstruction(VariableOperationCode op, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, + int _arity, String sopcode, String istr) { super(sopcode, istr); _cptype = CPINSTRUCTION_TYPE.Variable; opcode = op; @@ -129,30 +127,31 @@ public class VariableCPInstruction extends CPInstruction addInput(in2); addInput(in3); output = out; - + _formatProperties = null; _schema = null; } // This version of the constructor is used only in case of CreateVariable - public VariableCPInstruction (VariableOperationCode op, CPOperand in1, CPOperand in2, CPOperand in3, MetaData md, UpdateType updateType, int _arity, String schema, String sopcode, String istr) - { - this(op, in1, in2, in3, (CPOperand)null, _arity, sopcode, istr); + private VariableCPInstruction(VariableOperationCode op, CPOperand in1, CPOperand in2, CPOperand in3, MetaData md, + UpdateType updateType, int _arity, String schema, String sopcode, String istr) { + this(op, in1, in2, in3, (CPOperand) null, _arity, sopcode, istr); metadata = md; - _updateType = updateType; + _updateType = updateType; _schema = schema; } - + // This version of the constructor is used only in case of CreateVariable - public VariableCPInstruction (VariableOperationCode op, CPOperand in1, CPOperand in2, CPOperand in3, MetaData md, UpdateType updateType, int _arity, FileFormatProperties formatProperties, String schema, String sopcode, String istr) - { - this(op, in1, in2, in3, (CPOperand)null, _arity, sopcode, istr); + private VariableCPInstruction(VariableOperationCode op, CPOperand in1, CPOperand in2, CPOperand in3, MetaData md, + UpdateType updateType, int _arity, FileFormatProperties formatProperties, String schema, String sopcode, + String istr) { + this(op, in1, in2, in3, (CPOperand) null, _arity, sopcode, istr); metadata = md; - _updateType = updateType; + _updateType = updateType; _formatProperties = formatProperties; _schema = schema; } - + private static VariableOperationCode getVariableOperationCode ( String str ) throws DMLRuntimeException { if ( str.equalsIgnoreCase("createvar")) http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java index 70bff67..33f3aed 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java @@ -42,10 +42,11 @@ import org.apache.sysml.runtime.util.MapReduceTool; * COLWISE partition formats. * */ -public final class MatrixIndexingCPFileInstruction extends IndexingCPInstruction -{ - public MatrixIndexingCPFileInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, CPOperand out, String opcode, String istr) { - super( op, in, rl, ru, cl, cu, out, opcode, istr ); +public final class MatrixIndexingCPFileInstruction extends IndexingCPInstruction { + + private MatrixIndexingCPFileInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, + CPOperand cu, CPOperand out, String opcode, String istr) { + super(op, in, rl, ru, cl, cu, out, opcode, istr); } public static MatrixIndexingCPFileInstruction parseInstruction ( String str ) http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java index c8d890f..6383906 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java @@ -76,11 +76,10 @@ import org.apache.sysml.runtime.util.MapReduceTool; * parallel version due to data-dependent row- and column dependencies. * */ -public class ParameterizedBuiltinCPFileInstruction extends ParameterizedBuiltinCPInstruction -{ - - public ParameterizedBuiltinCPFileInstruction(Operator op, HashMap<String, String> paramsMap, CPOperand out, String opcode, String istr) - { +public class ParameterizedBuiltinCPFileInstruction extends ParameterizedBuiltinCPInstruction { + + private ParameterizedBuiltinCPFileInstruction(Operator op, HashMap<String, String> paramsMap, CPOperand out, + String opcode, String istr) { super(op, paramsMap, out, opcode, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateBinaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateBinaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateBinaryGPUInstruction.java index 0c0a4b2..49915f2 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateBinaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateBinaryGPUInstruction.java @@ -34,17 +34,15 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; import org.apache.sysml.utils.GPUStatistics; -public class AggregateBinaryGPUInstruction extends GPUInstruction -{ +public class AggregateBinaryGPUInstruction extends GPUInstruction { private CPOperand _input1 = null; private CPOperand _input2 = null; private CPOperand _output = null; private boolean _isLeftTransposed; private boolean _isRightTransposed; - - public AggregateBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, - String opcode, String istr, boolean leftTranspose, boolean rightTranspose) - { + + private AggregateBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr, boolean leftTranspose, boolean rightTranspose) { super(op, opcode, istr); _gputype = GPUINSTRUCTION_TYPE.AggregateBinary; _input1 = in1; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateUnaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateUnaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateUnaryGPUInstruction.java index 5d01820..767f173 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateUnaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/AggregateUnaryGPUInstruction.java @@ -36,17 +36,15 @@ import org.apache.sysml.utils.GPUStatistics; * Implements aggregate unary instructions for CUDA */ public class AggregateUnaryGPUInstruction extends GPUInstruction { - private CPOperand _input1 = null; - private CPOperand _output = null; - - public AggregateUnaryGPUInstruction(Operator op, CPOperand in1, CPOperand out, - String opcode, String istr) - { - super(op, opcode, istr); - _gputype = GPUINSTRUCTION_TYPE.AggregateUnary; - _input1 = in1; - _output = out; - } + private CPOperand _input1 = null; + private CPOperand _output = null; + + private AggregateUnaryGPUInstruction(Operator op, CPOperand in1, CPOperand out, String opcode, String istr) { + super(op, opcode, istr); + _gputype = GPUINSTRUCTION_TYPE.AggregateUnary; + _input1 = in1; + _output = out; + } public static AggregateUnaryGPUInstruction parseInstruction(String str ) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/ArithmeticBinaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ArithmeticBinaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ArithmeticBinaryGPUInstruction.java index 6d76a7f..e1f06ba 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ArithmeticBinaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ArithmeticBinaryGPUInstruction.java @@ -26,19 +26,19 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; public abstract class ArithmeticBinaryGPUInstruction extends GPUInstruction { - protected CPOperand _input1; protected CPOperand _input2; protected CPOperand _output; - public ArithmeticBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { + protected ArithmeticBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, opcode, istr); _gputype = GPUINSTRUCTION_TYPE.ArithmeticBinary; _input1 = in1; _input2 = in2; - _output = out; + _output = out; } - + public static ArithmeticBinaryGPUInstruction parseInstruction ( String str ) throws DMLRuntimeException { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); InstructionUtils.checkNumFields ( parts, 3 ); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinBinaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinBinaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinBinaryGPUInstruction.java index 24e9e79..36016e7 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinBinaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinBinaryGPUInstruction.java @@ -29,21 +29,20 @@ import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; public abstract class BuiltinBinaryGPUInstruction extends GPUInstruction { - - @SuppressWarnings("unused") - private int _arity; - - CPOperand output; - CPOperand input1, input2; - - - public BuiltinBinaryGPUInstruction(Operator op, CPOperand input1, CPOperand input2, CPOperand output, String opcode, String istr, int _arity) { - super(op, opcode, istr); - this._arity = _arity; - this.output = output; - this.input1 = input1; - this.input2 = input2; - } + @SuppressWarnings("unused") + private int _arity; + + CPOperand output; + CPOperand input1, input2; + + protected BuiltinBinaryGPUInstruction(Operator op, CPOperand input1, CPOperand input2, CPOperand output, + String opcode, String istr, int _arity) { + super(op, opcode, istr); + this._arity = _arity; + this.output = output; + this.input1 = input1; + this.input2 = input2; + } public static BuiltinBinaryGPUInstruction parseInstruction(String str) throws DMLRuntimeException { CPOperand in1 = new CPOperand("", Expression.ValueType.UNKNOWN, Expression.DataType.UNKNOWN); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinUnaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinUnaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinUnaryGPUInstruction.java index e1c163d..b67d9fa 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinUnaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/BuiltinUnaryGPUInstruction.java @@ -30,15 +30,13 @@ import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.UnaryOperator; -public abstract class BuiltinUnaryGPUInstruction extends GPUInstruction { - - +public abstract class BuiltinUnaryGPUInstruction extends GPUInstruction { int _arity; CPOperand _input; CPOperand _output; - - public BuiltinUnaryGPUInstruction(Operator op, CPOperand in, CPOperand out, int _arity, String opcode, String istr ) - { + + protected BuiltinUnaryGPUInstruction(Operator op, CPOperand in, CPOperand out, int _arity, String opcode, + String istr) { super(op, opcode, istr); _gputype = GPUINSTRUCTION_TYPE.BuiltinUnary; this._arity = _arity; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/ConvolutionGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ConvolutionGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ConvolutionGPUInstruction.java index c23253b..5b37576 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ConvolutionGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ConvolutionGPUInstruction.java @@ -31,45 +31,43 @@ import org.apache.sysml.runtime.matrix.operators.ReorgOperator; import org.apache.sysml.runtime.util.ConvolutionUtils; import org.apache.sysml.utils.GPUStatistics; -public class ConvolutionGPUInstruction extends GPUInstruction -{ - private CPOperand _input1; - private CPOperand _input2; - private CPOperand _input3; - private CPOperand _output; +public class ConvolutionGPUInstruction extends GPUInstruction { + private CPOperand _input1; + private CPOperand _input2; + private CPOperand _input3; + private CPOperand _output; private ArrayList<CPOperand> _input_shape; private ArrayList<CPOperand> _filter_shape; private ArrayList<CPOperand> _stride = new ArrayList<CPOperand>(); private ArrayList<CPOperand> _padding = new ArrayList<CPOperand>(); - - public ConvolutionGPUInstruction(CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) throws DMLRuntimeException { + + private ConvolutionGPUInstruction(CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) + throws DMLRuntimeException { super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), opcode, istr); - if(!(opcode.equals("bias_add") || opcode.equals("bias_multiply") || opcode.equals("relu_backward"))) { - throw new DMLRuntimeException("Incorrect usage. Expected the opcode to be bias_add or bias_multiply or relu_backward, but found " + opcode); + if (!(opcode.equals("bias_add") || opcode.equals("bias_multiply") || opcode.equals("relu_backward"))) { + throw new DMLRuntimeException( + "Incorrect usage. Expected the opcode to be bias_add or bias_multiply or relu_backward, but found " + + opcode); } _input1 = in1; _input2 = in2; _gputype = GPUINSTRUCTION_TYPE.Convolution; _output = out; } - - public ConvolutionGPUInstruction(CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, - String istr, ArrayList<CPOperand> stride, - ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, - ArrayList<CPOperand> filter_shape) - { - this(in1, in2, out, opcode, istr, stride, padding, input_shape, filter_shape); + + private ConvolutionGPUInstruction(CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out, String opcode, + String istr, ArrayList<CPOperand> stride, ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, + ArrayList<CPOperand> filter_shape) { + this(in1, in2, out, opcode, istr, stride, padding, input_shape, filter_shape); _input3 = in3; } - - public ConvolutionGPUInstruction(CPOperand in1, CPOperand in2, CPOperand out, String opcode, - String istr, ArrayList<CPOperand> stride, - ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, - ArrayList<CPOperand> filter_shape) - { + + private ConvolutionGPUInstruction(CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr, + ArrayList<CPOperand> stride, ArrayList<CPOperand> padding, ArrayList<CPOperand> input_shape, + ArrayList<CPOperand> filter_shape) { super(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), opcode, istr); _gputype = GPUINSTRUCTION_TYPE.Convolution; - + _input1 = in1; _input2 = in2; _output = out; @@ -78,7 +76,7 @@ public class ConvolutionGPUInstruction extends GPUInstruction _input_shape = input_shape; _filter_shape = filter_shape; } - + public static ConvolutionGPUInstruction parseInstruction(String str) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/GPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/GPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/GPUInstruction.java index 0f0b28e..f27084f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/GPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/GPUInstruction.java @@ -30,8 +30,7 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.utils.GPUStatistics; import org.apache.sysml.utils.Statistics; -public abstract class GPUInstruction extends Instruction -{ +public abstract class GPUInstruction extends Instruction { public enum GPUINSTRUCTION_TYPE { AggregateUnary, AggregateBinary, @@ -130,22 +129,21 @@ public abstract class GPUInstruction extends Instruction public final static String MISC_TIMER_CUDNN_INIT = "nni"; // time spent in initializations for cudnn call public final static String MISC_TIMER_CUDNN_CLEANUP = "nnc"; // time spent in cleanup for cudnn call - protected GPUINSTRUCTION_TYPE _gputype; protected Operator _optr; protected boolean _requiresLabelUpdate = false; - public GPUInstruction(String opcode, String istr) { + private GPUInstruction(String opcode, String istr) { type = INSTRUCTION_TYPE.GPU; instString = istr; - //prepare opcode and update requirement for repeated usage + // prepare opcode and update requirement for repeated usage instOpcode = opcode; _requiresLabelUpdate = super.requiresLabelUpdate(); } - public GPUInstruction(Operator op, String opcode, String istr) { + protected GPUInstruction(Operator op, String opcode, String istr) { this(opcode, istr); _optr = op; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MMTSJGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MMTSJGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MMTSJGPUInstruction.java index 55656f0..f795f54 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MMTSJGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MMTSJGPUInstruction.java @@ -36,32 +36,34 @@ import org.apache.sysml.runtime.matrix.data.LibMatrixCUDA; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.utils.GPUStatistics; -public class MMTSJGPUInstruction extends GPUInstruction -{ +public class MMTSJGPUInstruction extends GPUInstruction { + private MMTSJType _type = null; + CPOperand _input; + CPOperand _output; - private MMTSJType _type = null; - - CPOperand _input; - CPOperand _output; - - /** - * MMTSJGPUInstruction constructor. - * - * @param op operator - * @param in1 input - * @param type left/right, left-> A' %*% A, right-> A %*% A' - * @param out output - * @param opcode the opcode - * @param istr ? - */ - public MMTSJGPUInstruction(Operator op, CPOperand in1, MMTSJType type, CPOperand out, String opcode, String istr) - { - super(op, opcode, istr); - _gputype = GPUINSTRUCTION_TYPE.MMTSJ; - _type = type; - _input = in1; - _output = out; - } + /** + * MMTSJGPUInstruction constructor. + * + * @param op + * operator + * @param in1 + * input + * @param type + * left/right, left-> A' %*% A, right-> A %*% A' + * @param out + * output + * @param opcode + * the opcode + * @param istr + * ? + */ + private MMTSJGPUInstruction(Operator op, CPOperand in1, MMTSJType type, CPOperand out, String opcode, String istr) { + super(op, opcode, istr); + _gputype = GPUINSTRUCTION_TYPE.MMTSJ; + _type = type; + _input = in1; + _output = out; + } /** * parse MMTSJ GPU instruction http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixAppendGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixAppendGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixAppendGPUInstruction.java index 31dd6aa..ac48edf 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixAppendGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixAppendGPUInstruction.java @@ -41,7 +41,8 @@ public class MatrixAppendGPUInstruction extends GPUInstruction { CPOperand input1, input2; AppendCPInstruction.AppendType type; - public MatrixAppendGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, AppendCPInstruction.AppendType type, String opcode, String istr) { + private MatrixAppendGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + AppendCPInstruction.AppendType type, String opcode, String istr) { super(op, opcode, istr); this.output = out; this.input1 = in1; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixBuiltinGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixBuiltinGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixBuiltinGPUInstruction.java index beeacee..af27dc6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixBuiltinGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixBuiltinGPUInstruction.java @@ -28,8 +28,8 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.utils.GPUStatistics; public class MatrixBuiltinGPUInstruction extends BuiltinUnaryGPUInstruction { - - public MatrixBuiltinGPUInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String instr){ + + protected MatrixBuiltinGPUInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String instr) { super(op, in, out, 1, opcode, instr); _gputype = GPUINSTRUCTION_TYPE.BuiltinUnary; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixIndexingGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixIndexingGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixIndexingGPUInstruction.java index 5e2c8fc..ba3ccb5 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixIndexingGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixIndexingGPUInstruction.java @@ -32,10 +32,12 @@ import org.apache.sysml.utils.GPUStatistics; public class MatrixIndexingGPUInstruction extends GPUInstruction { CPOperand rowLower, rowUpper, colLower, colUpper; - CPOperand input1; CPOperand input2; CPOperand output; - - public MatrixIndexingGPUInstruction(Operator op, CPOperand in, - CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, CPOperand out, String opcode, String istr){ + CPOperand input1; + CPOperand input2; + CPOperand output; + + private MatrixIndexingGPUInstruction(Operator op, CPOperand in, CPOperand rl, CPOperand ru, CPOperand cl, + CPOperand cu, CPOperand out, String opcode, String istr) { super(op, opcode, istr); _gputype = GPUINSTRUCTION_TYPE.MatrixIndexing; rowLower = rl; @@ -45,9 +47,9 @@ public class MatrixIndexingGPUInstruction extends GPUInstruction { input1 = in; output = out; } - - public MatrixIndexingGPUInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, - CPOperand rl, CPOperand ru, CPOperand cl, CPOperand cu, CPOperand out, String opcode, String istr){ + + private MatrixIndexingGPUInstruction(Operator op, CPOperand lhsInput, CPOperand rhsInput, CPOperand rl, + CPOperand ru, CPOperand cl, CPOperand cu, CPOperand out, String opcode, String istr) { super(op, opcode, istr); _gputype = GPUINSTRUCTION_TYPE.MatrixIndexing; rowLower = rl; @@ -58,7 +60,7 @@ public class MatrixIndexingGPUInstruction extends GPUInstruction { input2 = rhsInput; output = out; } - + public static MatrixIndexingGPUInstruction parseInstruction ( String str ) throws DMLRuntimeException { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); String opcode = parts[0]; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixArithmeticGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixArithmeticGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixArithmeticGPUInstruction.java index ef3333d..d332bc8 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixArithmeticGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixArithmeticGPUInstruction.java @@ -28,18 +28,13 @@ import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.utils.GPUStatistics; -public class MatrixMatrixArithmeticGPUInstruction extends ArithmeticBinaryGPUInstruction -{ - - public MatrixMatrixArithmeticGPUInstruction(Operator op, - CPOperand in1, - CPOperand in2, - CPOperand out, - String opcode, - String istr){ +public class MatrixMatrixArithmeticGPUInstruction extends ArithmeticBinaryGPUInstruction { + + protected MatrixMatrixArithmeticGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException { GPUStatistics.incrementNoOfExecutedGPUInst(); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixAxpyGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixAxpyGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixAxpyGPUInstruction.java index e430e29..fa01ab5 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixAxpyGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixAxpyGPUInstruction.java @@ -30,24 +30,17 @@ import org.apache.sysml.runtime.matrix.data.LibMatrixCUDA; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.utils.GPUStatistics; -public class MatrixMatrixAxpyGPUInstruction extends ArithmeticBinaryGPUInstruction -{ - +public class MatrixMatrixAxpyGPUInstruction extends ArithmeticBinaryGPUInstruction { CPOperand constant = null; int multiplier = 1; - public MatrixMatrixAxpyGPUInstruction(Operator op, - CPOperand in1, - CPOperand constant, - int multiplier, - CPOperand in2, - CPOperand out, - String opcode, - String istr){ + + private MatrixMatrixAxpyGPUInstruction(Operator op, CPOperand in1, CPOperand constant, int multiplier, + CPOperand in2, CPOperand out, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); this.constant = constant; this.multiplier = multiplier; } - + public static MatrixMatrixAxpyGPUInstruction parseInstruction ( String str ) throws DMLRuntimeException { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); InstructionUtils.checkNumFields ( parts, 4 ); http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixBuiltinGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixBuiltinGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixBuiltinGPUInstruction.java index e60a3d7..0ef7a44 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixBuiltinGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixBuiltinGPUInstruction.java @@ -27,14 +27,13 @@ import org.apache.sysml.runtime.matrix.data.LibMatrixCUDA; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.utils.GPUStatistics; - public class MatrixMatrixBuiltinGPUInstruction extends BuiltinBinaryGPUInstruction { - public MatrixMatrixBuiltinGPUInstruction(Operator op, CPOperand input1, CPOperand input2, CPOperand output, String opcode, String istr, int _arity) { - super(op, input1, input2, output, opcode, istr, _arity); - _gputype = GPUINSTRUCTION_TYPE.BuiltinUnary; - - } + protected MatrixMatrixBuiltinGPUInstruction(Operator op, CPOperand input1, CPOperand input2, CPOperand output, + String opcode, String istr, int _arity) { + super(op, input1, input2, output, opcode, istr, _arity); + _gputype = GPUINSTRUCTION_TYPE.BuiltinUnary; + } @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixRelationalBinaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixRelationalBinaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixRelationalBinaryGPUInstruction.java index a7e969f..224e7b5 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixRelationalBinaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/MatrixMatrixRelationalBinaryGPUInstruction.java @@ -30,7 +30,7 @@ import org.apache.sysml.utils.GPUStatistics; public class MatrixMatrixRelationalBinaryGPUInstruction extends RelationalBinaryGPUInstruction { - public MatrixMatrixRelationalBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + protected MatrixMatrixRelationalBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/RelationalBinaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/RelationalBinaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/RelationalBinaryGPUInstruction.java index 8dedf0b..505e6e4 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/RelationalBinaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/RelationalBinaryGPUInstruction.java @@ -31,7 +31,8 @@ public abstract class RelationalBinaryGPUInstruction extends GPUInstruction { protected CPOperand _input2; protected CPOperand _output; - public RelationalBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { + protected RelationalBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, + String istr) { super(op, opcode, istr); _gputype = GPUINSTRUCTION_TYPE.RelationalBinary; _input1 = in1; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/ReorgGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ReorgGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ReorgGPUInstruction.java index bc63d12..2c32cd5 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ReorgGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ReorgGPUInstruction.java @@ -30,27 +30,31 @@ import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.ReorgOperator; import org.apache.sysml.utils.GPUStatistics; +public class ReorgGPUInstruction extends GPUInstruction { + private CPOperand _input; + private CPOperand _output; -public class ReorgGPUInstruction extends GPUInstruction -{ - private CPOperand _input; - private CPOperand _output; - /** - * for opcodes r' - * - * @param op operator - * @param in input operand - * @param out output operand - * @param opcode the opcode - * @param istr instruction string - */ - public ReorgGPUInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { + /** + * for opcodes r' + * + * @param op + * operator + * @param in + * input operand + * @param out + * output operand + * @param opcode + * the opcode + * @param istr + * instruction string + */ + private ReorgGPUInstruction(Operator op, CPOperand in, CPOperand out, String opcode, String istr) { super(op, opcode, istr); _gputype = GPUINSTRUCTION_TYPE.Reorg; _input = in; - _output = out; + _output = out; } - + public static ReorgGPUInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixArithmeticGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixArithmeticGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixArithmeticGPUInstruction.java index ea4665a..7aba2ce 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixArithmeticGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixArithmeticGPUInstruction.java @@ -31,15 +31,12 @@ import org.apache.sysml.runtime.matrix.operators.ScalarOperator; import org.apache.sysml.utils.GPUStatistics; public class ScalarMatrixArithmeticGPUInstruction extends ArithmeticBinaryGPUInstruction { - public ScalarMatrixArithmeticGPUInstruction(Operator op, - CPOperand in1, - CPOperand in2, - CPOperand out, - String opcode, - String istr){ + + protected ScalarMatrixArithmeticGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } - + @Override public void processInstruction(ExecutionContext ec) throws DMLRuntimeException http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixRelationalBinaryGPUInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixRelationalBinaryGPUInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixRelationalBinaryGPUInstruction.java index 2a084b9..7d9e180 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixRelationalBinaryGPUInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/ScalarMatrixRelationalBinaryGPUInstruction.java @@ -32,7 +32,7 @@ import org.apache.sysml.utils.GPUStatistics; public class ScalarMatrixRelationalBinaryGPUInstruction extends RelationalBinaryGPUInstruction { - public ScalarMatrixRelationalBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, + protected ScalarMatrixRelationalBinaryGPUInstruction(Operator op, CPOperand in1, CPOperand in2, CPOperand out, String opcode, String istr) { super(op, in1, in2, out, opcode, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java index e9a023a..a5a830e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java @@ -39,24 +39,21 @@ import org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator; import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class AggregateBinaryInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer -{ +public class AggregateBinaryInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer { private String _opcode = null; - - //optional argument for cpmm + + // optional argument for cpmm private MMCJType _aggType = MMCJType.AGG; - - //optional argument for mapmm + + // optional argument for mapmm private CacheType _cacheType = null; private boolean _outputEmptyBlocks = true; - - public AggregateBinaryInstruction(Operator op, String opcode, byte in1, byte in2, byte out, String istr) - { + + private AggregateBinaryInstruction(Operator op, String opcode, byte in1, byte in2, byte out, String istr) { super(op, in1, in2, out); mrtype = MRINSTRUCTION_TYPE.AggregateBinary; instString = istr; - + _opcode = opcode; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java index 0eb1926..f249f08 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java @@ -27,17 +27,14 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.AggregateOperator; import org.apache.sysml.runtime.matrix.operators.Operator; +public class AggregateInstruction extends UnaryMRInstructionBase { -public class AggregateInstruction extends UnaryMRInstructionBase -{ - - public AggregateInstruction(Operator op, byte in, byte out, String istr) - { + public AggregateInstruction(Operator op, byte in, byte out, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.Aggregate; instString = istr; } - + public static AggregateInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java index 409590a..35dfe7c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java @@ -33,18 +33,14 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class AggregateUnaryInstruction extends UnaryMRInstructionBase -{ - +public class AggregateUnaryInstruction extends UnaryMRInstructionBase { private boolean _dropCorr = false; - - public AggregateUnaryInstruction(Operator op, byte in, byte out, boolean dropCorr, String istr) - { + + protected AggregateUnaryInstruction(Operator op, byte in, byte out, boolean dropCorr, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.AggregateUnary; instString = istr; - + _dropCorr = dropCorr; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java index fae109e..8c84563 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java @@ -30,15 +30,13 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class AppendGInstruction extends AppendInstruction -{ - private long _offset = -1; //cols of input1 - private long _offset2 = -1; //cols of input2 +public class AppendGInstruction extends AppendInstruction { + private long _offset = -1; // cols of input1 + private long _offset2 = -1; // cols of input2 private long _len = -1; - - public AppendGInstruction(Operator op, byte in1, byte in2, long offset, long offset2, byte out, boolean cbind, String istr) - { + + private AppendGInstruction(Operator op, byte in1, byte in2, long offset, long offset2, byte out, boolean cbind, + String istr) { super(op, in1, in2, out, cbind, istr); _offset = offset; _offset2 = offset2; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java index 2a49a7d..a515a34 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java @@ -27,15 +27,12 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class AppendInstruction extends BinaryMRInstructionBase -{ +public class AppendInstruction extends BinaryMRInstructionBase { protected boolean _cbind = true; - public AppendInstruction(Operator op, byte in1, byte in2, byte out, boolean cbind, String istr) - { + protected AppendInstruction(Operator op, byte in1, byte in2, byte out, boolean cbind, String istr) { super(op, in1, in2, out); - instString = istr; + instString = istr; mrtype = MRINSTRUCTION_TYPE.Append; _cbind = cbind; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java index 777640f..6b18b8c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java @@ -33,17 +33,15 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.mapred.MRBaseForCommonInstructions; import org.apache.sysml.runtime.matrix.operators.Operator; +public class AppendMInstruction extends AppendInstruction implements IDistributedCacheConsumer { + private long _offset = -1; -public class AppendMInstruction extends AppendInstruction implements IDistributedCacheConsumer -{ - private long _offset = -1; - - public AppendMInstruction(Operator op, byte in1, byte in2, long offset, CacheType type, byte out, boolean cbind, String istr) - { + private AppendMInstruction(Operator op, byte in1, byte in2, long offset, CacheType type, byte out, boolean cbind, + String istr) { super(op, in1, in2, out, cbind, istr); _offset = offset; } - + public static AppendMInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java index 35a7813..fae8ddd 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java @@ -27,10 +27,8 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; -public class AppendRInstruction extends AppendInstruction -{ - public AppendRInstruction(Operator op, byte in1, byte in2, byte out, boolean cbind, String istr) - { +public class AppendRInstruction extends AppendInstruction { + private AppendRInstruction(Operator op, byte in1, byte in2, byte out, boolean cbind, String istr) { super(op, in1, in2, out, cbind, istr); } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java index a8badd3..93674b7 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java @@ -32,27 +32,25 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; -public class BinUaggChainInstruction extends UnaryInstruction -{ - - //operators +public class BinUaggChainInstruction extends UnaryInstruction { + // operators private BinaryOperator _bOp = null; private AggregateUnaryOperator _uaggOp = null; - - //reused intermediates + + // reused intermediates private MatrixIndexes _tmpIx = null; private MatrixValue _tmpVal = null; - public BinUaggChainInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, byte in1, byte out, String istr) - { + private BinUaggChainInstruction(BinaryOperator bop, AggregateUnaryOperator uaggop, byte in1, byte out, + String istr) { super(null, in1, out, istr); - + _bOp = bop; _uaggOp = uaggop; - + _tmpIx = new MatrixIndexes(); _tmpVal = new MatrixBlock(); - + mrtype = MRINSTRUCTION_TYPE.BinUaggChain; instString = istr; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java index 6d9c075..f88b2f6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java @@ -29,17 +29,14 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; +public class BinaryInstruction extends BinaryMRInstructionBase { -public class BinaryInstruction extends BinaryMRInstructionBase -{ - - public BinaryInstruction(Operator op, byte in1, byte in2, byte out, String istr) - { + protected BinaryInstruction(Operator op, byte in1, byte in2, byte out, String istr) { super(op, in1, in2, out); mrtype = MRINSTRUCTION_TYPE.ArithmeticBinary; instString = istr; } - + public static BinaryInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMInstruction.java index 3a5661a..bae1786 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMInstruction.java @@ -34,17 +34,15 @@ import org.apache.sysml.runtime.matrix.mapred.MRBaseForCommonInstructions; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class BinaryMInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer -{ +public class BinaryMInstruction extends BinaryMRInstructionBase implements IDistributedCacheConsumer { private VectorType _vectorType = null; - - public BinaryMInstruction(Operator op, byte in1, byte in2, CacheType ctype, VectorType vtype, byte out, String istr) - { + + private BinaryMInstruction(Operator op, byte in1, byte in2, CacheType ctype, VectorType vtype, byte out, + String istr) { super(op, in1, in2, out); mrtype = MRINSTRUCTION_TYPE.ArithmeticBinary; instString = istr; - + _vectorType = vtype; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMRInstructionBase.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMRInstructionBase.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMRInstructionBase.java index bb942a5..5c28c43 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMRInstructionBase.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryMRInstructionBase.java @@ -21,18 +21,15 @@ package org.apache.sysml.runtime.instructions.mr; import org.apache.sysml.runtime.matrix.operators.Operator; -public abstract class BinaryMRInstructionBase extends MRInstruction -{ - +public abstract class BinaryMRInstructionBase extends MRInstruction { public byte input1, input2; - - public BinaryMRInstructionBase(Operator op, byte in1, byte in2, byte out) - { + + protected BinaryMRInstructionBase(Operator op, byte in1, byte in2, byte out) { super(op, out); - input1=in1; - input2=in2; + input1 = in1; + input2 = in2; } - + @Override public byte[] getInputIndexes() { return new byte[]{input1, input2}; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CM_N_COVInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CM_N_COVInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CM_N_COVInstruction.java index 1d6cb02..0fc6df2 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CM_N_COVInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CM_N_COVInstruction.java @@ -31,17 +31,14 @@ import org.apache.sysml.runtime.matrix.operators.COVOperator; import org.apache.sysml.runtime.matrix.operators.Operator; import org.apache.sysml.runtime.matrix.operators.CMOperator.AggregateOperationTypes; +public class CM_N_COVInstruction extends UnaryMRInstructionBase { -public class CM_N_COVInstruction extends UnaryMRInstructionBase -{ - - public CM_N_COVInstruction(Operator op, byte in, byte out, String istr) - { + private CM_N_COVInstruction(Operator op, byte in, byte out, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.CM_N_COV; instString = istr; } - + public static CM_N_COVInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVReblockInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVReblockInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVReblockInstruction.java index b49b4be..848fe14 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVReblockInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVReblockInstruction.java @@ -23,21 +23,19 @@ import org.apache.sysml.parser.DataExpression; import org.apache.sysml.runtime.instructions.Instruction; import org.apache.sysml.runtime.matrix.operators.Operator; -public class CSVReblockInstruction extends ReblockInstruction -{ - - public String delim = DataExpression.DEFAULT_DELIM_DELIMITER; +public class CSVReblockInstruction extends ReblockInstruction { + public String delim = DataExpression.DEFAULT_DELIM_DELIMITER; public boolean hasHeader = DataExpression.DEFAULT_DELIM_HAS_HEADER_ROW; - public boolean fill = DataExpression.DEFAULT_DELIM_FILL; - public double fillValue = DataExpression.DEFAULT_DELIM_FILL_VALUE; + public boolean fill = DataExpression.DEFAULT_DELIM_FILL; + public double fillValue = DataExpression.DEFAULT_DELIM_FILL_VALUE; - public CSVReblockInstruction(Operator op, byte in, byte out, int br, - int bc, boolean hasHeader, String delim, boolean fll, double mv, String istr) { + private CSVReblockInstruction(Operator op, byte in, byte out, int br, int bc, boolean hasHeader, String delim, + boolean fll, double mv, String istr) { super(op, in, out, br, bc, false, istr); - this.delim=delim; - this.fill=fll; - this.fillValue=mv; - this.hasHeader=hasHeader; + this.delim = delim; + this.fill = fll; + this.fillValue = mv; + this.hasHeader = hasHeader; } public Instruction clone(byte in) http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVWriteInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVWriteInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVWriteInstruction.java index 747ef00..c182dca 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVWriteInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CSVWriteInstruction.java @@ -27,13 +27,11 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; -public class CSVWriteInstruction extends UnaryMRInstructionBase{ +public class CSVWriteInstruction extends UnaryMRInstructionBase { + public String delim = DataExpression.DEFAULT_DELIM_DELIMITER; + public String header = null;// if null or empty string, then no header + public boolean sparse = DataExpression.DEFAULT_DELIM_SPARSE; - - public String delim= DataExpression.DEFAULT_DELIM_DELIMITER; - public String header=null;//if null or empty string, then no header - public boolean sparse=DataExpression.DEFAULT_DELIM_SPARSE; - public CSVWriteInstruction(Operator op, byte in, byte out, String del, String hdr, boolean sps, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.CSVWrite; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineBinaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineBinaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineBinaryInstruction.java index e14768b..b18df04 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineBinaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineBinaryInstruction.java @@ -26,17 +26,15 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class CombineBinaryInstruction extends BinaryMRInstructionBase -{ - +public class CombineBinaryInstruction extends BinaryMRInstructionBase { /* * combinebinary:::0:DOUBLE:::1:INT:::2:INT */ - private boolean secondInputIsWeight=true; - public CombineBinaryInstruction(Operator op, boolean isWeight, byte in1, byte in2, byte out, String istr) { + private boolean secondInputIsWeight = true; + + private CombineBinaryInstruction(Operator op, boolean isWeight, byte in1, byte in2, byte out, String istr) { super(op, in1, in2, out); - secondInputIsWeight=isWeight; + secondInputIsWeight = isWeight; mrtype = MRINSTRUCTION_TYPE.CombineBinary; instString = istr; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineTernaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineTernaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineTernaryInstruction.java index 783f1ae..cda5c3e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineTernaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineTernaryInstruction.java @@ -26,12 +26,9 @@ import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; +public class CombineTernaryInstruction extends TernaryInstruction { -public class CombineTernaryInstruction extends TernaryInstruction -{ - - public CombineTernaryInstruction(OperationTypes op, byte in1, byte in2, - byte in3, byte out, String istr) { + private CombineTernaryInstruction(OperationTypes op, byte in1, byte in2, byte in3, byte out, String istr) { super(op, in1, in2, in3, out, -1, -1, istr); mrtype = MRINSTRUCTION_TYPE.CombineTernary; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineUnaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineUnaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineUnaryInstruction.java index 8d3affc..4c4f4b0 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineUnaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CombineUnaryInstruction.java @@ -26,14 +26,12 @@ import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.Operator; +public class CombineUnaryInstruction extends UnaryMRInstructionBase { -public class CombineUnaryInstruction extends UnaryMRInstructionBase -{ - /* * combineunary:::0:DOUBLE:::1:DOUBLE */ - public CombineUnaryInstruction(Operator op, byte in, byte out, String istr) { + private CombineUnaryInstruction(Operator op, byte in, byte out, String istr) { super(op, in, out); mrtype = MRINSTRUCTION_TYPE.CombineUnary; instString = istr; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeAggregateInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeAggregateInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeAggregateInstruction.java index 825fecb..ee85fca 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeAggregateInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeAggregateInstruction.java @@ -33,17 +33,13 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator; import org.apache.sysml.runtime.matrix.operators.Operator; - -public class CumulativeAggregateInstruction extends AggregateUnaryInstruction -{ - +public class CumulativeAggregateInstruction extends AggregateUnaryInstruction { private MatrixCharacteristics _mcIn = null; - - public CumulativeAggregateInstruction(Operator op, byte in, byte out, String istr) - { + + private CumulativeAggregateInstruction(Operator op, byte in, byte out, String istr) { super(op, in, out, true, istr); } - + public void setMatrixCharacteristics( MatrixCharacteristics mcIn ) { _mcIn = mcIn; http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeOffsetInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeOffsetInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeOffsetInstruction.java index 20ea366..fe3655f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeOffsetInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeOffsetInstruction.java @@ -31,35 +31,28 @@ import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; import org.apache.sysml.runtime.matrix.operators.UnaryOperator; - -public class CumulativeOffsetInstruction extends BinaryInstruction -{ - +public class CumulativeOffsetInstruction extends BinaryInstruction { private BinaryOperator _bop = null; private UnaryOperator _uop = null; - - public CumulativeOffsetInstruction(byte in1, byte in2, byte out, String opcode, String istr) - { + + private CumulativeOffsetInstruction(byte in1, byte in2, byte out, String opcode, String istr) { super(null, in1, in2, out, istr); - if( "bcumoffk+".equals(opcode) ) { + if ("bcumoffk+".equals(opcode)) { _bop = new BinaryOperator(Plus.getPlusFnObject()); _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucumk+")); - } - else if( "bcumoff*".equals(opcode) ){ + } else if ("bcumoff*".equals(opcode)) { _bop = new BinaryOperator(Multiply.getMultiplyFnObject()); - _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucum*")); - } - else if( "bcumoffmin".equals(opcode) ){ + _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucum*")); + } else if ("bcumoffmin".equals(opcode)) { _bop = new BinaryOperator(Builtin.getBuiltinFnObject("min")); - _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummin")); - } - else if( "bcumoffmax".equals(opcode) ){ + _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummin")); + } else if ("bcumoffmax".equals(opcode)) { _bop = new BinaryOperator(Builtin.getBuiltinFnObject("max")); - _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummax")); + _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummax")); } } - + public static CumulativeOffsetInstruction parseInstruction ( String str ) throws DMLRuntimeException { http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeSplitInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeSplitInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeSplitInstruction.java index 06e7757..610bffb 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeSplitInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CumulativeSplitInstruction.java @@ -30,15 +30,12 @@ import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; import org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue; -public class CumulativeSplitInstruction extends UnaryInstruction -{ - +public class CumulativeSplitInstruction extends UnaryInstruction { private MatrixCharacteristics _mcIn = null; private long _lastRowBlockIndex = -1; private double _initValue = 0; - - public CumulativeSplitInstruction(byte in, byte out, double init, String istr) - { + + private CumulativeSplitInstruction(byte in, byte out, double init, String istr) { super(null, in, out, istr); _initValue = init; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/DataGenMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/DataGenMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/DataGenMRInstruction.java index 9647b57..5dd9f22 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/DataGenMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/DataGenMRInstruction.java @@ -22,9 +22,7 @@ package org.apache.sysml.runtime.instructions.mr; import org.apache.sysml.hops.Hop.DataGenMethod; import org.apache.sysml.runtime.matrix.operators.Operator; -public abstract class DataGenMRInstruction extends MRInstruction -{ - +public abstract class DataGenMRInstruction extends MRInstruction { protected DataGenMethod method; protected byte input; protected long rows; @@ -32,19 +30,19 @@ public abstract class DataGenMRInstruction extends MRInstruction protected int rowsInBlock; protected int colsInBlock; protected String baseDir; - - public DataGenMRInstruction(Operator op, DataGenMethod mthd, byte in, byte out, long r, long c, int rpb, int cpb, String dir) - { + + protected DataGenMRInstruction(Operator op, DataGenMethod mthd, byte in, byte out, long r, long c, int rpb, int cpb, + String dir) { super(op, out); method = mthd; - input=in; + input = in; rows = r; cols = c; rowsInBlock = rpb; colsInBlock = cpb; baseDir = dir; } - + public DataGenMethod getDataGenMethod() { return method; } http://git-wip-us.apache.org/repos/asf/systemml/blob/55b73422/src/main/java/org/apache/sysml/runtime/instructions/mr/DataPartitionMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/DataPartitionMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/DataPartitionMRInstruction.java index 24a3018..5e9c047 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/DataPartitionMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/DataPartitionMRInstruction.java @@ -27,14 +27,12 @@ import org.apache.sysml.runtime.matrix.operators.Operator; * Dummy instruction for cost estimation of data partition mr. * */ -public class DataPartitionMRInstruction extends UnaryInstruction -{ - - public DataPartitionMRInstruction(Operator op, byte in, byte out, String istr) - { +public class DataPartitionMRInstruction extends UnaryInstruction { + + private DataPartitionMRInstruction(Operator op, byte in, byte out, String istr) { super(op, in, out, istr); } - + public static DataPartitionMRInstruction parseInstruction ( String str ) throws DMLRuntimeException {
