[SYSTEMML-2191] Cleanup exception hierarchy and handling, part 3 Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/1f323976 Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/1f323976 Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/1f323976
Branch: refs/heads/master Commit: 1f3239763d52fa718b3f93d7976d017858fa1461 Parents: 583f344 Author: Matthias Boehm <[email protected]> Authored: Sat Mar 24 17:43:36 2018 -0700 Committer: Matthias Boehm <[email protected]> Committed: Sat Mar 24 17:43:36 2018 -0700 ---------------------------------------------------------------------- .../parfor/RemoteDPParForSpark.java | 2 +- .../sysml/runtime/functionobjects/Builtin.java | 14 +- .../sysml/runtime/functionobjects/CM.java | 13 +- .../sysml/runtime/functionobjects/COV.java | 6 +- .../sysml/runtime/functionobjects/CTable.java | 15 +- .../runtime/functionobjects/FunctionObject.java | 24 +- .../runtime/functionobjects/KahanPlus.java | 11 +- .../runtime/functionobjects/KahanPlusSq.java | 111 +++--- .../sysml/runtime/functionobjects/Mean.java | 3 +- .../functionobjects/ParameterizedBuiltin.java | 11 +- .../sysml/runtime/functionobjects/Plus.java | 4 +- .../runtime/functionobjects/RemoveFile.java | 51 --- .../runtime/functionobjects/RenameFile.java | 52 --- .../functionobjects/TernaryValueFunction.java | 4 +- .../instructions/CPInstructionParser.java | 14 +- .../instructions/GPUInstructionParser.java | 11 +- .../sysml/runtime/instructions/Instruction.java | 20 +- .../runtime/instructions/InstructionParser.java | 14 +- .../runtime/instructions/InstructionUtils.java | 36 +- .../instructions/MRInstructionParser.java | 97 ++--- .../runtime/instructions/MRJobInstruction.java | 12 +- .../instructions/SPInstructionParser.java | 9 +- .../cp/AggregateBinaryCPInstruction.java | 8 +- .../cp/AggregateTernaryCPInstruction.java | 18 +- .../cp/AggregateUnaryCPInstruction.java | 8 +- .../instructions/cp/AppendCPInstruction.java | 8 +- .../instructions/cp/BinaryCPInstruction.java | 18 +- .../cp/BinaryMatrixMatrixCPInstruction.java | 5 +- .../cp/BinaryMatrixScalarCPInstruction.java | 5 +- .../cp/BinaryScalarScalarCPInstruction.java | 2 +- .../instructions/cp/BreakPointInstruction.java | 5 +- .../cp/BuiltinNaryCPInstruction.java | 2 +- .../runtime/instructions/cp/CM_COV_Object.java | 36 +- .../runtime/instructions/cp/CPInstruction.java | 13 +- .../cp/CentralMomentCPInstruction.java | 8 +- .../cp/CompressionCPInstruction.java | 12 +- .../cp/ConvolutionCPInstruction.java | 23 +- .../cp/CovarianceCPInstruction.java | 21 +- .../instructions/cp/CtableCPInstruction.java | 7 +- .../sysml/runtime/instructions/cp/Data.java | 8 +- .../instructions/cp/DataGenCPInstruction.java | 6 +- .../cp/DataPartitionCPInstruction.java | 10 +- .../instructions/cp/EvalNaryCPInstruction.java | 2 +- .../cp/FrameAppendCPInstruction.java | 1 - .../cp/FrameIndexingCPInstruction.java | 14 +- .../cp/FunctionCallCPInstruction.java | 26 +- .../instructions/cp/IndexingCPInstruction.java | 8 +- .../instructions/cp/MMChainCPInstruction.java | 13 +- .../instructions/cp/MMTSJCPInstruction.java | 8 +- .../cp/MatrixAppendCPInstruction.java | 9 +- .../cp/MatrixBuiltinNaryCPInstruction.java | 2 +- .../cp/MatrixIndexingCPInstruction.java | 4 +- .../cp/MatrixReshapeCPInstruction.java | 10 +- .../cp/MultiReturnBuiltinCPInstruction.java | 8 +- ...ReturnParameterizedBuiltinCPInstruction.java | 8 +- .../instructions/cp/PMMJCPInstruction.java | 12 +- .../cp/ParameterizedBuiltinCPInstruction.java | 10 +- .../cp/QuantilePickCPInstruction.java | 30 +- .../cp/QuantileSortCPInstruction.java | 8 +- .../cp/QuaternaryCPInstruction.java | 8 +- .../instructions/cp/ReorgCPInstruction.java | 8 +- .../cp/ScalarAppendCPInstruction.java | 14 +- .../cp/ScalarBuiltinNaryCPInstruction.java | 2 +- .../instructions/cp/SpoofCPInstruction.java | 9 +- .../cp/StringInitCPInstruction.java | 14 +- .../runtime/instructions/cp/StringObject.java | 4 +- .../instructions/cp/TernaryCPInstruction.java | 5 +- .../cp/UaggOuterChainCPInstruction.java | 8 +- .../instructions/cp/UnaryCPInstruction.java | 15 +- .../cp/UnaryMatrixCPInstruction.java | 12 +- .../cp/UnaryScalarCPInstruction.java | 5 +- .../instructions/cp/VariableCPInstruction.java | 80 ++--- .../cpfile/MatrixIndexingCPFileInstruction.java | 8 +- .../ParameterizedBuiltinCPFileInstruction.java | 42 +-- .../gpu/AggregateBinaryGPUInstruction.java | 27 +- .../gpu/AggregateUnaryGPUInstruction.java | 9 +- .../gpu/ArithmeticBinaryGPUInstruction.java | 2 +- .../gpu/BuiltinBinaryGPUInstruction.java | 2 +- .../gpu/BuiltinUnaryGPUInstruction.java | 1 - .../gpu/ConvolutionGPUInstruction.java | 24 +- .../instructions/gpu/GPUInstruction.java | 29 +- .../instructions/gpu/MMTSJGPUInstruction.java | 36 +- .../gpu/MatrixAppendGPUInstruction.java | 20 +- .../gpu/MatrixBuiltinGPUInstruction.java | 2 +- .../gpu/MatrixIndexingGPUInstruction.java | 9 +- .../MatrixMatrixArithmeticGPUInstruction.java | 5 +- .../gpu/MatrixMatrixAxpyGPUInstruction.java | 4 +- .../gpu/MatrixMatrixBuiltinGPUInstruction.java | 2 +- ...rixMatrixRelationalBinaryGPUInstruction.java | 3 +- .../gpu/RelationalBinaryGPUInstruction.java | 2 +- .../instructions/gpu/ReorgGPUInstruction.java | 21 +- .../ScalarMatrixArithmeticGPUInstruction.java | 5 +- .../gpu/ScalarMatrixBuiltinGPUInstruction.java | 2 +- ...larMatrixRelationalBinaryGPUInstruction.java | 3 +- .../instructions/gpu/context/CSRPointer.java | 68 +--- .../gpu/context/ExecutionConfig.java | 9 +- .../instructions/gpu/context/GPUContext.java | 57 +-- .../gpu/context/GPUContextPool.java | 17 +- .../gpu/context/GPUMemoryManager.java | 10 +- .../instructions/gpu/context/GPUObject.java | 95 ++--- .../instructions/gpu/context/JCudaKernels.java | 12 +- .../mr/AggregateBinaryInstruction.java | 10 +- .../instructions/mr/AggregateInstruction.java | 9 +- .../mr/AggregateUnaryInstruction.java | 6 +- .../instructions/mr/AppendGInstruction.java | 8 +- .../instructions/mr/AppendInstruction.java | 8 +- .../instructions/mr/AppendMInstruction.java | 10 +- .../instructions/mr/AppendRInstruction.java | 9 +- .../mr/BinUaggChainInstruction.java | 13 +- .../instructions/mr/BinaryInstruction.java | 17 +- .../instructions/mr/BinaryMInstruction.java | 16 +- .../instructions/mr/CM_N_COVInstruction.java | 7 +- .../instructions/mr/CSVWriteInstruction.java | 8 +- .../mr/CombineBinaryInstruction.java | 9 +- .../mr/CombineTernaryInstruction.java | 12 +- .../mr/CombineUnaryInstruction.java | 11 +- .../instructions/mr/CtableInstruction.java | 24 +- .../mr/CumulativeAggregateInstruction.java | 12 +- .../mr/CumulativeOffsetInstruction.java | 10 +- .../mr/CumulativeSplitInstruction.java | 11 +- .../mr/DataPartitionMRInstruction.java | 8 +- .../mr/GroupedAggregateInstruction.java | 15 +- .../mr/GroupedAggregateMInstruction.java | 12 +- .../instructions/mr/MMTSJMRInstruction.java | 9 +- .../runtime/instructions/mr/MRInstruction.java | 12 +- .../mr/MapMultChainInstruction.java | 36 +- .../mr/MatrixReshapeMRInstruction.java | 9 +- .../instructions/mr/PMMJMRInstruction.java | 10 +- .../mr/ParameterizedBuiltinMRInstruction.java | 7 +- .../instructions/mr/PickByCountInstruction.java | 21 +- .../instructions/mr/QuaternaryInstruction.java | 5 +- .../instructions/mr/RandInstruction.java | 12 +- .../mr/RangeBasedReIndexInstruction.java | 16 +- .../instructions/mr/ReblockInstruction.java | 5 +- .../mr/RemoveEmptyMRInstruction.java | 12 +- .../instructions/mr/ReorgInstruction.java | 11 +- .../instructions/mr/ReplicateInstruction.java | 8 +- .../instructions/mr/ScalarInstruction.java | 8 +- .../runtime/instructions/mr/SeqInstruction.java | 14 +- .../instructions/mr/TernaryInstruction.java | 9 +- .../mr/UaggOuterChainInstruction.java | 9 +- .../instructions/mr/UnaryInstruction.java | 9 +- .../instructions/mr/ZeroOutInstruction.java | 11 +- .../spark/AggregateTernarySPInstruction.java | 13 +- .../spark/AggregateUnarySPInstruction.java | 9 +- .../spark/AppendGAlignedSPInstruction.java | 10 +- .../spark/AppendGSPInstruction.java | 8 +- .../spark/AppendMSPInstruction.java | 6 +- .../spark/AppendRSPInstruction.java | 4 +- .../spark/BinUaggChainSPInstruction.java | 13 +- .../spark/BinaryMatrixBVectorSPInstruction.java | 7 +- .../spark/BinaryMatrixMatrixSPInstruction.java | 8 +- .../spark/BinaryMatrixScalarSPInstruction.java | 5 +- .../instructions/spark/BinarySPInstruction.java | 24 +- .../spark/BuiltinNarySPInstruction.java | 13 +- .../spark/CSVReblockSPInstruction.java | 16 +- .../instructions/spark/CastSPInstruction.java | 10 +- .../spark/CentralMomentSPInstruction.java | 8 +- .../spark/CheckpointSPInstruction.java | 9 +- .../spark/CompressionSPInstruction.java | 9 +- .../spark/ComputationSPInstruction.java | 16 +- .../spark/ConvolutionSPInstruction.java | 12 +- .../spark/CovarianceSPInstruction.java | 24 +- .../instructions/spark/CpmmSPInstruction.java | 10 +- .../instructions/spark/CtableSPInstruction.java | 8 +- .../spark/CumulativeAggregateSPInstruction.java | 9 +- .../spark/CumulativeOffsetSPInstruction.java | 11 +- .../spark/FrameAppendMSPInstruction.java | 4 +- .../spark/FrameAppendRSPInstruction.java | 18 +- .../spark/FrameIndexingSPInstruction.java | 8 +- .../spark/IndexingSPInstruction.java | 4 +- .../spark/MapmmChainSPInstruction.java | 27 +- .../instructions/spark/MapmmSPInstruction.java | 8 +- .../spark/MatrixAppendMSPInstruction.java | 5 +- .../spark/MatrixAppendRSPInstruction.java | 5 +- .../spark/MatrixIndexingSPInstruction.java | 14 +- .../spark/MatrixReshapeSPInstruction.java | 8 +- ...ReturnParameterizedBuiltinSPInstruction.java | 8 +- .../instructions/spark/PMapmmSPInstruction.java | 8 +- .../ParameterizedBuiltinSPInstruction.java | 14 +- .../instructions/spark/PmmSPInstruction.java | 21 +- .../spark/QuantilePickSPInstruction.java | 14 +- .../spark/QuantileSortSPInstruction.java | 7 +- .../spark/QuaternarySPInstruction.java | 68 +--- .../instructions/spark/RandSPInstruction.java | 21 +- .../spark/ReblockSPInstruction.java | 13 +- .../instructions/spark/ReorgSPInstruction.java | 33 +- .../instructions/spark/RmmSPInstruction.java | 10 +- .../instructions/spark/SPInstruction.java | 12 +- .../instructions/spark/SpoofSPInstruction.java | 56 +-- .../spark/TernarySPInstruction.java | 15 +- .../instructions/spark/Tsmm2SPInstruction.java | 19 +- .../instructions/spark/TsmmSPInstruction.java | 16 +- .../spark/UaggOuterChainSPInstruction.java | 14 +- .../spark/UnaryMatrixSPInstruction.java | 7 +- .../instructions/spark/UnarySPInstruction.java | 11 +- .../instructions/spark/WriteSPInstruction.java | 16 +- .../instructions/spark/ZipmmSPInstruction.java | 9 +- .../spark/data/PartitionedBlock.java | 13 +- .../spark/data/PartitionedBroadcast.java | 9 +- .../ComputeBinaryBlockNnzFunction.java | 6 +- .../functions/ConvertMatrixBlockToIJVLines.java | 2 +- .../functions/ConvertStringToLongTextPair.java | 3 +- .../functions/ExtractBlockForBinaryReblock.java | 4 +- .../spark/functions/ReorgMapFunction.java | 4 +- .../spark/utils/FrameRDDConverterUtils.java | 45 +-- .../spark/utils/RDDConverterUtils.java | 34 +- .../spark/utils/RDDConverterUtilsExt.java | 49 ++- .../instructions/spark/utils/RDDSortUtils.java | 3 - .../instructions/spark/utils/SparkUtils.java | 3 +- .../apache/sysml/runtime/matrix/CleanupMR.java | 2 +- .../sysml/runtime/matrix/DataPartitionMR.java | 4 +- .../org/apache/sysml/runtime/matrix/GMR.java | 10 +- .../apache/sysml/runtime/matrix/JobReturn.java | 7 +- .../runtime/matrix/MatrixCharacteristics.java | 13 +- .../org/apache/sysml/runtime/matrix/SortMR.java | 5 +- .../sysml/runtime/matrix/data/CM_N_COVCell.java | 54 +-- .../matrix/data/ConvolutionParameters.java | 6 +- .../matrix/data/CudaSupportFunctions.java | 5 +- .../DoublePrecisionCudaSupportFunctions.java | 4 +- .../sysml/runtime/matrix/data/FrameBlock.java | 35 +- .../sysml/runtime/matrix/data/InputInfo.java | 6 +- .../runtime/matrix/data/LibCommonsMath.java | 47 +-- .../sysml/runtime/matrix/data/LibMatrixAgg.java | 179 +++------- .../runtime/matrix/data/LibMatrixBincell.java | 105 ++---- .../runtime/matrix/data/LibMatrixCUDA.java | 207 ++++------- .../runtime/matrix/data/LibMatrixCuDNN.java | 61 ++-- .../LibMatrixCuDNNConvolutionAlgorithm.java | 14 +- .../data/LibMatrixCuDNNInputRowFetcher.java | 6 +- .../data/LibMatrixCuDNNPoolingDescriptors.java | 10 +- .../runtime/matrix/data/LibMatrixCuMatMult.java | 25 +- .../sysml/runtime/matrix/data/LibMatrixDNN.java | 39 +- .../runtime/matrix/data/LibMatrixDNNConv2d.java | 11 +- .../runtime/matrix/data/LibMatrixDNNHelper.java | 3 +- .../runtime/matrix/data/LibMatrixDNNIm2Col.java | 4 +- .../matrix/data/LibMatrixDNNPooling.java | 7 +- .../runtime/matrix/data/LibMatrixDNNRelu.java | 4 +- .../runtime/matrix/data/LibMatrixDatagen.java | 46 +-- .../runtime/matrix/data/LibMatrixMult.java | 277 ++++----------- .../runtime/matrix/data/LibMatrixNative.java | 15 +- .../runtime/matrix/data/LibMatrixOuterAgg.java | 266 +++----------- .../runtime/matrix/data/LibMatrixReorg.java | 117 ++---- .../sysml/runtime/matrix/data/MatrixBlock.java | 356 +++++-------------- .../sysml/runtime/matrix/data/MatrixCell.java | 73 ++-- .../runtime/matrix/data/MatrixPackedCell.java | 13 +- .../sysml/runtime/matrix/data/MatrixValue.java | 55 +-- .../matrix/data/OperationsOnMatrixValues.java | 93 ++--- .../sysml/runtime/matrix/data/OutputInfo.java | 6 +- .../matrix/data/RandomMatrixGenerator.java | 27 +- .../SinglePrecisionCudaSupportFunctions.java | 5 +- .../sysml/runtime/matrix/data/WeightedCell.java | 26 +- .../sysml/runtime/matrix/data/WeightedPair.java | 3 +- .../matrix/mapred/DistributedCacheInput.java | 37 +- .../mapred/MRBaseForCommonInstructions.java | 8 +- .../matrix/mapred/MRJobConfiguration.java | 96 ++--- .../matrix/mapred/PartialAggregator.java | 4 +- .../sysml/runtime/matrix/mapred/ReduceBase.java | 4 +- .../matrix/operators/LeftScalarOperator.java | 3 +- .../matrix/operators/RightScalarOperator.java | 3 +- .../matrix/operators/ScalarOperator.java | 5 +- .../test/integration/AutomatedTestBase.java | 28 +- .../functions/frame/FrameConverterTest.java | 14 +- .../functions/frame/FrameIndexingDistTest.java | 11 +- .../functions/frame/FrameMatrixCastingTest.java | 5 +- .../functions/frame/FrameMatrixReblockTest.java | 5 +- .../functions/frame/FrameMatrixWriteTest.java | 3 +- .../functions/frame/FrameReadWriteTest.java | 3 +- .../functions/io/FullDynWriteTest.java | 15 +- .../functions/io/SeqParReadTest.java | 3 +- .../functions/jmlc/FrameReadMetaTest.java | 5 +- .../DataFrameVectorFrameConversionTest.java | 5 +- .../mlcontext/DataFrameVectorScriptTest.java | 5 +- .../functions/python/PythonTestRunner.java | 14 +- .../recompile/IPAComplexAppendTest.java | 32 +- .../RewriteComplexMapMultChainTest.java | 47 +-- .../transform/TransformEncodeDecodeTest.java | 12 +- .../org/apache/sysml/test/unit/UtilsTest.java | 13 +- .../org/apache/sysml/test/utils/TestUtils.java | 17 +- 278 files changed, 1502 insertions(+), 4194 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/RemoteDPParForSpark.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/RemoteDPParForSpark.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/RemoteDPParForSpark.java index b12dc88..82cb2fa 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/RemoteDPParForSpark.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/RemoteDPParForSpark.java @@ -193,7 +193,7 @@ public class RemoteDPParForSpark private static final long serialVersionUID = 2016614593596923995L; @Override - public Tuple2<Long, Iterable<Writable>> call(Tuple2<Long, Writable> arg0) throws Exception { + public Tuple2<Long, Iterable<Writable>> call(Tuple2<Long, Writable> arg0) { return new Tuple2<>(arg0._1(), Collections.singletonList(arg0._2())); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java b/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java index ef0a6c0..e96a195 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/Builtin.java @@ -291,9 +291,7 @@ public class Builtin extends ValueFunction } @Override - public double execute (double in) - throws DMLRuntimeException - { + public double execute (double in) { switch(bFunc) { case SIN: return FASTMATH ? FastMath.sin(in) : Math.sin(in); case COS: return FASTMATH ? FastMath.cos(in) : Math.cos(in); @@ -337,7 +335,7 @@ public class Builtin extends ValueFunction } @Override - public double execute (long in) throws DMLRuntimeException { + public double execute (long in) { return execute((double)in); } @@ -345,7 +343,7 @@ public class Builtin extends ValueFunction * Builtin functions with two inputs */ @Override - public double execute (double in1, double in2) throws DMLRuntimeException { + public double execute (double in1, double in2) { switch(bFunc) { /* @@ -433,7 +431,7 @@ public class Builtin extends ValueFunction } @Override - public double execute (long in1, long in2) throws DMLRuntimeException { + public double execute (long in1, long in2) { switch(bFunc) { case MAX: @@ -458,9 +456,7 @@ public class Builtin extends ValueFunction } @Override - public String execute (String in1) - throws DMLRuntimeException - { + public String execute (String in1) { switch (bFunc) { case PRINT: if (!DMLScript.suppressPrint2Stdout()) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/CM.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/CM.java b/src/main/java/org/apache/sysml/runtime/functionobjects/CM.java index a27e515..1a906c9 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/CM.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/CM.java @@ -83,13 +83,10 @@ public class CM extends ValueFunction * Special case for weights w2==1 */ @Override - public Data execute(Data in1, double in2) - throws DMLRuntimeException - { + public Data execute(Data in1, double in2) { CM_COV_Object cm1=(CM_COV_Object) in1; - if(cm1.isCMAllZeros()) - { + if(cm1.isCMAllZeros()) { cm1.w=1; cm1.mean.set(in2, 0); cm1.m2.set(0,0); @@ -189,9 +186,7 @@ public class CM extends ValueFunction * General case for arbitrary weights w2 */ @Override - public Data execute(Data in1, double in2, double w2) - throws DMLRuntimeException - { + public Data execute(Data in1, double in2, double w2) { CM_COV_Object cm1=(CM_COV_Object) in1; if(cm1.isCMAllZeros()) @@ -295,7 +290,7 @@ public class CM extends ValueFunction * Combining stats from two partitions of the data. */ @Override - public Data execute(Data in1, Data in2) throws DMLRuntimeException + public Data execute(Data in1, Data in2) { CM_COV_Object cm1=(CM_COV_Object) in1; CM_COV_Object cm2=(CM_COV_Object) in2; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/COV.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/COV.java b/src/main/java/org/apache/sysml/runtime/functionobjects/COV.java index ff801cc..82c7a2c 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/COV.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/COV.java @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.functionobjects; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.cp.CM_COV_Object; import org.apache.sysml.runtime.instructions.cp.Data; import org.apache.sysml.runtime.instructions.cp.KahanObject; @@ -59,10 +58,8 @@ public class COV extends ValueFunction * @param v ? * @param w2 ? * @return result - * @throws DMLRuntimeException if DMLRuntimeException occurs */ public Data execute(Data in1, double u, double v, double w2) - throws DMLRuntimeException { CM_COV_Object cov1=(CM_COV_Object) in1; if(cov1.isCOVAllZeros()) @@ -95,7 +92,6 @@ public class COV extends ValueFunction */ @Override public Data execute(Data in1, double u, double v) - throws DMLRuntimeException { CM_COV_Object cov1=(CM_COV_Object) in1; if(cov1.isCOVAllZeros()) @@ -119,7 +115,7 @@ public class COV extends ValueFunction } @Override - public Data execute(Data in1, Data in2) throws DMLRuntimeException + public Data execute(Data in1, Data in2) { CM_COV_Object cov1=(CM_COV_Object) in1; CM_COV_Object cov2=(CM_COV_Object) in2; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/CTable.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/CTable.java b/src/main/java/org/apache/sysml/runtime/functionobjects/CTable.java index af6d8a0..4e837a6 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/CTable.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/CTable.java @@ -42,18 +42,14 @@ public class CTable extends ValueFunction return singleObj; } - public void execute(double v1, double v2, double w, boolean ignoreZeros, CTableMap resultMap, MatrixBlock resultBlock) - throws DMLRuntimeException - { + public void execute(double v1, double v2, double w, boolean ignoreZeros, CTableMap resultMap, MatrixBlock resultBlock) { if( resultBlock != null ) execute(v1, v2, w, ignoreZeros, resultBlock); else execute(v1, v2, w, ignoreZeros, resultMap); } - public void execute(double v1, double v2, double w, boolean ignoreZeros, CTableMap resultMap) - throws DMLRuntimeException - { + public void execute(double v1, double v2, double w, boolean ignoreZeros, CTableMap resultMap) { // If any of the values are NaN (i.e., missing) then // we skip this tuple, proceed to the next tuple if ( Double.isNaN(v1) || Double.isNaN(v2) || Double.isNaN(w) ) { @@ -79,8 +75,7 @@ public class CTable extends ValueFunction } public void execute(double v1, double v2, double w, boolean ignoreZeros, MatrixBlock ctableResult) - throws DMLRuntimeException - { + { // If any of the values are NaN (i.e., missing) then // we skip this tuple, proceed to the next tuple if ( Double.isNaN(v1) || Double.isNaN(v2) || Double.isNaN(w) ) { @@ -112,8 +107,7 @@ public class CTable extends ValueFunction } public int execute(int row, double v2, double w, int maxCol, MatrixBlock ctableResult) - throws DMLRuntimeException - { + { // If any of the values are NaN (i.e., missing) then // we skip this tuple, proceed to the next tuple if ( Double.isNaN(v2) || Double.isNaN(w) ) { @@ -135,7 +129,6 @@ public class CTable extends ValueFunction } public Pair<MatrixIndexes,Double> execute( long row, double v2, double w ) - throws DMLRuntimeException { // If any of the values are NaN (i.e., missing) then // we skip this tuple, proceed to the next tuple http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/FunctionObject.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/FunctionObject.java b/src/main/java/org/apache/sysml/runtime/functionobjects/FunctionObject.java index d18e758..e66e324 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/FunctionObject.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/FunctionObject.java @@ -35,32 +35,32 @@ public abstract class FunctionObject //basic execute methods for all function objects - public double execute ( double in1, double in2 ) throws DMLRuntimeException { + public double execute ( double in1, double in2 ) { throw new DMLRuntimeException("FunctionObject.execute(double,double): should never get called in the base class"); } - public double execute ( long in1, long in2 ) throws DMLRuntimeException { + public double execute ( long in1, long in2 ) { throw new DMLRuntimeException("FunctionObject.execute(int,int): should never get called in the base class"); } - public double execute ( double in ) throws DMLRuntimeException { + public double execute ( double in ) { throw new DMLRuntimeException("FunctionObject.execute(double): should never get called in the base class"); } - public double execute ( long in ) throws DMLRuntimeException { + public double execute ( long in ) { throw new DMLRuntimeException("FunctionObject.execute(int): should never get called in the base class"); } - public boolean execute ( boolean in1, boolean in2 ) throws DMLRuntimeException { + public boolean execute ( boolean in1, boolean in2 ) { throw new DMLRuntimeException("FunctionObject.execute(boolean,boolean): should never get called in the base class"); } - public boolean execute ( boolean in ) throws DMLRuntimeException { + public boolean execute ( boolean in ) { throw new DMLRuntimeException("FunctionObject.execute(boolean): should never get called in the base class"); } // this version is for parameterized builtins with input parameters of form: name=value - public double execute ( HashMap<String,String> params ) throws DMLRuntimeException { + public double execute ( HashMap<String,String> params ) { throw new DMLRuntimeException("FunctionObject.execute(HashMap<String,String> params): should never get called in the base class"); } @@ -70,15 +70,15 @@ public abstract class FunctionObject * For complex function object that operates on objects instead of native values */ - public Data execute(Data in1, double in2) throws DMLRuntimeException { + public Data execute(Data in1, double in2) { throw new DMLRuntimeException("execute(): should not be invoked from base class."); } - public Data execute(Data in1, double in2, double in3) throws DMLRuntimeException { + public Data execute(Data in1, double in2, double in3) { throw new DMLRuntimeException("execute(): should not be invoked from base class."); } - public Data execute(Data in1, Data in2) throws DMLRuntimeException { + public Data execute(Data in1, Data in2) { throw new DMLRuntimeException("execute(): should not be invoked from base class."); } @@ -87,11 +87,11 @@ public abstract class FunctionObject * For file functions and specific builtin functions */ - public String execute ( String in1 ) throws DMLRuntimeException { + public String execute ( String in1 ) { throw new DMLRuntimeException("FileFunction.execute(String): should never get called in the base class"); } - public String execute ( String in1, String in2 ) throws DMLRuntimeException { + public String execute ( String in1, String in2 ) { throw new DMLRuntimeException("FileFunction.execute(String,String): should never get called in the base class"); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlus.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlus.java b/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlus.java index 3d524fe..28b1b44 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlus.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlus.java @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.functionobjects; import java.io.Serializable; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.cp.Data; import org.apache.sysml.runtime.instructions.cp.KahanObject; @@ -44,9 +43,7 @@ public class KahanPlus extends KahanFunction implements Serializable } @Override - public Data execute(Data in1, double in2) - throws DMLRuntimeException - { + public Data execute(Data in1, double in2) { KahanObject kahanObj=(KahanObject)in1; //fast path for INF/-INF in order to ensure result correctness @@ -59,14 +56,12 @@ public class KahanPlus extends KahanFunction implements Serializable //default path for any other value double correction=in2+kahanObj._correction; double sum=kahanObj._sum+correction; - kahanObj.set(sum, correction-(sum-kahanObj._sum)); //prevent eager JIT opt + kahanObj.set(sum, correction-(sum-kahanObj._sum)); //prevent eager JIT opt return kahanObj; } @Override // in1, in2 is the sum, in3 is the correction - public Data execute(Data in1, double in2, double in3) - throws DMLRuntimeException - { + public Data execute(Data in1, double in2, double in3) { KahanObject kahanObj=(KahanObject)in1; //fast path for INF/-INF in order to ensure result correctness http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlusSq.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlusSq.java b/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlusSq.java index 7a8c7c9..47f3abc 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlusSq.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/KahanPlusSq.java @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.functionobjects; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.cp.Data; import org.apache.sysml.runtime.instructions.cp.KahanObject; @@ -32,66 +31,64 @@ import java.io.Serializable; */ public class KahanPlusSq extends KahanFunction implements Serializable { - private static final long serialVersionUID = 5774388904472231717L; + private static final long serialVersionUID = 5774388904472231717L; - private static KahanPlusSq singleObj = null; - private KahanPlus kplus = null; + private static KahanPlusSq singleObj = null; + private KahanPlus kplus = null; - private KahanPlusSq() { - kplus = KahanPlus.getKahanPlusFnObject(); - } + private KahanPlusSq() { + kplus = KahanPlus.getKahanPlusFnObject(); + } - /** - * Get the KahanPlusSq singleton object. - * - * @return KahanPlusSq singleton object - */ - public static KahanPlusSq getKahanPlusSqFnObject() { - if (singleObj == null) - singleObj = new KahanPlusSq(); - return singleObj; - } + /** + * Get the KahanPlusSq singleton object. + * + * @return KahanPlusSq singleton object + */ + public static KahanPlusSq getKahanPlusSqFnObject() { + if (singleObj == null) + singleObj = new KahanPlusSq(); + return singleObj; + } - /** - * Square the given term, then add to the existing sum using - * the Kahan summation algorithm. - * - * @param kObj A KahanObject supplied as a Data type containing - * the current sum and correction factor for the - * Kahan summation algorithm. - * @param in The current term to be squared and added. - */ - @Override - public Data execute(Data kObj, double in) - throws DMLRuntimeException { - kplus.execute(kObj, in * in); - return kObj; - } + /** + * Square the given term, then add to the existing sum using + * the Kahan summation algorithm. + * + * @param kObj A KahanObject supplied as a Data type containing + * the current sum and correction factor for the + * Kahan summation algorithm. + * @param in The current term to be squared and added. + */ + @Override + public Data execute(Data kObj, double in) { + kplus.execute(kObj, in * in); + return kObj; + } - /** - * Add the given sum and correction factor to the existing - * sum in the KahanObject using the Kahan summation algorithm. - * - * @param kObj A KahanObject supplied as a Data type containing - * the current sum and correction factor for the - * Kahan summation algorithm. - * @param sum The current sum. - * @param corr The current correction factor. - */ - @Override - public Data execute(Data kObj, double sum, double corr) - throws DMLRuntimeException { - kplus.execute(kObj, sum, corr); - return kObj; - } + /** + * Add the given sum and correction factor to the existing + * sum in the KahanObject using the Kahan summation algorithm. + * + * @param kObj A KahanObject supplied as a Data type containing + * the current sum and correction factor for the + * Kahan summation algorithm. + * @param sum The current sum. + * @param corr The current correction factor. + */ + @Override + public Data execute(Data kObj, double sum, double corr) { + kplus.execute(kObj, sum, corr); + return kObj; + } - @Override - public void execute2(KahanObject kObj, double in) { - kplus.execute2(kObj, in * in); - } - - @Override - public void execute3(KahanObject kObj, double in, int count) { - kplus.execute3(kObj, in * in, count); - } + @Override + public void execute2(KahanObject kObj, double in) { + kplus.execute2(kObj, in * in); + } + + @Override + public void execute3(KahanObject kObj, double in, int count) { + kplus.execute3(kObj, in * in, count); + } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/Mean.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/Mean.java b/src/main/java/org/apache/sysml/runtime/functionobjects/Mean.java index 907e732..cbdacd1 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/Mean.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/Mean.java @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.functionobjects; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.instructions.cp.Data; import org.apache.sysml.runtime.instructions.cp.KahanObject; @@ -43,7 +42,7 @@ public class Mean extends ValueFunction } @Override - public Data execute(Data in1, double in2, double count) throws DMLRuntimeException { + public Data execute(Data in1, double in2, double count) { KahanObject kahanObj=(KahanObject)in1; double delta = (in2-kahanObj._sum)/count; _plus.execute(in1, delta); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/ParameterizedBuiltin.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/ParameterizedBuiltin.java b/src/main/java/org/apache/sysml/runtime/functionobjects/ParameterizedBuiltin.java index 60886c0..909fdc8 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/ParameterizedBuiltin.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/ParameterizedBuiltin.java @@ -27,7 +27,6 @@ import org.apache.commons.math3.distribution.ExponentialDistribution; import org.apache.commons.math3.distribution.FDistribution; import org.apache.commons.math3.distribution.NormalDistribution; import org.apache.commons.math3.distribution.TDistribution; -import org.apache.commons.math3.exception.MathArithmeticException; import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.util.UtilFunctions; @@ -89,11 +88,11 @@ public class ParameterizedBuiltin extends ValueFunction distFunc = dist; } - public static ParameterizedBuiltin getParameterizedBuiltinFnObject (String str) throws DMLRuntimeException { + public static ParameterizedBuiltin getParameterizedBuiltinFnObject (String str) { return getParameterizedBuiltinFnObject (str, null); } - public static ParameterizedBuiltin getParameterizedBuiltinFnObject (String str, String str2) throws DMLRuntimeException { + public static ParameterizedBuiltin getParameterizedBuiltinFnObject (String str, String str2) { ParameterizedBuiltinCode code = String2ParameterizedBuiltinCode.get(str); @@ -178,7 +177,7 @@ public class ParameterizedBuiltin extends ValueFunction } @Override - public double execute(HashMap<String,String> params) throws DMLRuntimeException { + public double execute(HashMap<String,String> params) { switch(bFunc) { case CDF: case INVCDF: @@ -205,10 +204,8 @@ public class ParameterizedBuiltin extends ValueFunction * @param params map of parameters * @param inverse true if inverse * @return cdf or inverse cdf - * @throws MathArithmeticException if MathArithmeticException occurs - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - private static double computeFromDistribution (ProbabilityDistributionCode dcode, HashMap<String,String> params, boolean inverse ) throws MathArithmeticException, DMLRuntimeException { + private static double computeFromDistribution (ProbabilityDistributionCode dcode, HashMap<String,String> params, boolean inverse ) { // given value is "quantile" when inverse=false, and it is "probability" when inverse=true double val = Double.parseDouble(params.get("target")); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/Plus.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/Plus.java b/src/main/java/org/apache/sysml/runtime/functionobjects/Plus.java index fc1a8f6..70aa598 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/Plus.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/Plus.java @@ -21,8 +21,6 @@ package org.apache.sysml.runtime.functionobjects; import java.io.Serializable; -import org.apache.sysml.runtime.DMLRuntimeException; - // Singleton class public class Plus extends ValueFunction implements Serializable @@ -57,7 +55,7 @@ public class Plus extends ValueFunction implements Serializable } @Override - public String execute ( String in1, String in2 ) throws DMLRuntimeException { + public String execute ( String in1, String in2 ) { return in1 + in2; } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/RemoveFile.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/RemoveFile.java b/src/main/java/org/apache/sysml/runtime/functionobjects/RemoveFile.java deleted file mode 100644 index 2412380..0000000 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/RemoveFile.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.sysml.runtime.functionobjects; - -import java.io.IOException; - -import org.apache.sysml.runtime.DMLRuntimeException; -import org.apache.sysml.runtime.util.MapReduceTool; - - -public class RemoveFile extends FileFunction -{ - private static RemoveFile singleObj = null; - - private RemoveFile() { - // nothing to do here - } - - public static RemoveFile getRemoveFileFnObject() { - if ( singleObj == null ) - singleObj = new RemoveFile(); - return singleObj; - } - - @Override - public String execute (String fname) throws DMLRuntimeException { - try { - MapReduceTool.deleteFileIfExistOnHDFS(fname); - } catch (IOException e) { - throw new DMLRuntimeException(e); - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/RenameFile.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/RenameFile.java b/src/main/java/org/apache/sysml/runtime/functionobjects/RenameFile.java deleted file mode 100644 index ef6f8a5..0000000 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/RenameFile.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.sysml.runtime.functionobjects; - -import java.io.IOException; - -import org.apache.sysml.runtime.DMLRuntimeException; -import org.apache.sysml.runtime.util.MapReduceTool; - - -public class RenameFile extends FileFunction -{ - - private static RenameFile singleObj = null; - - private RenameFile() { - // nothing to do here - } - - public static RenameFile getRenameFileFnObject() { - if ( singleObj == null ) - singleObj = new RenameFile(); - return singleObj; - } - - @Override - public String execute (String origName, String newName) throws DMLRuntimeException { - try { - MapReduceTool.renameFileOnHDFS(origName, newName); - } catch (IOException e) { - throw new DMLRuntimeException(e); - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/functionobjects/TernaryValueFunction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/functionobjects/TernaryValueFunction.java b/src/main/java/org/apache/sysml/runtime/functionobjects/TernaryValueFunction.java index 9629746..eb5b6c7 100644 --- a/src/main/java/org/apache/sysml/runtime/functionobjects/TernaryValueFunction.java +++ b/src/main/java/org/apache/sysml/runtime/functionobjects/TernaryValueFunction.java @@ -21,15 +21,13 @@ package org.apache.sysml.runtime.functionobjects; import java.io.Serializable; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.matrix.operators.BinaryOperator; public abstract class TernaryValueFunction extends ValueFunction implements Serializable { private static final long serialVersionUID = 4837616587192612216L; - public abstract double execute ( double in1, double in2, double in3 ) - throws DMLRuntimeException; + public abstract double execute ( double in1, double in2, double in3 ); public interface ValueFunctionWithConstant { public BinaryOperator setOp2Constant(double cnt); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java index 43b3895..c8d0d6c 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java @@ -293,12 +293,9 @@ public class CPInstructionParser extends InstructionParser String2CPFileInstructionType.put( "rmempty" , CPType.ParameterizedBuiltin); } - public static CPInstruction parseSingleInstruction (String str ) - throws DMLRuntimeException - { + public static CPInstruction parseSingleInstruction (String str ) { if ( str == null || str.isEmpty() ) return null; - CPType cptype = InstructionUtils.getCPType(str); if ( cptype == null ) throw new DMLRuntimeException("Unable derive cptype for instruction: " + str); @@ -308,16 +305,11 @@ public class CPInstructionParser extends InstructionParser return cpinst; } - public static CPInstruction parseSingleInstruction ( CPType cptype, String str ) - throws DMLRuntimeException - { + public static CPInstruction parseSingleInstruction ( CPType cptype, String str ) { ExecType execType = null; - if ( str == null || str.isEmpty() ) return null; - - switch(cptype) - { + switch(cptype) { case AggregateUnary: return AggregateUnaryCPInstruction.parseInstruction(str); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/GPUInstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/GPUInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/GPUInstructionParser.java index d4e18cb..903dca6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/GPUInstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/GPUInstructionParser.java @@ -144,13 +144,10 @@ public class GPUInstructionParser extends InstructionParser String2GPUInstructionType.put( RightIndex.OPCODE, GPUINSTRUCTION_TYPE.MatrixIndexing); } - public static GPUInstruction parseSingleInstruction (String str ) - throws DMLRuntimeException - { + public static GPUInstruction parseSingleInstruction (String str ) { if ( str == null || str.isEmpty() ) return null; - - GPUINSTRUCTION_TYPE cptype = InstructionUtils.getGPUType(str); + GPUINSTRUCTION_TYPE cptype = InstructionUtils.getGPUType(str); if ( cptype == null ) throw new DMLRuntimeException("Unable derive cptype for instruction: " + str); GPUInstruction cpinst = parseSingleInstruction(cptype, str); @@ -159,9 +156,7 @@ public class GPUInstructionParser extends InstructionParser return cpinst; } - public static GPUInstruction parseSingleInstruction ( GPUINSTRUCTION_TYPE gputype, String str ) - throws DMLRuntimeException - { + public static GPUInstruction parseSingleInstruction ( GPUINSTRUCTION_TYPE gputype, String str ) { if( str == null || str.isEmpty() ) return null; if( gputype == null ) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java b/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java index 1171e80..11dfb99 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/Instruction.java @@ -24,7 +24,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.sysml.api.DMLScript; import org.apache.sysml.lops.Lop; import org.apache.sysml.parser.DataIdentifier; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; @@ -210,11 +209,8 @@ public abstract class Instruction * * @param pattern ? * @param replace ? - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public void updateInstructionThreadID(String pattern, String replace) - throws DMLRuntimeException - { + public void updateInstructionThreadID(String pattern, String replace) { //do nothing } @@ -225,11 +221,8 @@ public abstract class Instruction * * @param ec execution context * @return instruction - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public Instruction preprocessInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public Instruction preprocessInstruction(ExecutionContext ec){ //update debug status ec.updateDebugState( this ); @@ -241,10 +234,8 @@ public abstract class Instruction * This method should be used to execute the instruction. * * @param ec execution context - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public abstract void processInstruction(ExecutionContext ec) - throws DMLRuntimeException; + public abstract void processInstruction(ExecutionContext ec); /** * This method should be used for any tear down after executing this instruction. @@ -252,11 +243,8 @@ public abstract class Instruction * call the super method. * * @param ec execution context - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public void postprocessInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void postprocessInstruction(ExecutionContext ec) { //do nothing } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java index e483100..d25bbdc 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java @@ -29,9 +29,7 @@ import org.apache.sysml.runtime.instructions.spark.SPInstruction.SPType; public class InstructionParser { - public static Instruction parseSingleInstruction ( String str ) - throws DMLRuntimeException - { + public static Instruction parseSingleInstruction ( String str ) { if ( str == null || str.isEmpty() ) return null; @@ -67,19 +65,13 @@ public class InstructionParser } } - public static Instruction[] parseMixedInstructions ( String str ) - throws DMLRuntimeException - { + public static Instruction[] parseMixedInstructions ( String str ) { if ( str == null || str.isEmpty() ) return null; - String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); Instruction[] inst = new Instruction[strlist.length]; - - for ( int i=0; i < inst.length; i++ ) { + for ( int i=0; i < inst.length; i++ ) inst[i] = parseSingleInstruction ( strlist[i] ); - } - return inst; } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java b/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java index 172aa15..294827d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/InstructionUtils.java @@ -103,9 +103,7 @@ import org.apache.sysml.runtime.matrix.operators.UnaryOperator; public class InstructionUtils { - public static int checkNumFields( String str, int expected ) - throws DMLRuntimeException - { + public static int checkNumFields( String str, int expected ) { //note: split required for empty tokens int numParts = str.split(Instruction.OPERAND_DELIM).length; int numFields = numParts - 2; // -2 accounts for execType and opcode @@ -116,9 +114,7 @@ public class InstructionUtils return numFields; } - public static int checkNumFields( String[] parts, int expected ) - throws DMLRuntimeException - { + public static int checkNumFields( String[] parts, int expected ) { int numParts = parts.length; int numFields = numParts - 1; //account for opcode @@ -128,9 +124,7 @@ public class InstructionUtils return numFields; } - public static int checkNumFields( String[] parts, int expected1, int expected2 ) - throws DMLRuntimeException - { + public static int checkNumFields( String[] parts, int expected1, int expected2 ) { int numParts = parts.length; int numFields = numParts - 1; //account for opcode @@ -140,16 +134,12 @@ public class InstructionUtils return numFields; } - public static int checkNumFields( String str, int expected1, int expected2 ) - throws DMLRuntimeException - { + public static int checkNumFields( String str, int expected1, int expected2 ) { //note: split required for empty tokens int numParts = str.split(Instruction.OPERAND_DELIM).length; int numFields = numParts - 2; // -2 accounts for execType and opcode - if ( numFields != expected1 && numFields != expected2 ) throw new DMLRuntimeException("checkNumFields() for (" + str + ") -- expected number (" + expected1 + " or "+ expected2 +") != is not equal to actual number (" + numFields + ")."); - return numFields; } @@ -161,8 +151,7 @@ public class InstructionUtils * @param str instruction string * @return instruction parts as string array */ - public static String[] getInstructionParts( String str ) - { + public static String[] getInstructionParts( String str ) { StringTokenizer st = new StringTokenizer( str, Instruction.OPERAND_DELIM ); String[] ret = new String[st.countTokens()-1]; st.nextToken(); // stripping-off the exectype @@ -188,8 +177,7 @@ public class InstructionUtils * @param str instruction string * @return instruction parts as string array */ - public static String[] getInstructionPartsWithValueType( String str ) - { + public static String[] getInstructionPartsWithValueType( String str ) { //note: split required for empty tokens String[] parts = str.split(Instruction.OPERAND_DELIM, -1); String[] ret = new String[parts.length-1]; // stripping-off the exectype @@ -503,9 +491,7 @@ public class InstructionUtils new UnaryOperator(Builtin.getBuiltinFnObject(opcode)); } - public static Operator parseBinaryOrBuiltinOperator(String opcode, CPOperand in1, CPOperand in2) - throws DMLRuntimeException - { + public static Operator parseBinaryOrBuiltinOperator(String opcode, CPOperand in1, CPOperand in2) { if( LibCommonsMath.isSupportedMatrixMatrixOperation(opcode) ) return null; boolean matrixScalar = (in1.getDataType() != in2.getDataType()); @@ -516,9 +502,7 @@ public class InstructionUtils parseBinaryOperator(opcode)); } - public static Operator parseExtendedBinaryOrBuiltinOperator(String opcode, CPOperand in1, CPOperand in2) - throws DMLRuntimeException - { + public static Operator parseExtendedBinaryOrBuiltinOperator(String opcode, CPOperand in1, CPOperand in2) { boolean matrixScalar = (in1.getDataType() != in2.getDataType()); return Builtin.isBuiltinFnObject(opcode) ? (matrixScalar ? new RightScalarOperator( Builtin.getBuiltinFnObject(opcode), 0) : @@ -755,9 +739,7 @@ public class InstructionUtils throw new RuntimeException("Unknown binary opcode " + opcode); } - public static BinaryOperator parseExtendedBinaryOperator(String opcode) - throws DMLRuntimeException - { + public static BinaryOperator parseExtendedBinaryOperator(String opcode) { if(opcode.equalsIgnoreCase("==") || opcode.equalsIgnoreCase("map==")) return new BinaryOperator(Equals.getEqualsFnObject()); else if(opcode.equalsIgnoreCase("!=") || opcode.equalsIgnoreCase("map!=")) http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java index 6777d51..e587fc6 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java @@ -318,19 +318,14 @@ public class MRInstructionParser extends InstructionParser } - public static MRInstruction parseSingleInstruction (String str ) - throws DMLRuntimeException - { + public static MRInstruction parseSingleInstruction (String str ) { if ( str == null || str.isEmpty() ) return null; - MRType mrtype = InstructionUtils.getMRType(str); return parseSingleInstruction(mrtype, str); } - public static MRInstruction parseSingleInstruction (MRType mrtype, String str ) - throws DMLRuntimeException - { + public static MRInstruction parseSingleInstruction (MRType mrtype, String str ) { if ( str == null || str.isEmpty() ) return null; @@ -474,125 +469,88 @@ public class MRInstructionParser extends InstructionParser } } - public static MRInstruction[] parseMixedInstructions ( String str ) throws DMLRuntimeException { + public static MRInstruction[] parseMixedInstructions ( String str ) { if ( str == null || str.isEmpty() ) return null; - Instruction[] inst = InstructionParser.parseMixedInstructions(str); MRInstruction[] mrinst = new MRInstruction[inst.length]; - for ( int i=0; i < inst.length; i++ ) { + for ( int i=0; i < inst.length; i++ ) mrinst[i] = (MRInstruction) inst[i]; - } - return mrinst; } - public static AggregateInstruction[] parseAggregateInstructions(String str) throws DMLRuntimeException - { + public static AggregateInstruction[] parseAggregateInstructions(String str) { AggregateInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new AggregateInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (AggregateInstruction) AggregateInstruction.parseInstruction( strlist[i] ); - } } return inst; } - public static ReblockInstruction[] parseReblockInstructions(String str) throws DMLRuntimeException - { + public static ReblockInstruction[] parseReblockInstructions(String str) { ReblockInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new ReblockInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (ReblockInstruction) ReblockInstruction.parseInstruction( strlist[i] ); - } } return inst; } - public static CSVReblockInstruction[] parseCSVReblockInstructions(String str) throws DMLRuntimeException - { + public static CSVReblockInstruction[] parseCSVReblockInstructions(String str) { CSVReblockInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new CSVReblockInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (CSVReblockInstruction) CSVReblockInstruction.parseInstruction( strlist[i] ); - } } return inst; } - public static CSVWriteInstruction[] parseCSVWriteInstructions(String str) throws DMLRuntimeException - { + public static CSVWriteInstruction[] parseCSVWriteInstructions(String str) { CSVWriteInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new CSVWriteInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (CSVWriteInstruction) CSVWriteInstruction.parseInstruction( strlist[i] ); - } } return inst; } - public static AggregateBinaryInstruction[] parseAggregateBinaryInstructions(String str) throws DMLRuntimeException - { + public static AggregateBinaryInstruction[] parseAggregateBinaryInstructions(String str) { AggregateBinaryInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new AggregateBinaryInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (AggregateBinaryInstruction) AggregateBinaryInstruction.parseInstruction( strlist[i] ); - } } return inst; } - public static DataGenMRInstruction[] parseDataGenInstructions(String str) throws DMLRuntimeException - { + public static DataGenMRInstruction[] parseDataGenInstructions(String str) { DataGenMRInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new DataGenMRInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (DataGenMRInstruction) InstructionParser.parseSingleInstruction(strlist[i]); - } } return inst; } - public static MRInstruction[] parseCombineInstructions(String str) throws DMLRuntimeException - { + public static MRInstruction[] parseCombineInstructions(String str) { MRInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new MRInstruction[strlist.length]; - - for(int i=0; i < strlist.length; i++) - { + for(int i=0; i < strlist.length; i++) { MRType type = InstructionUtils.getMRType(strlist[i]); if(type==MRType.CombineBinary) inst[i] = (CombineBinaryInstruction) CombineBinaryInstruction.parseInstruction( strlist[i] ); @@ -605,34 +563,25 @@ public class MRInstructionParser extends InstructionParser return inst; } - public static CM_N_COVInstruction[] parseCM_N_COVInstructions(String str) throws DMLRuntimeException + public static CM_N_COVInstruction[] parseCM_N_COVInstructions(String str) { CM_N_COVInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new CM_N_COVInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (CM_N_COVInstruction) CM_N_COVInstruction.parseInstruction( strlist[i] ); - } } return inst; } - public static GroupedAggregateInstruction[] parseGroupedAggInstructions(String str) - throws DMLRuntimeException{ + public static GroupedAggregateInstruction[] parseGroupedAggInstructions(String str) { GroupedAggregateInstruction[] inst=null; - if(str!=null && !str.isEmpty()) - { + if(str!=null && !str.isEmpty()) { String[] strlist = str.split(Instruction.INSTRUCTION_DELIM); inst = new GroupedAggregateInstruction[strlist.length]; - for(int i=0; i < strlist.length; i++) - { inst[i] = (GroupedAggregateInstruction) GroupedAggregateInstruction.parseInstruction( strlist[i] ); - } } return inst; } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java index 88a309d..b817b88 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/MRJobInstruction.java @@ -840,9 +840,8 @@ public class MRJobInstruction extends Instruction * * @param ec execution context * @return array of matrix objects - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public MatrixObject[] extractOutputMatrices(ExecutionContext ec) throws DMLRuntimeException { + public MatrixObject[] extractOutputMatrices(ExecutionContext ec) { outputMatrices = new MatrixObject[getOutputVars().length]; int ind = 0; for(String oo: getOutputVars()) { @@ -942,7 +941,7 @@ public class MRJobInstruction extends Instruction return tmp; } - public void printCompleteMRJobInstruction(MatrixCharacteristics[] resultStats) throws DMLRuntimeException { + public void printCompleteMRJobInstruction(MatrixCharacteristics[] resultStats) { LOG.trace("jobtype" + jobType); LOG.trace("Inputs: \n"); for(int i=0, mi=0; i < inputVars.length; i++ ) { @@ -992,8 +991,7 @@ public class MRJobInstruction extends Instruction } @Override - public void updateInstructionThreadID(String pattern, String replace) - throws DMLRuntimeException + public void updateInstructionThreadID(String pattern, String replace) { if( dimsUnknownFilePrefix!=null ) dimsUnknownFilePrefix = dimsUnknownFilePrefix.replaceAll(pattern, replace); @@ -1270,9 +1268,7 @@ public class MRJobInstruction extends Instruction } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { if ( DMLScript.rtplatform == RUNTIME_PLATFORM.SINGLE_NODE) throw new DMLRuntimeException("MapReduce jobs cannot be executed when execution mode = singlenode"); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java index a9155c9..8d0fb54 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java @@ -312,12 +312,9 @@ public class SPInstructionParser extends InstructionParser String2SPInstructionType.put( "spoof" , SPType.SpoofFused); } - public static SPInstruction parseSingleInstruction (String str ) - throws DMLRuntimeException - { + public static SPInstruction parseSingleInstruction (String str ) { if ( str == null || str.isEmpty() ) return null; - SPType cptype = InstructionUtils.getSPType(str); if ( cptype == null ) // return null; @@ -328,9 +325,7 @@ public class SPInstructionParser extends InstructionParser return spinst; } - public static SPInstruction parseSingleInstruction ( SPType sptype, String str ) - throws DMLRuntimeException - { + public static SPInstruction parseSingleInstruction ( SPType sptype, String str ) { if ( str == null || str.isEmpty() ) return null; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java index 32732d3..a9a8947 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateBinaryCPInstruction.java @@ -38,9 +38,7 @@ public class AggregateBinaryCPInstruction extends BinaryCPInstruction { super(CPType.AggregateBinary, op, in1, in2, out, opcode, istr); } - public static AggregateBinaryCPInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static AggregateBinaryCPInstruction parseInstruction( String str ) { CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); CPOperand in2 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); CPOperand out = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); @@ -64,9 +62,7 @@ public class AggregateBinaryCPInstruction extends BinaryCPInstruction { } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { //get inputs MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java index c087016..9e83eb0 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateTernaryCPInstruction.java @@ -33,9 +33,7 @@ public class AggregateTernaryCPInstruction extends ComputationCPInstruction { super(CPType.AggregateTernary, op, in1, in2, in3, out, opcode, istr); } - public static AggregateTernaryCPInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static AggregateTernaryCPInstruction parseInstruction( String str ) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); String opcode = parts[0]; @@ -57,18 +55,16 @@ public class AggregateTernaryCPInstruction extends ComputationCPInstruction { } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { MatrixBlock matBlock1 = ec.getMatrixInput(input1.getName(), getExtendedOpcode()); - MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); - MatrixBlock matBlock3 = input3.isLiteral() ? null : //matrix or literal 1 - ec.getMatrixInput(input3.getName(), getExtendedOpcode()); - + MatrixBlock matBlock2 = ec.getMatrixInput(input2.getName(), getExtendedOpcode()); + MatrixBlock matBlock3 = input3.isLiteral() ? null : //matrix or literal 1 + ec.getMatrixInput(input3.getName(), getExtendedOpcode()); + AggregateTernaryOperator ab_op = (AggregateTernaryOperator) _optr; MatrixBlock ret = matBlock1.aggregateTernaryOperations( matBlock1, matBlock2, matBlock3, new MatrixBlock(), ab_op, true); - + //release inputs/outputs ec.releaseMatrixInput(input1.getName(), getExtendedOpcode()); ec.releaseMatrixInput(input2.getName(), getExtendedOpcode()); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java index c6e3cce..65e6a97 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java @@ -57,9 +57,7 @@ public class AggregateUnaryCPInstruction extends UnaryCPInstruction _type = type; } - public static AggregateUnaryCPInstruction parseInstruction(String str) - throws DMLRuntimeException - { + public static AggregateUnaryCPInstruction parseInstruction(String str) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); String opcode = parts[0]; CPOperand in1 = new CPOperand(parts[1]); @@ -77,9 +75,7 @@ public class AggregateUnaryCPInstruction extends UnaryCPInstruction } @Override - public void processInstruction( ExecutionContext ec ) - throws DMLRuntimeException - { + public void processInstruction( ExecutionContext ec ) { String output_name = output.getName(); String opcode = getOpcode(); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java index 1754024..dd82b4a 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java @@ -44,9 +44,7 @@ public abstract class AppendCPInstruction extends BinaryCPInstruction _type = type; } - public static AppendCPInstruction parseInstruction ( String str ) - throws DMLRuntimeException - { + public static AppendCPInstruction parseInstruction ( String str ) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); InstructionUtils.checkNumFields (parts, 5); @@ -67,8 +65,8 @@ public abstract class AppendCPInstruction extends BinaryCPInstruction if( type == AppendType.STRING ) return new ScalarAppendCPInstruction(op, in1, in2, in3, out, type, opcode, str); else if( in1.getDataType()==DataType.MATRIX ) - return new MatrixAppendCPInstruction(op, in1, in2, in3, out, type, opcode, str); + return new MatrixAppendCPInstruction(op, in1, in2, in3, out, type, opcode, str); else //DataType.FRAME - return new FrameAppendCPInstruction(op, in1, in2, in3, out, type, opcode, str); + return new FrameAppendCPInstruction(op, in1, in2, in3, out, type, opcode, str); } } http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java index f0bdbd1..d1ae120 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryCPInstruction.java @@ -36,9 +36,7 @@ public abstract class BinaryCPInstruction extends ComputationCPInstruction { super(type, op, in1, in2, in3, out, opcode, istr); } - public static BinaryCPInstruction parseInstruction( String str ) - throws DMLRuntimeException - { + public static BinaryCPInstruction parseInstruction( String str ) { CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); CPOperand in2 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); CPOperand out = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN); @@ -56,23 +54,17 @@ public abstract class BinaryCPInstruction extends ComputationCPInstruction { return new BinaryMatrixScalarCPInstruction(operator, in1, in2, out, opcode, str); } - protected static String parseBinaryInstruction(String instr, CPOperand in1, CPOperand in2, CPOperand out) - throws DMLRuntimeException - { + protected static String parseBinaryInstruction(String instr, CPOperand in1, CPOperand in2, CPOperand out) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(instr); InstructionUtils.checkNumFields ( parts, 3 ); - String opcode = parts[0]; in1.split(parts[1]); in2.split(parts[2]); out.split(parts[3]); - return opcode; } - protected static String parseBinaryInstruction(String instr, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out) - throws DMLRuntimeException - { + protected static String parseBinaryInstruction(String instr, CPOperand in1, CPOperand in2, CPOperand in3, CPOperand out) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(instr); InstructionUtils.checkNumFields ( parts, 4 ); @@ -85,9 +77,7 @@ public abstract class BinaryCPInstruction extends ComputationCPInstruction { return opcode; } - protected static void checkOutputDataType(CPOperand in1, CPOperand in2, CPOperand out) - throws DMLRuntimeException - { + protected static void checkOutputDataType(CPOperand in1, CPOperand in2, CPOperand out) { // check for valid data type of output if((in1.getDataType() == DataType.MATRIX || in2.getDataType() == DataType.MATRIX) && out.getDataType() != DataType.MATRIX) throw new DMLRuntimeException("Element-wise matrix operations between variables " + in1.getName() + http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixMatrixCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixMatrixCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixMatrixCPInstruction.java index e584a85..5ab853d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixMatrixCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixMatrixCPInstruction.java @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.instructions.cp; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.caching.MatrixObject; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.matrix.data.LibCommonsMath; @@ -35,9 +34,7 @@ public class BinaryMatrixMatrixCPInstruction extends BinaryCPInstruction { } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { String opcode = getOpcode(); if ( LibCommonsMath.isSupportedMatrixMatrixOperation(opcode) ) { MatrixBlock solution = LibCommonsMath.matrixMatrixOperations( http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixScalarCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixScalarCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixScalarCPInstruction.java index c809049..a9ec74e 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixScalarCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryMatrixScalarCPInstruction.java @@ -20,7 +20,6 @@ package org.apache.sysml.runtime.instructions.cp; import org.apache.sysml.parser.Expression.DataType; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.matrix.data.MatrixBlock; import org.apache.sysml.runtime.matrix.operators.Operator; @@ -34,9 +33,7 @@ public class BinaryMatrixScalarCPInstruction extends BinaryCPInstruction { } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { CPOperand mat = ( input1.getDataType() == DataType.MATRIX ) ? input1 : input2; CPOperand scalar = ( input1.getDataType() == DataType.MATRIX ) ? input2 : input1; http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryScalarScalarCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryScalarScalarCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryScalarScalarCPInstruction.java index 76f53fb..5f7f8a7 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryScalarScalarCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BinaryScalarScalarCPInstruction.java @@ -33,7 +33,7 @@ public class BinaryScalarScalarCPInstruction extends BinaryCPInstruction { } @Override - public void processInstruction(ExecutionContext ec) throws DMLRuntimeException{ + public void processInstruction(ExecutionContext ec) { ScalarObject so1 = ec.getScalarInput(input1.getName(), input1.getValueType(), input1.isLiteral()); ScalarObject so2 = ec.getScalarInput(input2.getName(), input2.getValueType(), input2.isLiteral() ); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java index 72dfd7e..c5ac38d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BreakPointInstruction.java @@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.cp; import org.apache.sysml.api.DMLScript; import org.apache.sysml.debug.DebugState; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.context.ExecutionContext; import org.apache.sysml.runtime.instructions.Instruction; @@ -98,9 +97,7 @@ public class BreakPointInstruction extends Instruction } @Override - public void processInstruction(ExecutionContext ec) - throws DMLRuntimeException - { + public void processInstruction(ExecutionContext ec) { if( DMLScript.ENABLE_DEBUG_MODE && isBPInstructionEnabled()) { DebugState dbState = ec.getDebugState(); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java index e38fc0b..8f5058d 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinNaryCPInstruction.java @@ -47,7 +47,7 @@ public abstract class BuiltinNaryCPInstruction extends CPInstruction this.inputs = inputs; } - public static BuiltinNaryCPInstruction parseInstruction(String str) throws DMLRuntimeException { + public static BuiltinNaryCPInstruction parseInstruction(String str) { String[] parts = InstructionUtils.getInstructionPartsWithValueType(str); String opcode = parts[0]; CPOperand outputOperand = new CPOperand(parts[parts.length - 1]); http://git-wip-us.apache.org/repos/asf/systemml/blob/1f323976/src/main/java/org/apache/sysml/runtime/instructions/cp/CM_COV_Object.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/CM_COV_Object.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/CM_COV_Object.java index e662b33..2490996 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/CM_COV_Object.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/CM_COV_Object.java @@ -131,17 +131,13 @@ public class CM_COV_Object extends Data * * @param op operator * @return result of the aggregated operation for the given operator - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public double getRequiredResult(Operator op) throws DMLRuntimeException - { - if(op instanceof CMOperator) - { + public double getRequiredResult(Operator op) { + if(op instanceof CMOperator) { AggregateOperationTypes agg=((CMOperator)op).aggOpType; return getRequiredResult(agg); } - else - { + else { //avoid division by 0 if(w==1.0) return 0; @@ -156,9 +152,8 @@ public class CM_COV_Object extends Data * * @param agg aggregate operation type * @return result of the aggregated operation given the operation type - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public double getRequiredResult(AggregateOperationTypes agg) throws DMLRuntimeException { + public double getRequiredResult(AggregateOperationTypes agg) { switch(agg) { case COUNT: @@ -178,20 +173,14 @@ public class CM_COV_Object extends Data } } - public double getRequiredPartialResult(Operator op) - throws DMLRuntimeException - { - if(op instanceof CMOperator) - { + public double getRequiredPartialResult(Operator op) { + if(op instanceof CMOperator) { AggregateOperationTypes agg=((CMOperator)op).aggOpType; - switch(agg) - { - case COUNT: - return 0; - case MEAN: - return mean._sum; - case CM2: - case CM3: + switch(agg) { + case COUNT: return 0; + case MEAN: return mean._sum; + case CM2: + case CM3: case CM4: case VARIANCE: throw new DMLRuntimeException("Aggregation operator '"+agg.toString()+"' does not apply to partial aggregation."); @@ -203,8 +192,7 @@ public class CM_COV_Object extends Data return c2._sum; } - public double getWeight() - { + public double getWeight() { return w; }
