http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 ea39010..e3e4126 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 @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; @@ -43,19 +42,15 @@ public class AppendGInstruction extends AppendInstruction { _len = _offset + _offset2; } - public static AppendGInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static AppendGInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionParts ( str ); InstructionUtils.checkNumFields (parts, 6); - byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); long offset = (long)(Double.parseDouble(parts[3])); long len = (long)(Double.parseDouble(parts[4])); byte out = Byte.parseByte(parts[5]); boolean cbind = Boolean.parseBoolean(parts[6]); - return new AppendGInstruction(null, in1, in2, offset, len, out, cbind, str); } @@ -63,7 +58,6 @@ public class AppendGInstruction extends AppendInstruction { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int brlen, int bclen) - throws DMLRuntimeException { //setup basic meta data int blen = _cbind ? bclen : brlen;
http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 f92d62c..59c6714 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 @@ -40,9 +40,7 @@ public class AppendInstruction extends BinaryMRInstructionBase { return _cbind; } - public static AppendInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static AppendInstruction parseInstruction ( String str ) { String opcode = InstructionUtils.getOpCode(str); if( opcode.equals("mappend") ) return AppendMInstruction.parseInstruction(str); @@ -57,9 +55,7 @@ public class AppendInstruction extends BinaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, - CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int brlen, int bclen) - throws DMLRuntimeException - { + CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int brlen, int bclen) { throw new DMLRuntimeException("Operations on base append instruction not supported."); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 0294121..a14acb2 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 @@ -22,7 +22,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; import org.apache.sysml.lops.AppendM.CacheType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.data.MatrixValue; @@ -42,19 +41,15 @@ public class AppendMInstruction extends AppendInstruction implements IDistribute _offset = offset; } - public static AppendMInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static AppendMInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionParts ( str ); InstructionUtils.checkNumFields(parts, 6); - byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); long offset = (long)(Double.parseDouble(parts[3])); byte out = Byte.parseByte(parts[4]); CacheType type = CacheType.valueOf(parts[5]); boolean cbind = Boolean.parseBoolean(parts[6]); - return new AppendMInstruction(null, in1, in2, offset, type, out, cbind, str); } @@ -72,8 +67,7 @@ public class AppendMInstruction extends AppendInstruction implements IDistribute public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input1); if( blkList == null ) return; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 32e61e2..6adef18 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 @@ -32,25 +32,20 @@ public class AppendRInstruction extends AppendInstruction { super(op, in1, in2, out, cbind, istr); } - public static AppendRInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static AppendRInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionParts ( str ); InstructionUtils.checkNumFields(parts, 4); - byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); byte out = Byte.parseByte(parts[3]); boolean cbind = Boolean.parseBoolean(parts[4]); - return new AppendRInstruction(null, in1, in2, out, cbind, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int brlen, int bclen) - throws DMLRuntimeException - { + { //get both inputs IndexedMatrixValue left = cachedValues.getFirst(input1); IndexedMatrixValue right = cachedValues.getFirst(input2); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 90c33ff..f55dd88 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 @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; @@ -50,27 +49,21 @@ public class BinUaggChainInstruction extends UnaryInstruction { instString = istr; } - public static BinUaggChainInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static BinUaggChainInstruction parseInstruction( String str ) { //check number of fields (2/3 inputs, output, type) InstructionUtils.checkNumFields ( str, 4 ); - //parse instruction parts (without exec type) - String[] parts = InstructionUtils.getInstructionParts( str ); - + String[] parts = InstructionUtils.getInstructionParts( str ); BinaryOperator bop = InstructionUtils.parseBinaryOperator(parts[1]); AggregateUnaryOperator uaggop = InstructionUtils.parseBasicAggregateUnaryOperator(parts[2]); byte in1 = Byte.parseByte(parts[3]); byte out = Byte.parseByte(parts[4]); - return new BinUaggChainInstruction(bop, uaggop, in1, out, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, - IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException + IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { ArrayList<IndexedMatrixValue> blkList = cachedValues.get( input ); if( blkList == null ) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 cde7f78..18e57cb 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 @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.instructions.mr; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; import org.apache.sysml.runtime.matrix.data.MatrixValue; @@ -36,31 +35,23 @@ public class BinaryInstruction extends BinaryMRInstructionBase { instString = istr; } - public static BinaryInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static BinaryInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 3 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - byte in1, in2, out; String opcode = parts[0]; in1 = Byte.parseByte(parts[1]); in2 = Byte.parseByte(parts[2]); out = Byte.parseByte(parts[3]); - BinaryOperator bop = InstructionUtils.parseBinaryOperator(opcode); - if( bop != null ) - return new BinaryInstruction(MRType.Binary, bop, in1, in2, out, str); - else - return null; + return (bop == null) ? null : + new BinaryInstruction(MRType.Binary, bop, in1, in2, out, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, - int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + int blockRowFactor, int blockColFactor) { IndexedMatrixValue in1=cachedValues.getFirst(input1); IndexedMatrixValue in2=cachedValues.getFirst(input2); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 c8ebdfd..428016f 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 @@ -23,7 +23,6 @@ import java.util.ArrayList; import org.apache.sysml.lops.AppendM.CacheType; import org.apache.sysml.lops.BinaryM.VectorType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.data.OperationsOnMatrixValues; @@ -43,13 +42,9 @@ public class BinaryMInstruction extends BinaryMRInstructionBase implements IDist _vectorType = vtype; } - public static BinaryMInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static BinaryMInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 5 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - byte in1, in2, out; String opcode = parts[0]; in1 = Byte.parseByte(parts[1]); @@ -57,7 +52,6 @@ public class BinaryMInstruction extends BinaryMRInstructionBase implements IDist out = Byte.parseByte(parts[3]); CacheType ctype = CacheType.valueOf(parts[4]); VectorType vtype = VectorType.valueOf(parts[5]); - BinaryOperator bop = InstructionUtils.parseExtendedBinaryOperator(opcode); return new BinaryMInstruction(bop, in1, in2, ctype, vtype, out, str); } @@ -65,15 +59,11 @@ public class BinaryMInstruction extends BinaryMRInstructionBase implements IDist @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, - int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + int blockRowFactor, int blockColFactor) { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input1); if( blkList == null ) return; - - for(IndexedMatrixValue in1 : blkList) - { + for(IndexedMatrixValue in1 : blkList) { //allocate space for the output value //try to avoid coping as much as possible IndexedMatrixValue out; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 6c69cc2..7c6f41e 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 @@ -38,9 +38,7 @@ public class CM_N_COVInstruction extends UnaryMRInstructionBase { instString = istr; } - public static CM_N_COVInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static CM_N_COVInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionParts ( str ); byte in, out; @@ -81,8 +79,7 @@ public class CM_N_COVInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("no processInstruction for AggregateInstruction!"); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 050225b..4e84a34 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 @@ -44,13 +44,10 @@ public class CSVWriteInstruction extends UnaryMRInstructionBase { Operator op = null; byte input, output; String[] s=str.split(Instruction.OPERAND_DELIM); - String[] in1f = s[2].split(Instruction.DATATYPE_PREFIX); input=Byte.parseByte(in1f[0]); - String[] outf = s[3].split(Instruction.DATATYPE_PREFIX); output=Byte.parseByte(outf[0]); - String header=s[4]; String delim=s[5]; boolean sparse=Boolean.parseBoolean(s[6]); @@ -60,8 +57,7 @@ public class CSVWriteInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { - throw new DMLRuntimeException("CSVWriteInstruction.processInstruction should never be called"); + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { + throw new DMLRuntimeException("CSVWriteInstruction.processInstruction should never be called"); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 2359845..3676f02 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 @@ -38,19 +38,15 @@ public class CombineBinaryInstruction extends BinaryMRInstructionBase { instString = istr; } - public static CombineBinaryInstruction parseInstruction ( String str ) throws DMLRuntimeException { - + public static CombineBinaryInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 4 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - byte in1, in2, out; String opcode = parts[0]; boolean isWeight=Boolean.parseBoolean(parts[1]); in1 = Byte.parseByte(parts[2]); in2 = Byte.parseByte(parts[3]); out = Byte.parseByte(parts[4]); - if ( opcode.equalsIgnoreCase("combinebinary") ) { return new CombineBinaryInstruction(null, isWeight, in1, in2, out, str); }else @@ -65,8 +61,7 @@ public class CombineBinaryInstruction extends BinaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("CombineInstruction.processInstruction should never be called!"); } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 7db8616..7f66d31 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 @@ -32,31 +32,25 @@ public class CombineTernaryInstruction extends CtableInstruction { super(MRType.CombineTernary, op, in1, in2, in3, out, -1, -1, istr); } - public static CombineTernaryInstruction parseInstruction ( String str ) throws DMLRuntimeException { - + public static CombineTernaryInstruction parseInstruction ( String str ) { // example instruction string - ctabletransform:::0:DOUBLE:::1:DOUBLE:::2:DOUBLE:::3:DOUBLE InstructionUtils.checkNumFields ( str, 4 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - byte in1, in2, in3, out; String opcode = parts[0]; in1 = Byte.parseByte(parts[1]); in2 = Byte.parseByte(parts[2]); in3 = Byte.parseByte(parts[3]); out = Byte.parseByte(parts[4]); - - if ( opcode.equalsIgnoreCase("combineternary") ) { + if ( opcode.equalsIgnoreCase("combineternary") ) return new CombineTernaryInstruction(null, in1, in2, in3, out, str); - } return null; } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, - int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("CombineTernaryInstruction.processInstruction should never be called!"); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 d255148..2a3525e 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 @@ -33,17 +33,13 @@ public class CombineUnaryInstruction extends UnaryMRInstructionBase { instString = istr; } - public static CombineUnaryInstruction parseInstruction ( String str ) throws DMLRuntimeException { - + public static CombineUnaryInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 2 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - byte in, out; String opcode = parts[0]; in = Byte.parseByte(parts[1]); out = Byte.parseByte(parts[2]); - if ( opcode.equalsIgnoreCase("combineunary") ) { return new CombineUnaryInstruction(null, in, out, str); }else @@ -53,10 +49,7 @@ public class CombineUnaryInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("CombineInstruction.processInstruction should never be called!"); - } - } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/CtableInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/CtableInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/CtableInstruction.java index 9bb9973..4a99d59 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/CtableInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/CtableInstruction.java @@ -103,14 +103,7 @@ public class CtableInstruction extends MRInstruction { } public static CtableInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { - // example instruction string - // - ctabletransform:::0:DOUBLE:::1:DOUBLE:::2:DOUBLE:::3:DOUBLE - // - ctabletransformscalarweight:::0:DOUBLE:::1:DOUBLE:::1.0:DOUBLE:::3:DOUBLE - // - ctabletransformhistogram:::0:DOUBLE:::1.0:DOUBLE:::1.0:DOUBLE:::3:DOUBLE - // - ctabletransformweightedhistogram:::0:DOUBLE:::1:INT:::1:DOUBLE:::2:DOUBLE - + { //check number of fields InstructionUtils.checkNumFields ( str, 6 ); @@ -160,12 +153,9 @@ public class CtableInstruction extends MRInstruction { public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue zeroInput, HashMap<Byte, CTableMap> resultMaps, HashMap<Byte, MatrixBlock> resultBlocks, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { - + { IndexedMatrixValue in1, in2, in3 = null; in1 = cachedValues.getFirst(input1); - CTableMap ctableResult = null; MatrixBlock ctableResultBlock = null; @@ -238,26 +228,24 @@ public class CtableInstruction extends MRInstruction { break; } default: - throw new DMLRuntimeException("Unrecognized opcode in Tertiary Instruction: " + instString); + throw new DMLRuntimeException("Unrecognized opcode in Tertiary Instruction: " + instString); } } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, - int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("This function should not be called!"); } @Override - public byte[] getAllIndexes() throws DMLRuntimeException { + public byte[] getAllIndexes() { return new byte[]{input1, input2, input3, output}; } @Override - public byte[] getInputIndexes() throws DMLRuntimeException { + public byte[] getInputIndexes() { return new byte[]{input1, input2, input3}; } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 ee85fca..ca5172d 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 @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.MatrixCharacteristics; import org.apache.sysml.runtime.matrix.data.MatrixBlock; @@ -45,27 +44,20 @@ public class CumulativeAggregateInstruction extends AggregateUnaryInstruction { _mcIn = mcIn; } - public static CumulativeAggregateInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static CumulativeAggregateInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 2 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - String opcode = parts[0]; byte in = Byte.parseByte(parts[1]); byte out = Byte.parseByte(parts[2]); - AggregateUnaryOperator aggun = InstructionUtils.parseCumulativeAggregateUnaryOperator(opcode); - return new CumulativeAggregateInstruction(aggun, in, out, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList == null ) return; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 fadea8d..817ba31 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 @@ -53,26 +53,20 @@ public class CumulativeOffsetInstruction extends BinaryInstruction { } } - public static CumulativeOffsetInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static CumulativeOffsetInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 3 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - String opcode = parts[0]; byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); byte out = Byte.parseByte(parts[3]); - return new CumulativeOffsetInstruction(in1, in2, out, opcode, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { IndexedMatrixValue in1 = cachedValues.getFirst(input1); //original data IndexedMatrixValue in2 = cachedValues.getFirst(input2); //offset row vector http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 bc21b47..80777bd 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 @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.MatrixCharacteristics; import org.apache.sysml.runtime.matrix.data.MatrixBlock; @@ -46,25 +45,19 @@ public class CumulativeSplitInstruction extends UnaryInstruction { _lastRowBlockIndex = (long)Math.ceil((double)_mcIn.getRows()/_mcIn.getRowsPerBlock()); } - public static CumulativeSplitInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static CumulativeSplitInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 3 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - byte in = Byte.parseByte(parts[1]); byte out = Byte.parseByte(parts[2]); double init = Double.parseDouble(parts[3]); - return new CumulativeSplitInstruction(in, out, init, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList == null ) return; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/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 48e90ec..02d02ac 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 @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.instructions.mr; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.operators.Operator; @@ -33,17 +32,12 @@ public class DataPartitionMRInstruction extends UnaryInstruction { super(MRType.Partition, op, in, out, istr); } - public static DataPartitionMRInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static DataPartitionMRInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 3 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); byte in, out; in = Byte.parseByte(parts[1]); out = Byte.parseByte(parts[2]); - return new DataPartitionMRInstruction(null, in, out, str); } - } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java index 2da328b..28ce7cb 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateInstruction.java @@ -63,15 +63,11 @@ public class GroupedAggregateInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, - int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("GroupedAggregateInstruction.processInstruction() should not be called!"); - } - public static GroupedAggregateInstruction parseInstruction ( String str ) throws DMLRuntimeException { - + public static GroupedAggregateInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionParts ( str ); if(parts.length<3) throw new DMLRuntimeException("the number of fields of instruction "+str+" is less than 2!"); @@ -81,16 +77,13 @@ public class GroupedAggregateInstruction extends UnaryMRInstructionBase { out = Byte.parseByte(parts[parts.length - 3]); boolean weights = Boolean.parseBoolean(parts[parts.length-2]); int ngroups = Integer.parseInt(parts[parts.length-1]); - - if ( !opcode.equalsIgnoreCase("groupedagg") ) { + if ( !opcode.equalsIgnoreCase("groupedagg") ) throw new DMLRuntimeException("Invalid opcode in GroupedAggregateInstruction: " + opcode); - } - Operator optr = parseGroupedAggOperator(parts[2], parts[3]); return new GroupedAggregateInstruction(optr, in, out, weights, ngroups, str); } - public static Operator parseGroupedAggOperator(String fn, String other) throws DMLRuntimeException { + public static Operator parseGroupedAggOperator(String fn, String other) { AggregateOperationTypes op = AggregateOperationTypes.INVALID; if ( fn.equalsIgnoreCase("centralmoment") ) // in case of CM, we also need to pass "order" http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java index 6af0e70..a1256af 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/GroupedAggregateMInstruction.java @@ -22,7 +22,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; import org.apache.sysml.lops.PartialAggregate.CorrectionLocationType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.functionobjects.KahanPlus; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.MatrixCharacteristics; @@ -45,29 +44,22 @@ public class GroupedAggregateMInstruction extends BinaryMRInstructionBase implem _ngroups = ngroups; } - public static GroupedAggregateMInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static GroupedAggregateMInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionParts ( str ); InstructionUtils.checkNumFields(parts, 5); - byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); byte out = Byte.parseByte(parts[3]); int ngroups = Integer.parseInt(parts[4]); //partitioning ignored - Operator op = new AggregateOperator(0, KahanPlus.getKahanPlusFnObject(), true, CorrectionLocationType.LASTCOLUMN); - return new GroupedAggregateMInstruction(op, in1, in2, out, ngroups, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, - int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + int blockRowFactor, int blockColFactor) { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input1); if( blkList == null ) return; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java index be2da27..9d308cb 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MMTSJMRInstruction.java @@ -44,17 +44,13 @@ public class MMTSJMRInstruction extends UnaryInstruction { return _type; } - public static MMTSJMRInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static MMTSJMRInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 3 ); - String[] parts = InstructionUtils.getInstructionParts(str); String opcode = parts[0]; byte in = Byte.parseByte(parts[1]); byte out = Byte.parseByte(parts[2]); MMTSJType titype = MMTSJType.valueOf(parts[3]); - if(!opcode.equalsIgnoreCase("tsmm")) throw new DMLRuntimeException("Unknown opcode while parsing an MMTIJMRInstruction: " + str); else @@ -65,8 +61,7 @@ public class MMTSJMRInstruction extends UnaryInstruction { public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList !=null ) for(IndexedMatrixValue imv : blkList) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java index 0cc105c..41f29b3 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MRInstruction.java @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.instructions.mr; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.Instruction; import org.apache.sysml.runtime.matrix.data.MatrixValue; @@ -57,17 +56,14 @@ public abstract class MRInstruction extends Instruction { } @Override - public void processInstruction(ExecutionContext ec) throws DMLRuntimeException { + public void processInstruction(ExecutionContext ec) { //do nothing (not applicable for MR instructions) } public abstract void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, - IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException; + IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor); - public abstract byte[] getInputIndexes() - throws DMLRuntimeException; + public abstract byte[] getInputIndexes(); - public abstract byte[] getAllIndexes() - throws DMLRuntimeException; + public abstract byte[] getAllIndexes(); } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java index 0701293..0afeb5d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MapMultChainInstruction.java @@ -22,7 +22,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; import org.apache.sysml.lops.MapMultChain.ChainType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; @@ -97,14 +96,12 @@ public class MapMultChainInstruction extends MRInstruction implements IDistribut return _input3; } - public static MapMultChainInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static MapMultChainInstruction parseInstruction( String str ) { //check number of fields (2/3 inputs, output, type) InstructionUtils.checkNumFields ( str, 4, 5 ); //parse instruction parts (without exec type) - String[] parts = InstructionUtils.getInstructionParts( str ); + String[] parts = InstructionUtils.getInstructionParts( str ); byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); @@ -122,32 +119,29 @@ public class MapMultChainInstruction extends MRInstruction implements IDistribut ChainType type = ChainType.valueOf(parts[5]); return new MapMultChainInstruction(type, in1, in2, in3, out, str); - } + } } @Override //IDistributedCacheConsumer - public boolean isDistCacheOnlyIndex( String inst, byte index ) - { + public boolean isDistCacheOnlyIndex( String inst, byte index ) { return (_chainType == ChainType.XtXv) ? (index==_input2 && index!=_input1) : (index==_input2 && index!=_input1) || (index==_input3 && index!=_input1); } @Override //IDistributedCacheConsumer - public void addDistCacheIndex( String inst, ArrayList<Byte> indexes ) - { + public void addDistCacheIndex( String inst, ArrayList<Byte> indexes ) { if( _chainType == ChainType.XtXv ){ indexes.add(_input2); } else { indexes.add(_input2); - indexes.add(_input3); + indexes.add(_input3); } } @Override - public byte[] getInputIndexes() - { + public byte[] getInputIndexes() { if( _chainType==ChainType.XtXv ) return new byte[]{_input1, _input2}; else @@ -155,8 +149,7 @@ public class MapMultChainInstruction extends MRInstruction implements IDistribut } @Override - public byte[] getAllIndexes() - { + public byte[] getAllIndexes() { if( _chainType==ChainType.XtXv ) return new byte[]{_input1, _input2, output}; else @@ -167,7 +160,6 @@ public class MapMultChainInstruction extends MRInstruction implements IDistribut @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(_input1); if( blkList !=null ) @@ -209,15 +201,11 @@ public class MapMultChainInstruction extends MRInstruction implements IDistribut * @param inVal input matrix value * @param outIx output matrix indexes * @param outVal output matrix value - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - private void processXtXvOperations(MatrixIndexes inIx, MatrixValue inVal, MatrixIndexes outIx, MatrixValue outVal ) - throws DMLRuntimeException - { + private void processXtXvOperations(MatrixIndexes inIx, MatrixValue inVal, MatrixIndexes outIx, MatrixValue outVal ) { DistributedCacheInput dcInput2 = MRBaseForCommonInstructions.dcValues.get(_input2); //v MatrixBlock Xi = (MatrixBlock)inVal; MatrixBlock v = (MatrixBlock) dcInput2.getDataBlock(1, 1).getValue(); - //process core block operation Xi.chainMatrixMultOperations(v, null, (MatrixBlock) outVal, ChainType.XtXv); outIx.setIndexes(1, 1); @@ -231,17 +219,13 @@ public class MapMultChainInstruction extends MRInstruction implements IDistribut * @param inVal input matrix value * @param outIx output matrix indexes * @param outVal output matrix value - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - private void processXtwXvOperations(MatrixIndexes inIx, MatrixValue inVal, MatrixIndexes outIx, MatrixValue outVal, ChainType chain ) - throws DMLRuntimeException - { + private void processXtwXvOperations(MatrixIndexes inIx, MatrixValue inVal, MatrixIndexes outIx, MatrixValue outVal, ChainType chain ) { DistributedCacheInput dcInput2 = MRBaseForCommonInstructions.dcValues.get(_input2); //v DistributedCacheInput dcInput3 = MRBaseForCommonInstructions.dcValues.get(_input3); //w MatrixBlock Xi = (MatrixBlock) inVal; MatrixBlock v = (MatrixBlock) dcInput2.getDataBlock(1, 1).getValue(); MatrixBlock w = (MatrixBlock) dcInput3.getDataBlock((int)inIx.getRowIndex(), 1).getValue(); - //process core block operation Xi.chainMatrixMultOperations(v, w, (MatrixBlock) outVal, chain); outIx.setIndexes(1, 1); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java index 00c2240..c252cc5 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/MatrixReshapeMRInstruction.java @@ -51,11 +51,8 @@ public class MatrixReshapeMRInstruction extends UnaryInstruction { _mcIn = mcIn; } - public static MatrixReshapeMRInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static MatrixReshapeMRInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 5 ); - String[] parts = InstructionUtils.getInstructionParts(str); String opcode = parts[0]; byte in = Byte.parseByte(parts[1]); @@ -63,7 +60,6 @@ public class MatrixReshapeMRInstruction extends UnaryInstruction { long cols = UtilFunctions.toLong(Double.parseDouble(parts[3])); //save cast boolean byrow = Boolean.parseBoolean(parts[4]); byte out = Byte.parseByte(parts[5]); - if(!opcode.equalsIgnoreCase("rshape")) throw new DMLRuntimeException("Unknown opcode while parsing an MatrixReshapeMRInstruction: " + str); else @@ -74,8 +70,7 @@ public class MatrixReshapeMRInstruction extends UnaryInstruction { public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int brlen, int bclen ) - throws DMLRuntimeException - { + { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList != null ) for(IndexedMatrixValue imv : blkList) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java index 72d8d14..a5a790f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/PMMJMRInstruction.java @@ -54,11 +54,8 @@ public class PMMJMRInstruction extends BinaryMRInstructionBase implements IDistr return _outputEmptyBlocks; } - public static PMMJMRInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static PMMJMRInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 6 ); - String[] parts = InstructionUtils.getInstructionParts(str); String opcode = parts[0]; byte in1 = Byte.parseByte(parts[1]); @@ -67,10 +64,8 @@ public class PMMJMRInstruction extends BinaryMRInstructionBase implements IDistr byte out = Byte.parseByte(parts[4]); CacheType ctype = CacheType.valueOf(parts[5]); boolean outputEmpty = Boolean.parseBoolean(parts[6]); - if(!opcode.equalsIgnoreCase("pmm")) throw new DMLRuntimeException("Unknown opcode while parsing an PmmMRInstruction: " + str); - return new PMMJMRInstruction(new Operator(true), in1, in2, out, nrow, ctype, outputEmpty, str); } @@ -78,8 +73,7 @@ public class PMMJMRInstruction extends BinaryMRInstructionBase implements IDistr public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { //get both matrix inputs (left side always permutation) DistributedCacheInput dcInput = MRBaseForCommonInstructions.dcValues.get(input1); IndexedMatrixValue in2 = cachedValues.getFirst(input2); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java index 262f8ac..cf6ad40 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ParameterizedBuiltinMRInstruction.java @@ -85,9 +85,7 @@ public class ParameterizedBuiltinMRInstruction extends UnaryInstruction { } } - public static ParameterizedBuiltinMRInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static ParameterizedBuiltinMRInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionParts(str); String opcode = parts[0]; @@ -124,8 +122,7 @@ public class ParameterizedBuiltinMRInstruction extends UnaryInstruction { public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList !=null ) for(IndexedMatrixValue imv : blkList) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java index a7c9120..607084c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/PickByCountInstruction.java @@ -51,43 +51,34 @@ public class PickByCountInstruction extends MRInstruction { isValuePick = false; } - public static PickByCountInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static PickByCountInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 5 ); String[] parts = InstructionUtils.getInstructionParts ( str ); - OperationTypes ptype = OperationTypes.valueOf(parts[4]); - - if ( ptype == OperationTypes.VALUEPICK ) - { + if ( ptype == OperationTypes.VALUEPICK ) { byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); byte out = Byte.parseByte(parts[3]); return new PickByCountInstruction(null, in1, in2, out, str); } - else if ( ptype == OperationTypes.RANGEPICK ) - { + else if ( ptype == OperationTypes.RANGEPICK ) { byte in1 = Byte.parseByte(parts[1]); double cstant = Double.parseDouble(parts[2]); byte out = Byte.parseByte(parts[3]); return new PickByCountInstruction(null, in1, cstant, out, str); } - return null; } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("PickByCountInstruction.processInstruction should never be called!"); - } @Override - public byte[] getAllIndexes() throws DMLRuntimeException { + public byte[] getAllIndexes() { if( isValuePick ) { return new byte[]{input1,input2,output}; } @@ -98,7 +89,7 @@ public class PickByCountInstruction extends MRInstruction { } @Override - public byte[] getInputIndexes() throws DMLRuntimeException { + public byte[] getInputIndexes() { if( isValuePick ) { return new byte[]{input1,input2}; } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java index 98504b0..bf7dfdf 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/QuaternaryInstruction.java @@ -109,9 +109,7 @@ public class QuaternaryInstruction extends MRInstruction implements IDistributed } } - public static QuaternaryInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static QuaternaryInstruction parseInstruction( String str ) { String opcode = InstructionUtils.getOpCode(str); //validity check @@ -281,7 +279,6 @@ public class QuaternaryInstruction extends MRInstruction implements IDistributed @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { QuaternaryOperator qop = (QuaternaryOperator)optr; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java index dac987b..00c939f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/RandInstruction.java @@ -20,7 +20,6 @@ package org.apache.sysml.runtime.instructions.mr; import org.apache.sysml.hops.Hop.DataGenMethod; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; @@ -73,12 +72,10 @@ public class RandInstruction extends DataGenMRInstruction { return seed; } - public static RandInstruction parseInstruction(String str) throws DMLRuntimeException + public static RandInstruction parseInstruction(String str) { InstructionUtils.checkNumFields ( str, 13 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - Operator op = null; byte input = Byte.parseByte(parts[1]); byte output = Byte.parseByte(parts[2]); @@ -93,16 +90,13 @@ public class RandInstruction extends DataGenMRInstruction { String baseDir = parts[11]; String pdf = parts[12]; String pdfParams = parts[13]; - return new RandInstruction(op, input, output, rows, cols, rpb, cpb, minValue, maxValue, sparsity, seed, pdf, pdfParams, baseDir, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { //do nothing (only meta carrier, handled in special job type) - } + } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java index 6c48c3f..0d4ef93 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/RangeBasedReIndexInstruction.java @@ -58,12 +58,9 @@ public class RangeBasedReIndexInstruction extends UnaryMRInstructionBase { mcIn.getRowsPerBlock(), mcIn.getColsPerBlock(), -1); } - public static RangeBasedReIndexInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static RangeBasedReIndexInstruction parseInstruction( String str ) { InstructionUtils.checkNumFields ( str, 8 ); String[] parts = InstructionUtils.getInstructionParts ( str ); - String opcode = parts[0]; boolean forLeft = false; if(opcode.equalsIgnoreCase(RightIndex.OPCODE+"ForLeft")) @@ -71,14 +68,12 @@ public class RangeBasedReIndexInstruction extends UnaryMRInstructionBase { else if(!opcode.equalsIgnoreCase(RightIndex.OPCODE)) throw new DMLRuntimeException("Unknown opcode while parsing a Select: " + str); byte in = Byte.parseByte(parts[1]); - IndexRange rng=new IndexRange(UtilFunctions.parseToLong(parts[2]), - UtilFunctions.parseToLong(parts[3]), - UtilFunctions.parseToLong(parts[4]), - UtilFunctions.parseToLong(parts[5])); + IndexRange rng=new IndexRange( + UtilFunctions.parseToLong(parts[2]), UtilFunctions.parseToLong(parts[3]), + UtilFunctions.parseToLong(parts[4]), UtilFunctions.parseToLong(parts[5])); byte out = Byte.parseByte(parts[6]); long rlen = Long.parseLong(parts[7]); long clen = Long.parseLong(parts[8]); - return new RangeBasedReIndexInstruction(new ReIndexOperator(), in, out, rng, forLeft, rlen, clen, str); } @@ -86,8 +81,7 @@ public class RangeBasedReIndexInstruction extends UnaryMRInstructionBase { public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + { if(input==output) throw new DMLRuntimeException("input cannot be the same for output for "+instString); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java index 97d12c2..a474658 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReblockInstruction.java @@ -62,10 +62,7 @@ public class ReblockInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { throw new DMLRuntimeException("ReblockInstruction.processInstruction should never be called"); - } - } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java index fa26152..c2700ef 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/RemoveEmptyMRInstruction.java @@ -62,33 +62,25 @@ public class RemoveEmptyMRInstruction extends BinaryInstruction { return _len; } - public static RemoveEmptyMRInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static RemoveEmptyMRInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields (str, 6); - String[] parts = InstructionUtils.getInstructionParts(str); String opcode = parts[0]; - if(!opcode.equalsIgnoreCase("rmempty")) throw new DMLRuntimeException("Unknown opcode while parsing an RemoveEmptyMRInstruction: " + str); - byte in1 = Byte.parseByte(parts[1]); byte in2 = Byte.parseByte(parts[2]); long rlen = UtilFunctions.toLong(Double.parseDouble(parts[3])); boolean rmRows = parts[4].equals("rows"); boolean emptyRet = Boolean.parseBoolean(parts[5].toLowerCase()); byte out = Byte.parseByte(parts[6]); - return new RemoveEmptyMRInstruction(null, in1, in2, rlen, rmRows, emptyRet, out, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { //get input and offsets IndexedMatrixValue inData = cachedValues.getFirst(input1); IndexedMatrixValue inOffset = cachedValues.getFirst(input2); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java index 3bfab97..2995b49 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReorgInstruction.java @@ -54,17 +54,13 @@ public class ReorgInstruction extends UnaryMRInstructionBase { _outputEmptyBlocks = flag; } - public static ReorgInstruction parseInstruction ( String str ) throws DMLRuntimeException { - + public static ReorgInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 2 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - byte in, out; String opcode = parts[0]; in = Byte.parseByte(parts[1]); out = Byte.parseByte(parts[2]); - if ( opcode.equalsIgnoreCase("r'") ) { return new ReorgInstruction(new ReorgOperator(SwapIndex.getSwapIndexFnObject()), in, out, str); } @@ -77,15 +73,12 @@ public class ReorgInstruction extends UnaryMRInstructionBase { else { throw new DMLRuntimeException("Unknown opcode while parsing a ReorgInstruction: " + str); } - } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, - int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { - + int blockRowFactor, int blockColFactor) { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList != null ) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java index 272d249..a6052b8 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ReplicateInstruction.java @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.MatrixCharacteristics; import org.apache.sysml.runtime.matrix.data.MatrixIndexes; @@ -49,19 +48,15 @@ public class ReplicateInstruction extends UnaryMRInstructionBase { mcOut.set(_lenM, mcIn.getCols(), mcIn.getRowsPerBlock(), mcIn.getColsPerBlock(), mcIn.getRows()); } - public static ReplicateInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static ReplicateInstruction parseInstruction ( String str ) { //check instruction format InstructionUtils.checkNumFields ( str, 4 ); - //parse instruction String[] parts = InstructionUtils.getInstructionParts ( str ); byte in = Byte.parseByte(parts[1]); boolean repCols = Boolean.parseBoolean(parts[2]); long len = Long.parseLong(parts[3]); byte out = Byte.parseByte(parts[4]); - //construct instruction return new ReplicateInstruction(in, out, repCols, len, str); } @@ -69,7 +64,6 @@ public class ReplicateInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java index 762a193..e3eccbd 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ScalarInstruction.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import org.apache.sysml.lops.Lop; import org.apache.sysml.parser.Expression.DataType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; @@ -37,18 +36,14 @@ public class ScalarInstruction extends UnaryMRInstructionBase { instString = istr; } - public static ScalarInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static ScalarInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 3 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); String opcode = parts[0]; boolean firstArgScalar = isFirstArgumentScalar(str); double cst = Double.parseDouble( firstArgScalar ? parts[1] : parts[2]); byte in = Byte.parseByte( firstArgScalar ? parts[2] : parts[1]); byte out = Byte.parseByte(parts[3]); - ScalarOperator sop = InstructionUtils.parseScalarBinaryOperator(opcode, firstArgScalar, cst); return new ScalarInstruction(sop, in, out, str); } @@ -56,7 +51,6 @@ public class ScalarInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList != null ) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java index c6c607b..c7ff520 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/SeqInstruction.java @@ -20,7 +20,6 @@ package org.apache.sysml.runtime.instructions.mr; import org.apache.sysml.hops.Hop.DataGenMethod; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; @@ -41,12 +40,9 @@ public class SeqInstruction extends DataGenMRInstruction { instString = istr; } - public static SeqInstruction parseInstruction(String str) throws DMLRuntimeException - { + public static SeqInstruction parseInstruction(String str) { InstructionUtils.checkNumFields ( str, 10 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - Operator op = null; byte input = Byte.parseByte(parts[1]); byte output = Byte.parseByte(parts[2]); @@ -58,17 +54,11 @@ public class SeqInstruction extends DataGenMRInstruction { double toValue = Double.parseDouble(parts[8]); double incrValue = Double.parseDouble(parts[9]); String baseDir = parts[10]; - return new SeqInstruction(op, input, output, rows, cols, rpb, cpb, fromValue, toValue, incrValue, baseDir, str); } @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { - // TODO Auto-generated method stub - - } - + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) {} } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java index d23c826..41dfd2e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/TernaryInstruction.java @@ -22,7 +22,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.Arrays; import org.apache.commons.lang3.ArrayUtils; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.instructions.cp.CPOperand; import org.apache.sysml.runtime.matrix.data.MatrixBlock; @@ -52,9 +51,7 @@ public class TernaryInstruction extends MRInstruction { m3 = input3.isMatrix() ? null :new MatrixBlock(Double.parseDouble(input3.getName())); } - public static TernaryInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static TernaryInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 4 ); String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); String opcode = parts[0]; @@ -68,9 +65,7 @@ public class TernaryInstruction extends MRInstruction { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, - IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { MatrixBlock lm1 = input1.isMatrix() ? (MatrixBlock) cachedValues.getFirst(ixinput1).getValue() : m1; MatrixBlock lm2 = input2.isMatrix() ? (MatrixBlock) cachedValues.getFirst(ixinput2).getValue() : m2; MatrixBlock lm3 = input3.isMatrix() ? (MatrixBlock) cachedValues.getFirst(ixinput3).getValue() : m3; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java index d686482..7c75b61 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/UaggOuterChainInstruction.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.Arrays; import org.apache.sysml.lops.PartialAggregate.CorrectionLocationType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.functionobjects.ReduceAll; import org.apache.sysml.runtime.functionobjects.ReduceCol; import org.apache.sysml.runtime.functionobjects.ReduceRow; @@ -66,9 +65,7 @@ public class UaggOuterChainInstruction extends BinaryInstruction implements IDis instString = istr; } - public static UaggOuterChainInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static UaggOuterChainInstruction parseInstruction( String str ) { //check number of fields (2/3 inputs, output, type) InstructionUtils.checkNumFields ( str, 5 ); @@ -102,9 +99,7 @@ public class UaggOuterChainInstruction extends BinaryInstruction implements IDis @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, - IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException - { + IndexedMatrixValue tempValue, IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { ArrayList<IndexedMatrixValue> blkList = null; boolean rightCached = (_uaggOp.indexFn instanceof ReduceCol || _uaggOp.indexFn instanceof ReduceAll || !LibMatrixOuterAgg.isSupportedUaggOp(_uaggOp, _bOp)); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java index 49f91fa..4ebe66c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/UnaryInstruction.java @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr; import java.util.ArrayList; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.InstructionUtils; import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.runtime.matrix.mapred.CachedValueMap; @@ -36,7 +35,7 @@ public class UnaryInstruction extends UnaryMRInstructionBase { instString = istr; } - public static UnaryInstruction parseInstruction ( String str ) throws DMLRuntimeException { + public static UnaryInstruction parseInstruction ( String str ) { String opcode = InstructionUtils.getOpCode(str); InstructionUtils.checkNumFields ( str, 2 ); String[] parts = InstructionUtils.getInstructionParts ( str ); @@ -50,11 +49,8 @@ public class UnaryInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { - + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); - if( blkList != null ) for(IndexedMatrixValue in : blkList ) { if(in==null) continue; @@ -72,5 +68,4 @@ public class UnaryInstruction extends UnaryMRInstructionBase { cachedValues.add(output, out); } } - } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java index db78476..47fca64 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/ZeroOutInstruction.java @@ -47,18 +47,13 @@ public class ZeroOutInstruction extends UnaryMRInstructionBase { indexRange = rng; } - public static ZeroOutInstruction parseInstruction ( String str ) throws DMLRuntimeException { - + public static ZeroOutInstruction parseInstruction ( String str ) { InstructionUtils.checkNumFields ( str, 6 ); - String[] parts = InstructionUtils.getInstructionParts ( str ); - String opcode = parts[0]; if(!opcode.equalsIgnoreCase("zeroOut")) throw new DMLRuntimeException("Unknown opcode while parsing a zeroout: " + str); byte in = Byte.parseByte(parts[1]); - - //IndexRange rng=new IndexRange(Long.parseLong(parts[2]), Long.parseLong(parts[3]), Long.parseLong(parts[4]), Long.parseLong(parts[5])); IndexRange rng=new IndexRange(UtilFunctions.parseToLong(parts[2]), UtilFunctions.parseToLong(parts[3]), UtilFunctions.parseToLong(parts[4]), @@ -70,9 +65,7 @@ public class ZeroOutInstruction extends UnaryMRInstructionBase { @Override public void processInstruction(Class<? extends MatrixValue> valueClass, CachedValueMap cachedValues, IndexedMatrixValue tempValue, - IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) - throws DMLRuntimeException { - + IndexedMatrixValue zeroInput, int blockRowFactor, int blockColFactor) { ArrayList<IndexedMatrixValue> blkList = cachedValues.get(input); if( blkList != null ) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java index 9550fcf..4d12106 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateTernarySPInstruction.java @@ -45,32 +45,25 @@ public class AggregateTernarySPInstruction extends ComputationSPInstruction { super(SPType.AggregateTernary, op, in1, in2, in3, out, opcode, istr); } - public static AggregateTernarySPInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static AggregateTernarySPInstruction parseInstruction( String str ) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); String opcode = parts[0]; - if ( opcode.equalsIgnoreCase("tak+*") || opcode.equalsIgnoreCase("tack+*") ) { InstructionUtils.checkNumFields( parts, 4 ); - CPOperand in1 = new CPOperand(parts[1]); CPOperand in2 = new CPOperand(parts[2]); CPOperand in3 = new CPOperand(parts[3]); CPOperand out = new CPOperand(parts[4]); - AggregateTernaryOperator op = InstructionUtils.parseAggregateTernaryOperator(opcode); return new AggregateTernarySPInstruction(op, in1, in2, in3, out, opcode, str); - } + } else { throw new DMLRuntimeException("AggregateTernaryInstruction.parseInstruction():: Unknown opcode " + opcode); } } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { SparkExecutionContext sec = (SparkExecutionContext)ec; //get inputs http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java index 8302150..860384f 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AggregateUnarySPInstruction.java @@ -28,7 +28,6 @@ import scala.Tuple2; import org.apache.sysml.hops.AggBinaryOp.SparkAggType; import org.apache.sysml.lops.PartialAggregate.CorrectionLocationType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext; import org.apache.sysml.runtime.instructions.InstructionUtils; @@ -54,9 +53,7 @@ public class AggregateUnarySPInstruction extends UnarySPInstruction { _aop = aop; } - public static AggregateUnarySPInstruction parseInstruction(String str) - throws DMLRuntimeException - { + public static AggregateUnarySPInstruction parseInstruction(String str) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); InstructionUtils.checkNumFields(parts, 3); String opcode = parts[0]; @@ -75,9 +72,7 @@ public class AggregateUnarySPInstruction extends UnarySPInstruction { } @Override - public void processInstruction( ExecutionContext ec ) - throws DMLRuntimeException - { + public void processInstruction( ExecutionContext ec ) { SparkExecutionContext sec = (SparkExecutionContext)ec; MatrixCharacteristics mc = sec.getMatrixCharacteristics(input1.getName()); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java index 70cf389..292f707 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGAlignedSPInstruction.java @@ -45,9 +45,7 @@ public class AppendGAlignedSPInstruction extends BinarySPInstruction { _cbind = cbind; } - public static AppendGAlignedSPInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static AppendGAlignedSPInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); InstructionUtils.checkNumFields (parts, 5); @@ -67,9 +65,7 @@ public class AppendGAlignedSPInstruction extends BinarySPInstruction { } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { // general case append (map-extend, aggregate) SparkExecutionContext sec = (SparkExecutionContext)ec; checkBinaryAppendInputCharacteristics(sec, _cbind, false, true); @@ -80,7 +76,7 @@ public class AppendGAlignedSPInstruction extends BinarySPInstruction { JavaPairRDD<MatrixIndexes,MatrixBlock> out = null; // Simple changing of matrix indexes of RHS - long shiftBy = _cbind ? mc1.getNumColBlocks() : mc1.getNumRowBlocks(); + long shiftBy = _cbind ? mc1.getNumColBlocks() : mc1.getNumRowBlocks(); out = in2.mapToPair(new ShiftColumnIndex(shiftBy, _cbind)); out = in1.union( out ); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java index 3f28f3f..6c83387 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/spark/AppendGSPInstruction.java @@ -51,9 +51,7 @@ public class AppendGSPInstruction extends BinarySPInstruction { _cbind = cbind; } - public static AppendGSPInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static AppendGSPInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); InstructionUtils.checkNumFields(parts, 6); @@ -74,9 +72,7 @@ public class AppendGSPInstruction extends BinarySPInstruction { } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { // general case append (map-extend, aggregate) SparkExecutionContext sec = (SparkExecutionContext)ec; checkBinaryAppendInputCharacteristics(sec, _cbind, false, false);
