http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java b/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java index f264b48..569ef14 100644 --- a/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java +++ b/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java @@ -212,12 +212,9 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * * +per column sparsity * - * @throws DMLRuntimeException if DMLRuntimeException occurs * @return compressed matrix block or original block if incompressible */ - public MatrixBlock compress() - throws DMLRuntimeException - { + public MatrixBlock compress() { //default sequential execution return compress(1); } @@ -227,11 +224,8 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * * @param k number of threads * @return compressed matrix block or original block if incompressible - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public MatrixBlock compress(int k) - throws DMLRuntimeException - { + public MatrixBlock compress(int k) { //check for redundant compression if( isCompressed() ){ throw new DMLRuntimeException("Redundant compression, block already compressed."); @@ -436,8 +430,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } private static CompressedSizeInfo[] computeCompressedSizeInfos(CompressedSizeEstimator estim, int clen, int k) - throws DMLRuntimeException - { + { try { ExecutorService pool = CommonThreadPool.get(k); ArrayList<SizeEstimTask> tasks = new ArrayList<>(); @@ -455,8 +448,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } } - private static ColGroup[] compressColGroups(MatrixBlock in, CompressedSizeEstimator estim, HashMap<Integer, Double> compRatios, int rlen, List<int[]> groups, boolean denseEst) - { + private static ColGroup[] compressColGroups(MatrixBlock in, CompressedSizeEstimator estim, HashMap<Integer, Double> compRatios, int rlen, List<int[]> groups, boolean denseEst) { ColGroup[] ret = new ColGroup[groups.size()]; for( int i=0; i<groups.size(); i++ ) ret[i] = compressColGroup(in, estim, compRatios, rlen, groups.get(i), denseEst); @@ -465,7 +457,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } private static ColGroup[] compressColGroups(MatrixBlock in, CompressedSizeEstimator estim, HashMap<Integer, Double> compRatios, int rlen, List<int[]> groups, boolean denseEst, int k) - throws DMLRuntimeException { try { ExecutorService pool = CommonThreadPool.get(k); @@ -614,10 +605,8 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * * @return a new uncompressed matrix block containing the contents of this * block - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public MatrixBlock decompress() throws DMLRuntimeException - { + public MatrixBlock decompress() { //early abort for not yet compressed blocks if( !isCompressed() ) return new MatrixBlock(this); @@ -657,10 +646,8 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * @param k degree of parallelism * @return a new uncompressed matrix block containing the contents * of this block - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public MatrixBlock decompress(int k) throws DMLRuntimeException - { + public MatrixBlock decompress(int k) { //early abort for not yet compressed blocks if( !isCompressed() ) return new MatrixBlock(this); @@ -943,7 +930,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixValue scalarOperations(ScalarOperator sop, MatrixValue result) - throws DMLRuntimeException { //call uncompressed matrix scalar if necessary if( !isCompressed() ) { @@ -973,7 +959,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock append(MatrixBlock that, MatrixBlock ret) - throws DMLRuntimeException { //call uncompressed matrix append if necessary if( !isCompressed() ) { @@ -1019,7 +1004,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock chainMatrixMultOperations(MatrixBlock v, MatrixBlock w, MatrixBlock out, ChainType ctype) - throws DMLRuntimeException { //call uncompressed matrix mult if necessary if( !isCompressed() ) { @@ -1060,7 +1044,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock chainMatrixMultOperations(MatrixBlock v, MatrixBlock w, MatrixBlock out, ChainType ctype, int k) - throws DMLRuntimeException { //call uncompressed matrix mult if necessary if( !isCompressed() ){ @@ -1102,7 +1085,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock aggregateBinaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock ret, AggregateBinaryOperator op) - throws DMLRuntimeException { //call uncompressed matrix mult if necessary if( !isCompressed() ) { @@ -1192,7 +1174,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixValue aggregateUnaryOperations(AggregateUnaryOperator op, MatrixValue result, int blockingFactorRow, int blockingFactorCol, MatrixIndexes indexesIn, boolean inCP) - throws DMLRuntimeException { //call uncompressed matrix mult if necessary if( !isCompressed() ) { @@ -1328,13 +1309,13 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixValue aggregateUnaryOperations(AggregateUnaryOperator op, MatrixValue result, int blockingFactorRow, int blockingFactorCol, - MatrixIndexes indexesIn) throws DMLRuntimeException { + MatrixIndexes indexesIn) { return aggregateUnaryOperations(op, result, blockingFactorRow, blockingFactorCol, indexesIn, false); } private static void aggregateUnaryOperations(AggregateUnaryOperator op, - ArrayList<ColGroup> groups, MatrixBlock ret, int rl, int ru) throws DMLRuntimeException + ArrayList<ColGroup> groups, MatrixBlock ret, int rl, int ru) { boolean cacheDDC1 = ColGroupValue.LOW_LEVEL_OPT && op.indexFn instanceof ReduceCol && op.aggOp.increOp.fn instanceof KahanPlus //rowSums @@ -1362,7 +1343,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock transposeSelfMatrixMultOperations(MatrixBlock out, MMTSJType tstype) - throws DMLRuntimeException { //call uncompressed matrix mult if necessary if( !isCompressed() ) { @@ -1406,7 +1386,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock transposeSelfMatrixMultOperations(MatrixBlock out, MMTSJType tstype, int k) - throws DMLRuntimeException { //call uncompressed matrix mult if necessary if( !isCompressed() ){ @@ -1472,7 +1451,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * already */ private void rightMultByVector(MatrixBlock vector, MatrixBlock result) - throws DMLRuntimeException { // initialize and allocate the result result.allocateDenseBlock(); @@ -1490,10 +1468,8 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * @param vector matrix block vector * @param result matrix block result * @param k number of threads - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private void rightMultByVector(MatrixBlock vector, MatrixBlock result, int k) - throws DMLRuntimeException { // initialize and allocate the result result.allocateDenseBlock(); @@ -1529,7 +1505,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } private static void rightMultByVector(ArrayList<ColGroup> groups, MatrixBlock vect, MatrixBlock ret, boolean inclUC, int rl, int ru) - throws DMLRuntimeException { ColGroupValue.setupThreadLocalMemory(getMaxNumValues(groups)); @@ -1573,10 +1548,8 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * buffer to hold the result; must have the appropriate size * already * @param doTranspose if true, transpose vector - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private static void leftMultByVectorTranspose(List<ColGroup> colGroups, MatrixBlock vector, MatrixBlock result, boolean doTranspose, boolean allocTmp) - throws DMLRuntimeException { //transpose vector if required MatrixBlock rowVector = vector; @@ -1604,17 +1577,12 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable result.recomputeNonZeros(); } - private static void leftMultByVectorTranspose(List<ColGroup> colGroups, ColGroupDDC vector, MatrixBlock result) - throws DMLRuntimeException - { + private static void leftMultByVectorTranspose(List<ColGroup> colGroups, ColGroupDDC vector, MatrixBlock result) { // initialize and allocate the result result.reset(); - // delegate matrix-vector operation to each column group - for( ColGroup grp : colGroups ) { + for( ColGroup grp : colGroups ) ((ColGroupValue)grp).leftMultByRowVector(vector, result); - } - // post-processing result.recomputeNonZeros(); } @@ -1630,10 +1598,8 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable * already * @param doTranspose if true, transpose vector * @param k number of threads - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private void leftMultByVectorTranspose(List<ColGroup> colGroups,MatrixBlock vector, MatrixBlock result, boolean doTranspose, int k) - throws DMLRuntimeException { //transpose vector if required MatrixBlock rowVector = vector; @@ -1673,7 +1639,6 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } private static void leftMultByTransposeSelf(ArrayList<ColGroup> groups, MatrixBlock result, int gl, int gu) - throws DMLRuntimeException { final int numRows = groups.get(0).getNumRows(); final int numGroups = groups.size(); @@ -1792,7 +1757,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public Object call() throws DMLRuntimeException + public Object call() { // setup memory pool for reuse ColGroupValue.setupThreadLocalMemory(getMaxNumValues(_groups)); @@ -1823,7 +1788,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public Long call() throws DMLRuntimeException { + public Long call() { rightMultByVector(_groups, _vect, _ret, false, _rl, _ru); return _ret.recomputeNonZeros(_rl, _ru-1, 0, 0); } @@ -1844,7 +1809,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public Object call() throws DMLRuntimeException { + public Object call() { leftMultByTransposeSelf(_groups, _ret, _gl, _gu); return null; } @@ -1877,7 +1842,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixBlock call() throws DMLRuntimeException { + public MatrixBlock call() { aggregateUnaryOperations(_op, _groups, _ret, _rl, _ru); return _ret; } @@ -1894,7 +1859,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public CompressedSizeInfo call() throws DMLRuntimeException { + public CompressedSizeInfo call() { return _estim.estimateCompressedColGroupSize(new int[] { _col }); } } @@ -1918,7 +1883,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public ColGroup call() throws DMLRuntimeException { + public ColGroup call() { return compressColGroup(_in, _estim, _compRatios, _rlen, _colIndexes, _denseEst); } } @@ -1938,7 +1903,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public Object call() throws DMLRuntimeException { + public Object call() { //preallocate sparse rows to avoid repeated alloc if( _ret.isInSparseFormat() ) { @@ -1966,16 +1931,14 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable // Graceful fallback to uncompressed linear algebra @Override - public MatrixValue unaryOperations(UnaryOperator op, MatrixValue result) - throws DMLRuntimeException { + public MatrixValue unaryOperations(UnaryOperator op, MatrixValue result) { printDecompressWarning("unaryOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.unaryOperations(op, result); } @Override - public MatrixValue binaryOperations(BinaryOperator op, MatrixValue thatValue, MatrixValue result) - throws DMLRuntimeException { + public MatrixValue binaryOperations(BinaryOperator op, MatrixValue thatValue, MatrixValue result) { printDecompressWarning("binaryOperations", (MatrixBlock)thatValue); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(thatValue); @@ -1983,8 +1946,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public void binaryOperationsInPlace(BinaryOperator op, MatrixValue thatValue) - throws DMLRuntimeException { + public void binaryOperationsInPlace(BinaryOperator op, MatrixValue thatValue) { printDecompressWarning("binaryOperationsInPlace", (MatrixBlock)thatValue); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(thatValue); @@ -1992,30 +1954,26 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public void incrementalAggregate(AggregateOperator aggOp, MatrixValue correction, MatrixValue newWithCorrection) - throws DMLRuntimeException { + public void incrementalAggregate(AggregateOperator aggOp, MatrixValue correction, MatrixValue newWithCorrection) { throw new DMLRuntimeException("CompressedMatrixBlock: incrementalAggregate not supported."); } @Override - public void incrementalAggregate(AggregateOperator aggOp, MatrixValue newWithCorrection) - throws DMLRuntimeException { + public void incrementalAggregate(AggregateOperator aggOp, MatrixValue newWithCorrection) { throw new DMLRuntimeException("CompressedMatrixBlock: incrementalAggregate not supported."); } @Override - public MatrixValue reorgOperations(ReorgOperator op, MatrixValue ret, int startRow, int startColumn, int length) - throws DMLRuntimeException { + public MatrixValue reorgOperations(ReorgOperator op, MatrixValue ret, int startRow, int startColumn, int length) { printDecompressWarning("reorgOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.reorgOperations(op, ret, startRow, startColumn, length); } @Override - public MatrixBlock append(MatrixBlock that, MatrixBlock ret, boolean cbind) - throws DMLRuntimeException { + public MatrixBlock append(MatrixBlock that, MatrixBlock ret, boolean cbind) { if( cbind ) //use supported operation - return append(that, ret); + return append(that, ret); printDecompressWarning("append-rbind", that); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(that); @@ -2025,8 +1983,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public void append(MatrixValue v2, ArrayList<IndexedMatrixValue> outlist, int blockRowFactor, - int blockColFactor, boolean cbind, boolean m2IsLast, int nextNCol) - throws DMLRuntimeException { + int blockColFactor, boolean cbind, boolean m2IsLast, int nextNCol) { printDecompressWarning("append", (MatrixBlock)v2); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(v2); @@ -2034,14 +1991,12 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val) - throws DMLRuntimeException { + public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val) { permutationMatrixMultOperations(m2Val, out1Val, out2Val, 1); } @Override - public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val, int k) - throws DMLRuntimeException { + public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val, int k) { printDecompressWarning("permutationMatrixMultOperations", (MatrixBlock)m2Val); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(m2Val); @@ -2049,8 +2004,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, int rl, int ru, int cl, int cu, MatrixBlock ret, UpdateType update) - throws DMLRuntimeException { + public MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, int rl, int ru, int cl, int cu, MatrixBlock ret, UpdateType update) { printDecompressWarning("leftIndexingOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(rhsMatrix); @@ -2058,16 +2012,14 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixBlock leftIndexingOperations(ScalarObject scalar, int rl, int cl, MatrixBlock ret, UpdateType update) - throws DMLRuntimeException { + public MatrixBlock leftIndexingOperations(ScalarObject scalar, int rl, int cl, MatrixBlock ret, UpdateType update) { printDecompressWarning("leftIndexingOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.leftIndexingOperations(scalar, rl, cl, ret, update); } @Override - public MatrixBlock slice(int rl, int ru, int cl, int cu, CacheBlock ret) - throws DMLRuntimeException { + public MatrixBlock slice(int rl, int ru, int cl, int cu, CacheBlock ret) { printDecompressWarning("slice"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.slice(rl, ru, cl, cu, ret); @@ -2089,15 +2041,14 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixValue zeroOutOperations(MatrixValue result, IndexRange range, boolean complementary) - throws DMLRuntimeException { + public MatrixValue zeroOutOperations(MatrixValue result, IndexRange range, boolean complementary) { printDecompressWarning("zeroOutOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.zeroOutOperations(result, range, complementary); } @Override - public CM_COV_Object cmOperations(CMOperator op) throws DMLRuntimeException { + public CM_COV_Object cmOperations(CMOperator op) { printDecompressWarning("cmOperations"); if( !isCompressed() || isEmptyBlock() ) return super.cmOperations(op); @@ -2112,8 +2063,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public CM_COV_Object cmOperations(CMOperator op, MatrixBlock weights) - throws DMLRuntimeException { + public CM_COV_Object cmOperations(CMOperator op, MatrixBlock weights) { printDecompressWarning("cmOperations"); MatrixBlock right = getUncompressed(weights); if( !isCompressed() || isEmptyBlock() ) @@ -2125,8 +2075,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public CM_COV_Object covOperations(COVOperator op, MatrixBlock that) - throws DMLRuntimeException { + public CM_COV_Object covOperations(COVOperator op, MatrixBlock that) { printDecompressWarning("covOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(that); @@ -2134,8 +2083,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public CM_COV_Object covOperations(COVOperator op, MatrixBlock that, MatrixBlock weights) - throws DMLRuntimeException { + public CM_COV_Object covOperations(COVOperator op, MatrixBlock that, MatrixBlock weights) { printDecompressWarning("covOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right1 = getUncompressed(that); @@ -2144,8 +2092,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixValue sortOperations(MatrixValue weights, MatrixValue result) - throws DMLRuntimeException { + public MatrixValue sortOperations(MatrixValue weights, MatrixValue result) { printDecompressWarning("sortOperations"); MatrixBlock right = getUncompressed(weights); if( !isCompressed() ) @@ -2170,8 +2117,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock aggregateBinaryOperations(MatrixIndexes m1Index, MatrixBlock m1Value, MatrixIndexes m2Index, MatrixBlock m2Value, - MatrixBlock result, AggregateBinaryOperator op) - throws DMLRuntimeException { + MatrixBlock result, AggregateBinaryOperator op) { printDecompressWarning("aggregateBinaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(m2Value); @@ -2179,8 +2125,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixBlock aggregateTernaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret, AggregateTernaryOperator op, boolean inCP) - throws DMLRuntimeException { + public MatrixBlock aggregateTernaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret, AggregateTernaryOperator op, boolean inCP) { printDecompressWarning("aggregateTernaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right1 = getUncompressed(m2); @@ -2190,8 +2135,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock uaggouterchainOperations(MatrixBlock mbLeft, MatrixBlock mbRight, - MatrixBlock mbOut, BinaryOperator bOp, AggregateUnaryOperator uaggOp) - throws DMLRuntimeException { + MatrixBlock mbOut, BinaryOperator bOp, AggregateUnaryOperator uaggOp) { printDecompressWarning("uaggouterchainOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(mbRight); @@ -2199,15 +2143,13 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, Operator op) - throws DMLRuntimeException { + public MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, Operator op) { return groupedAggOperations(tgt, wghts, ret, ngroups, op, 1); } @Override public MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, - MatrixValue ret, int ngroups, Operator op, int k) - throws DMLRuntimeException { + MatrixValue ret, int ngroups, Operator op, int k) { printDecompressWarning("groupedAggOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(wghts); @@ -2215,16 +2157,14 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn, MatrixBlock select) - throws DMLRuntimeException { + public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn, MatrixBlock select) { printDecompressWarning("removeEmptyOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.removeEmptyOperations(ret, rows, emptyReturn, select); } @Override - public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn) - throws DMLRuntimeException { + public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn) { printDecompressWarning("removeEmptyOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.removeEmptyOperations(ret, rows, emptyReturn); @@ -2232,16 +2172,14 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock rexpandOperations(MatrixBlock ret, double max, - boolean rows, boolean cast, boolean ignore, int k) - throws DMLRuntimeException { + boolean rows, boolean cast, boolean ignore, int k) { printDecompressWarning("rexpandOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.rexpandOperations(ret, max, rows, cast, ignore, k); } @Override - public MatrixValue replaceOperations(MatrixValue result, double pattern, double replacement) - throws DMLRuntimeException { + public MatrixValue replaceOperations(MatrixValue result, double pattern, double replacement) { printDecompressWarning("replaceOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; return tmp.replaceOperations(result, pattern, replacement); @@ -2249,8 +2187,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public void ctableOperations(Operator op, double scalar, - MatrixValue that, CTableMap resultMap, MatrixBlock resultBlock) - throws DMLRuntimeException { + MatrixValue that, CTableMap resultMap, MatrixBlock resultBlock) { printDecompressWarning("ternaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(that); @@ -2259,8 +2196,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public void ctableOperations(Operator op, double scalar, - double scalar2, CTableMap resultMap, MatrixBlock resultBlock) - throws DMLRuntimeException { + double scalar2, CTableMap resultMap, MatrixBlock resultBlock) { printDecompressWarning("ternaryOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; tmp.ctableOperations(op, scalar, scalar2, resultMap, resultBlock); @@ -2269,7 +2205,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public void ctableOperations(Operator op, MatrixIndexes ix1, double scalar, boolean left, int brlen, CTableMap resultMap, - MatrixBlock resultBlock) throws DMLRuntimeException { + MatrixBlock resultBlock) { printDecompressWarning("ternaryOperations"); MatrixBlock tmp = isCompressed() ? decompress() : this; tmp.ctableOperations(op, ix1, scalar, left, brlen, resultMap, resultBlock); @@ -2278,7 +2214,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public void ctableOperations(Operator op, MatrixValue that, double scalar, boolean ignoreZeros, CTableMap resultMap, - MatrixBlock resultBlock) throws DMLRuntimeException { + MatrixBlock resultBlock) { printDecompressWarning("ternaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(that); @@ -2286,8 +2222,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public void ctableOperations(Operator op, MatrixValue that, double scalar, MatrixBlock resultBlock) - throws DMLRuntimeException { + public void ctableOperations(Operator op, MatrixValue that, double scalar, MatrixBlock resultBlock) { printDecompressWarning("ternaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right = getUncompressed(that); @@ -2296,8 +2231,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public void ctableOperations(Operator op, MatrixValue that, - MatrixValue that2, CTableMap resultMap) - throws DMLRuntimeException { + MatrixValue that2, CTableMap resultMap) { printDecompressWarning("ternaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right1 = getUncompressed(that); @@ -2307,8 +2241,7 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public void ctableOperations(Operator op, MatrixValue that, - MatrixValue that2, CTableMap resultMap, MatrixBlock resultBlock) - throws DMLRuntimeException { + MatrixValue that2, CTableMap resultMap, MatrixBlock resultBlock) { printDecompressWarning("ternaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right1 = getUncompressed(that); @@ -2318,15 +2251,13 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable @Override public MatrixBlock quaternaryOperations(QuaternaryOperator qop, - MatrixBlock um, MatrixBlock vm, MatrixBlock wm, MatrixBlock out) - throws DMLRuntimeException { + MatrixBlock um, MatrixBlock vm, MatrixBlock wm, MatrixBlock out) { return quaternaryOperations(qop, um, vm, wm, out, 1); } @Override public MatrixBlock quaternaryOperations(QuaternaryOperator qop, MatrixBlock um, - MatrixBlock vm, MatrixBlock wm, MatrixBlock out, int k) - throws DMLRuntimeException { + MatrixBlock vm, MatrixBlock wm, MatrixBlock out, int k) { printDecompressWarning("quaternaryOperations"); MatrixBlock left = isCompressed() ? decompress() : this; MatrixBlock right1 = getUncompressed(um); @@ -2336,30 +2267,26 @@ public class CompressedMatrixBlock extends MatrixBlock implements Externalizable } @Override - public MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, Well1024a bigrand, long bSeed) - throws DMLRuntimeException { - throw new RuntimeException("CompressedMatrixBlock: randOperationsInPlace not supported."); + public MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, Well1024a bigrand, long bSeed) { + throw new DMLRuntimeException("CompressedMatrixBlock: randOperationsInPlace not supported."); } @Override - public MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, Well1024a bigrand, long bSeed, int k) - throws DMLRuntimeException { - throw new RuntimeException("CompressedMatrixBlock: randOperationsInPlace not supported."); + public MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, Well1024a bigrand, long bSeed, int k) { + throw new DMLRuntimeException("CompressedMatrixBlock: randOperationsInPlace not supported."); } @Override - public MatrixBlock seqOperationsInPlace(double from, double to, double incr) - throws DMLRuntimeException { + public MatrixBlock seqOperationsInPlace(double from, double to, double incr) { //output should always be uncompressed - throw new RuntimeException("CompressedMatrixBlock: seqOperationsInPlace not supported."); + throw new DMLRuntimeException("CompressedMatrixBlock: seqOperationsInPlace not supported."); } private static boolean isCompressed(MatrixBlock mb) { return (mb instanceof CompressedMatrixBlock && ((CompressedMatrixBlock)mb).isCompressed()); } - private static MatrixBlock getUncompressed(MatrixValue mVal) - throws DMLRuntimeException { + private static MatrixBlock getUncompressed(MatrixValue mVal) { return isCompressed((MatrixBlock)mVal) ? ((CompressedMatrixBlock)mVal).decompress() : (MatrixBlock)mVal;
http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/compress/cocode/PlanningCoCoder.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/compress/cocode/PlanningCoCoder.java b/src/main/java/org/apache/sysml/runtime/compress/cocode/PlanningCoCoder.java index e00c734..d6f6566 100644 --- a/src/main/java/org/apache/sysml/runtime/compress/cocode/PlanningCoCoder.java +++ b/src/main/java/org/apache/sysml/runtime/compress/cocode/PlanningCoCoder.java @@ -48,7 +48,6 @@ public class PlanningCoCoder public static List<int[]> findCocodesByPartitioning(CompressedSizeEstimator sizeEstimator, List<Integer> cols, CompressedSizeInfo[] colInfos, int numRows, int k) - throws DMLRuntimeException { // filtering out non-groupable columns as singleton groups // weight is the ratio of its cardinality to the number of rows @@ -92,7 +91,6 @@ public class PlanningCoCoder } private static List<int[]> getCocodingGroupsBruteForce(List<List<Integer>> bins, HashMap<Integer, GroupableColInfo> groupColsInfo, CompressedSizeEstimator estim, int rlen, int k) - throws DMLRuntimeException { List<int[]> retGroups = new ArrayList<>(); try { @@ -226,7 +224,7 @@ public class PlanningCoCoder } @Override - public PlanningCoCodingGroup[] call() throws DMLRuntimeException { + public PlanningCoCodingGroup[] call() { // brute force co-coding return findCocodesBruteForce(_estim, _rlen, _sgroups.toArray(new PlanningCoCodingGroup[0])); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/compress/estim/CompressedSizeEstimatorSample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/compress/estim/CompressedSizeEstimatorSample.java b/src/main/java/org/apache/sysml/runtime/compress/estim/CompressedSizeEstimatorSample.java index f3d842a..d4c829c 100644 --- a/src/main/java/org/apache/sysml/runtime/compress/estim/CompressedSizeEstimatorSample.java +++ b/src/main/java/org/apache/sysml/runtime/compress/estim/CompressedSizeEstimatorSample.java @@ -28,7 +28,6 @@ import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils; import org.apache.commons.math3.distribution.ChiSquaredDistribution; import org.apache.commons.math3.random.RandomDataGenerator; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.compress.BitmapEncoder; import org.apache.sysml.runtime.compress.ReaderColumnSelection; import org.apache.sysml.runtime.compress.CompressedMatrixBlock; @@ -52,7 +51,6 @@ public class CompressedSizeEstimatorSample extends CompressedSizeEstimator private HashMap<Integer, Double> _solveCache = null; public CompressedSizeEstimatorSample(MatrixBlock data, int sampleSize) - throws DMLRuntimeException { super(data); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/compress/estim/SizeEstimatorFactory.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/compress/estim/SizeEstimatorFactory.java b/src/main/java/org/apache/sysml/runtime/compress/estim/SizeEstimatorFactory.java index 63a092c..1c6f67e 100644 --- a/src/main/java/org/apache/sysml/runtime/compress/estim/SizeEstimatorFactory.java +++ b/src/main/java/org/apache/sysml/runtime/compress/estim/SizeEstimatorFactory.java @@ -19,7 +19,6 @@ package org.apache.sysml.runtime.compress.estim; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.matrix.data.MatrixBlock; public class SizeEstimatorFactory @@ -28,7 +27,7 @@ public class SizeEstimatorFactory public static final boolean EXTRACT_SAMPLE_ONCE = true; @SuppressWarnings("unused") - public static CompressedSizeEstimator getSizeEstimator(MatrixBlock data, int numRows) throws DMLRuntimeException { + public static CompressedSizeEstimator getSizeEstimator(MatrixBlock data, int numRows) { return (SAMPLING_RATIO == 1.0) ? new CompressedSizeEstimatorExact(data): new CompressedSizeEstimatorSample(data, (int) (numRows*SAMPLING_RATIO)); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlock.java index da6ffc3..72a7b2b 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlock.java @@ -69,12 +69,11 @@ public class ExternalFunctionProgramBlock extends FunctionProgramBlock * @param inputParams list of input data identifiers * @param outputParams list of output data indentifiers * @param baseDir base directory - * @throws DMLRuntimeException if DMLRuntimeException occurs */ protected ExternalFunctionProgramBlock(Program prog, ArrayList<DataIdentifier> inputParams, ArrayList<DataIdentifier> outputParams, - String baseDir) throws DMLRuntimeException + String baseDir) { super(prog, inputParams, outputParams); _baseDir = baseDir; @@ -84,7 +83,7 @@ public class ExternalFunctionProgramBlock extends FunctionProgramBlock ArrayList<DataIdentifier> inputParams, ArrayList<DataIdentifier> outputParams, HashMap<String, String> otherParams, - String baseDir) throws DMLRuntimeException { + String baseDir) { super(prog, inputParams, outputParams); _baseDir = baseDir; @@ -140,7 +139,6 @@ public class ExternalFunctionProgramBlock extends FunctionProgramBlock */ @Override public void execute(ExecutionContext ec) - throws DMLRuntimeException { _runID = _idSeq.getNextID(); @@ -228,9 +226,8 @@ public class ExternalFunctionProgramBlock extends FunctionProgramBlock /** * method to create instructions * - * @throws DMLRuntimeException */ - protected void createInstructions() throws DMLRuntimeException { + protected void createInstructions() { _inst = new ArrayList<>(); @@ -267,7 +264,7 @@ public class ExternalFunctionProgramBlock extends FunctionProgramBlock } @SuppressWarnings("unchecked") - protected PackageFunction createFunctionObject(String className, String configFile) throws DMLRuntimeException { + protected PackageFunction createFunctionObject(String className, String configFile) { try { //create instance of package function Class<Instruction> cla = (Class<Instruction>) Class.forName(className); @@ -287,9 +284,7 @@ public class ExternalFunctionProgramBlock extends FunctionProgramBlock } } - protected void verifyFunctionInputsOutputs(PackageFunction fun, CPOperand[] inputs, CPOperand[] outputs) - throws DMLRuntimeException - { + protected void verifyFunctionInputsOutputs(PackageFunction fun, CPOperand[] inputs, CPOperand[] outputs) { // verify number of outputs if( outputs.length != fun.getNumFunctionOutputs() ) { throw new DMLRuntimeException( http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlockCP.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlockCP.java b/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlockCP.java index 48a4f52..38a3516 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlockCP.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ExternalFunctionProgramBlockCP.java @@ -56,13 +56,12 @@ public class ExternalFunctionProgramBlockCP extends ExternalFunctionProgramBlock * @param outputParams list of output data identifiers * @param otherParams map of other parameters * @param baseDir base directory - * @throws DMLRuntimeException if DMLRuntimeException occurs */ public ExternalFunctionProgramBlockCP(Program prog, ArrayList<DataIdentifier> inputParams, ArrayList<DataIdentifier> outputParams, HashMap<String, String> otherParams, - String baseDir) throws DMLRuntimeException { + String baseDir) { super(prog, inputParams, outputParams, baseDir); //w/o instruction generation @@ -79,7 +78,7 @@ public class ExternalFunctionProgramBlockCP extends ExternalFunctionProgramBlock * invocation */ @Override - public void execute(ExecutionContext ec) throws DMLRuntimeException + public void execute(ExecutionContext ec) { if( _inst.size() != 1 ) throw new DMLRuntimeException("Invalid number of instructions: "+_inst.size()); @@ -98,7 +97,7 @@ public class ExternalFunctionProgramBlockCP extends ExternalFunctionProgramBlock } @Override - protected void createInstructions() throws DMLRuntimeException + protected void createInstructions() { _inst = new ArrayList<>(); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java index c28825e..400af92 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ForProgramBlock.java @@ -100,9 +100,7 @@ public class ForProgramBlock extends ProgramBlock } @Override - public void execute(ExecutionContext ec) - throws DMLRuntimeException - { + public void execute(ExecutionContext ec) { // evaluate from, to, incr only once (assumption: known at for entry) IntObject from = executePredicateInstructions( 1, _fromInstructions, ec ); IntObject to = executePredicateInstructions( 2, _toInstructions, ec ); @@ -155,7 +153,6 @@ public class ForProgramBlock extends ProgramBlock } protected IntObject executePredicateInstructions( int pos, ArrayList<Instruction> instructions, ExecutionContext ec ) - throws DMLRuntimeException { ScalarObject tmp = null; IntObject ret = null; http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/FunctionProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/FunctionProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/FunctionProgramBlock.java index a8e1d17..5ea84a7 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/FunctionProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/FunctionProgramBlock.java @@ -81,8 +81,7 @@ public class FunctionProgramBlock extends ProgramBlock @Override public void execute(ExecutionContext ec) - throws DMLRuntimeException - { + { //dynamically recompile entire function body (according to function inputs) try { if( ConfigurationManager.isDynamicRecompilation() http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/IfProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/IfProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/IfProgramBlock.java index b09a1a3..8ddf829 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/IfProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/IfProgramBlock.java @@ -97,8 +97,7 @@ public class IfProgramBlock extends ProgramBlock @Override public void execute(ExecutionContext ec) - throws DMLRuntimeException - { + { BooleanObject predResult = executePredicate(ec); //execute if statement @@ -151,7 +150,6 @@ public class IfProgramBlock extends ProgramBlock } private BooleanObject executePredicate(ExecutionContext ec) - throws DMLRuntimeException { BooleanObject result = null; try http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/LocalVariableMap.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/LocalVariableMap.java b/src/main/java/org/apache/sysml/runtime/controlprogram/LocalVariableMap.java index c91eec4..672e9f7 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/LocalVariableMap.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/LocalVariableMap.java @@ -26,7 +26,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.StringTokenizer; -import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.caching.CacheableData; import org.apache.sysml.runtime.controlprogram.parfor.ProgramConverter; import org.apache.sysml.runtime.controlprogram.parfor.util.IDSequence; @@ -131,7 +130,7 @@ public class LocalVariableMap implements Cloneable .mapToDouble(d -> ((CacheableData<?>)d).getDataSize()).sum(); } - public String serialize() throws DMLRuntimeException { + public String serialize() { StringBuilder sb = new StringBuilder(); int count = 0; for (Entry <String, Data> e : localMap.entrySet ()) { @@ -144,9 +143,7 @@ public class LocalVariableMap implements Cloneable return sb.toString(); } - public static LocalVariableMap deserialize(String varStr) - throws DMLRuntimeException - { + public static LocalVariableMap deserialize(String varStr) { StringTokenizer st2 = new StringTokenizer (varStr, ELEMENT_DELIM ); LocalVariableMap vars = new LocalVariableMap (); while( st2.hasMoreTokens() ) { http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/ParForProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/ParForProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/ParForProgramBlock.java index fdc4732..c46e4dd 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/ParForProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ParForProgramBlock.java @@ -369,9 +369,7 @@ public class ParForProgramBlock extends ForProgramBlock protected HashMap<Long,ArrayList<ProgramBlock>> _pbcache = null; protected long[] _pwIDs = null; - public ParForProgramBlock(Program prog, String iterPredVar, HashMap<String,String> params, ArrayList<ResultVar> resultVars) - throws DMLRuntimeException - { + public ParForProgramBlock(Program prog, String iterPredVar, HashMap<String,String> params, ArrayList<ResultVar> resultVars) { this( -1, prog, iterPredVar, params, resultVars); } @@ -384,7 +382,6 @@ public class ParForProgramBlock extends ForProgramBlock * @param iterPredVars ? * @param params map of parameters * @param resultVars list of result variable names - * @throws DMLRuntimeException if DMLRuntimeException occurs */ public ParForProgramBlock(int ID, Program prog, String iterPredVar, HashMap<String,String> params, ArrayList<ResultVar> resultVars) { @@ -572,7 +569,6 @@ public class ParForProgramBlock extends ForProgramBlock @Override public void execute(ExecutionContext ec) - throws DMLRuntimeException { ParForStatementBlock sb = (ParForStatementBlock)getStatementBlock(); @@ -723,11 +719,10 @@ public class ParForProgramBlock extends ForProgramBlock * @param from ? * @param to ? * @param incr ? - * @throws DMLRuntimeException if DMLRuntimeException occurs * @throws InterruptedException if InterruptedException occurs */ private void executeLocalParFor( ExecutionContext ec, IntObject itervar, IntObject from, IntObject to, IntObject incr ) - throws DMLRuntimeException, InterruptedException + throws InterruptedException { LOG.trace("Local Par For (multi-threaded) with degree of parallelism : " + _numThreads); /* Step 1) init parallel workers, task queue and threads @@ -856,7 +851,7 @@ public class ParForProgramBlock extends ForProgramBlock } private void executeRemoteMRParFor( ExecutionContext ec, IntObject itervar, IntObject from, IntObject to, IntObject incr ) - throws DMLRuntimeException, IOException + throws IOException { /* Step 0) check and recompile MR inst * Step 1) serialize child PB and inst @@ -940,7 +935,7 @@ public class ParForProgramBlock extends ForProgramBlock } private void executeRemoteMRParForDP( ExecutionContext ec, IntObject itervar, IntObject from, IntObject to, IntObject incr ) - throws DMLRuntimeException, IOException + throws IOException { /* Step 0) check and recompile MR inst * Step 1) serialize child PB and inst @@ -1011,7 +1006,6 @@ public class ParForProgramBlock extends ForProgramBlock } private void executeRemoteSparkParFor(ExecutionContext ec, IntObject itervar, IntObject from, IntObject to, IntObject incr) - throws DMLRuntimeException { Timing time = ( _monitor ? new Timing(true) : null ); @@ -1072,7 +1066,7 @@ public class ParForProgramBlock extends ForProgramBlock } private void executeRemoteSparkParForDP( ExecutionContext ec, IntObject itervar, IntObject from, IntObject to, IntObject incr ) - throws DMLRuntimeException, IOException + throws IOException { Timing time = ( _monitor ? new Timing(true) : null ); @@ -1136,7 +1130,6 @@ public class ParForProgramBlock extends ForProgramBlock } private void handleDataPartitioning( ExecutionContext ec ) - throws DMLRuntimeException { PDataPartitioner dataPartitioner = _dataPartitioner; if( dataPartitioner != PDataPartitioner.NONE ) @@ -1205,9 +1198,7 @@ public class ParForProgramBlock extends ForProgramBlock } } - private void handleSparkRepartitioning( ExecutionContext ec ) - throws DMLRuntimeException - { + private void handleSparkRepartitioning( ExecutionContext ec ) { if( OptimizerUtils.isSparkExecutionMode() && _variablesRP != null && !_variablesRP.isEmpty() ) { SparkExecutionContext sec = (SparkExecutionContext) ec; @@ -1216,9 +1207,7 @@ public class ParForProgramBlock extends ForProgramBlock } } - private void handleSparkEagerCaching( ExecutionContext ec ) - throws DMLRuntimeException - { + private void handleSparkEagerCaching( ExecutionContext ec ) { if( OptimizerUtils.isSparkExecutionMode() && _variablesECache != null && !_variablesECache.isEmpty() ) { SparkExecutionContext sec = (SparkExecutionContext) ec; @@ -1233,11 +1222,8 @@ public class ParForProgramBlock extends ForProgramBlock * @param ec execution context * @param out output matrix * @param in array of input matrix objects - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - private static void cleanWorkerResultVariables(ExecutionContext ec, MatrixObject out, MatrixObject[] in) - throws DMLRuntimeException - { + private static void cleanWorkerResultVariables(ExecutionContext ec, MatrixObject out, MatrixObject[] in) { for( MatrixObject tmp : in ) { //check for empty inputs (no iterations executed) if( tmp != null && tmp != out ) @@ -1254,10 +1240,8 @@ public class ParForProgramBlock extends ForProgramBlock * * @param out local variable map * @param sb statement block - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private static void createEmptyUnscopedVariables( LocalVariableMap out, StatementBlock sb ) - throws DMLRuntimeException { VariableSet updated = sb.variablesUpdated(); VariableSet livein = sb.liveIn(); @@ -1330,9 +1314,7 @@ public class ParForProgramBlock extends ForProgramBlock } } - private void cleanupSharedVariables( ExecutionContext ec, boolean[] varState ) - throws DMLRuntimeException - { + private void cleanupSharedVariables( ExecutionContext ec, boolean[] varState ) { //TODO needs as precondition a systematic treatment of persistent read information. } @@ -1405,10 +1387,8 @@ public class ParForProgramBlock extends ForProgramBlock * @param to ? * @param incr ? * @return task partitioner - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private TaskPartitioner createTaskPartitioner( IntObject from, IntObject to, IntObject incr ) - throws DMLRuntimeException { TaskPartitioner tp = null; @@ -1454,10 +1434,8 @@ public class ParForProgramBlock extends ForProgramBlock * @param dataPartitioner data partitioner * @param ec execution context * @return data partitioner - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private DataPartitioner createDataPartitioner(PartitionFormat dpf, PDataPartitioner dataPartitioner, ExecutionContext ec) - throws DMLRuntimeException { DataPartitioner dp = null; @@ -1491,7 +1469,6 @@ public class ParForProgramBlock extends ForProgramBlock } private ResultMerge createResultMerge( PResultMerge prm, MatrixObject out, MatrixObject[] in, String fname, boolean accum, ExecutionContext ec ) - throws DMLRuntimeException { ResultMerge rm = null; @@ -1550,10 +1527,8 @@ public class ParForProgramBlock extends ForProgramBlock * * @param tid thread id * @return true if recompile was necessary and possible - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private boolean checkMRAndRecompileToCP(long tid) - throws DMLRuntimeException { //no MR instructions, ok if( !OptTreeConverter.rContainsMRJobInstruction(this, true) ) @@ -1572,15 +1547,13 @@ public class ParForProgramBlock extends ForProgramBlock return true; } - private void releaseForcedRecompile(long tid) - throws DMLRuntimeException - { + private void releaseForcedRecompile(long tid) { Recompiler.recompileProgramBlockHierarchy2Forced( _childBlocks, tid, new HashSet<String>(), null); } private static String writeTasksToFile(String fname, List<Task> tasks, int maxDigits) - throws DMLRuntimeException, IOException + throws IOException { BufferedWriter br = null; try @@ -1607,7 +1580,7 @@ public class ParForProgramBlock extends ForProgramBlock } private static String writeTasksToFile(String fname, LocalTaskQueue<Task> queue, int maxDigits) - throws DMLRuntimeException, IOException + throws IOException { BufferedWriter br = null; try @@ -1640,7 +1613,6 @@ public class ParForProgramBlock extends ForProgramBlock } private void consolidateAndCheckResults(ExecutionContext ec, long expIters, long expTasks, long numIters, long numTasks, LocalVariableMap [] results) - throws DMLRuntimeException { Timing time = new Timing(true); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java b/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java index 9dd4b9c..48b05b6 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/Program.java @@ -85,7 +85,7 @@ public class Program return retVal; } - public synchronized FunctionProgramBlock getFunctionProgramBlock(String namespace, String fname) throws DMLRuntimeException{ + public synchronized FunctionProgramBlock getFunctionProgramBlock(String namespace, String fname){ if (namespace == null) namespace = DMLProgram.DEFAULT_NAMESPACE; HashMap<String,FunctionProgramBlock> namespaceFunctBlocks = _namespaceFunctions.get(namespace); @@ -106,9 +106,7 @@ public class Program return _programBlocks; } - public void execute(ExecutionContext ec) - throws DMLRuntimeException - { + public void execute(ExecutionContext ec) { ec.initDebugProgramCounters(); try http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java index 54c9e70..308c6a5 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ProgramBlock.java @@ -126,10 +126,8 @@ public class ProgramBlock implements ParseInfo * Executes this program block (incl recompilation if required). * * @param ec execution context - * @throws DMLRuntimeException if DMLRuntimeException occurs */ public void execute(ExecutionContext ec) - throws DMLRuntimeException { ArrayList<Instruction> tmp = _inst; @@ -172,10 +170,8 @@ public class ProgramBlock implements ParseInfo * @param retType value type of the return type * @param ec execution context * @return scalar object - * @throws DMLRuntimeException if DMLRuntimeException occurs */ public ScalarObject executePredicate(ArrayList<Instruction> inst, Hop hops, boolean requiresRecompile, ValueType retType, ExecutionContext ec) - throws DMLRuntimeException { ArrayList<Instruction> tmp = inst; @@ -205,23 +201,17 @@ public class ProgramBlock implements ParseInfo return executePredicateInstructions(tmp, retType, ec); } - protected void executeInstructions(ArrayList<Instruction> inst, ExecutionContext ec) - throws DMLRuntimeException - { - for (int i = 0; i < inst.size(); i++) - { + protected void executeInstructions(ArrayList<Instruction> inst, ExecutionContext ec) { + for (int i = 0; i < inst.size(); i++) { //indexed access required due to dynamic add Instruction currInst = inst.get(i); - //execute instruction ec.updateDebugState(i); executeSingleInstruction(currInst, ec); } } - protected ScalarObject executePredicateInstructions(ArrayList<Instruction> inst, ValueType retType, ExecutionContext ec) - throws DMLRuntimeException - { + protected ScalarObject executePredicateInstructions(ArrayList<Instruction> inst, ValueType retType, ExecutionContext ec) { //execute all instructions (indexed access required due to debug mode) int pos = 0; for( Instruction currInst : inst ) { @@ -248,9 +238,7 @@ public class ProgramBlock implements ParseInfo return ret; } - private void executeSingleInstruction( Instruction currInst, ExecutionContext ec ) - throws DMLRuntimeException - { + private void executeSingleInstruction( Instruction currInst, ExecutionContext ec ) { try { // start time measurement for statistics @@ -299,9 +287,7 @@ public class ProgramBlock implements ParseInfo } } - protected UpdateType[] prepareUpdateInPlaceVariables(ExecutionContext ec, long tid) - throws DMLRuntimeException - { + protected UpdateType[] prepareUpdateInPlaceVariables(ExecutionContext ec, long tid) { if( _sb == null || _sb.getUpdateInPlaceVars().isEmpty() ) return null; @@ -331,12 +317,9 @@ public class ProgramBlock implements ParseInfo return flags; } - protected void resetUpdateInPlaceVariableFlags(ExecutionContext ec, UpdateType[] flags) - throws DMLRuntimeException - { + protected void resetUpdateInPlaceVariableFlags(ExecutionContext ec, UpdateType[] flags) { if( flags == null ) return; - //reset update-in-place flag to pre-loop status ArrayList<String> varnames = _sb.getUpdateInPlaceVars(); for( int i=0; i<varnames.size(); i++ ) @@ -347,7 +330,6 @@ public class ProgramBlock implements ParseInfo } private static void checkSparsity( Instruction lastInst, LocalVariableMap vars ) - throws DMLRuntimeException { for( String varname : vars.keySet() ) { http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/WhileProgramBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/WhileProgramBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/WhileProgramBlock.java index aac1f52..d3b6e59 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/WhileProgramBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/WhileProgramBlock.java @@ -72,7 +72,6 @@ public class WhileProgramBlock extends ProgramBlock } private BooleanObject executePredicate(ExecutionContext ec) - throws DMLRuntimeException { BooleanObject result = null; try @@ -99,7 +98,7 @@ public class WhileProgramBlock extends ProgramBlock } @Override - public void execute(ExecutionContext ec) throws DMLRuntimeException + public void execute(ExecutionContext ec) { //execute while loop try http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheBlock.java b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheBlock.java index 14e1e02..0badf58 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheBlock.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheBlock.java @@ -20,7 +20,6 @@ package org.apache.sysml.runtime.controlprogram.caching; import org.apache.hadoop.io.Writable; -import org.apache.sysml.runtime.DMLRuntimeException; /** @@ -93,10 +92,8 @@ public interface CacheBlock extends Writable * @param cu column upper * @param block cache block * @return sub-block of cache block - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public CacheBlock slice(int rl, int ru, int cl, int cu, CacheBlock block) - throws DMLRuntimeException; + public CacheBlock slice(int rl, int ru, int cl, int cu, CacheBlock block); /** * Merge the given block into the current block. Both blocks needs to be of equal @@ -104,8 +101,6 @@ public interface CacheBlock extends Writable * * @param that cache block * @param appendOnly ? - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public void merge(CacheBlock that, boolean appendOnly) - throws DMLRuntimeException; + public void merge(CacheBlock that, boolean appendOnly); } http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheableData.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheableData.java b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheableData.java index b3791e1..3c001bc 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheableData.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheableData.java @@ -307,8 +307,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data return _metaData.getMatrixCharacteristics(); } - public abstract void refreshMetaData() - throws DMLRuntimeException; + public abstract void refreshMetaData(); public RDDObject getRDDHandle() { return _rddHandle; @@ -345,7 +344,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data return _gpuObjects.get(gCtx); } - public synchronized void setGPUObject(GPUContext gCtx, GPUObject gObj) throws DMLRuntimeException { + public synchronized void setGPUObject(GPUContext gCtx, GPUObject gObj) { GPUObject old = _gpuObjects.put(gCtx, gObj); if (old != null) throw new DMLRuntimeException("GPU : Inconsistent internal state - this CacheableData already has a GPUObject assigned to the current GPUContext (" + gCtx + ")"); @@ -369,7 +368,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * Out-Status: READ(+1). * * @return cacheable data - * @throws DMLRuntimeException if CacheException occurs */ public synchronized T acquireRead() { @@ -465,7 +463,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * Out-Status: MODIFY. * * @return cacheable data - * @throws DMLRuntimeException if CacheException occurs */ public synchronized T acquireModify() { @@ -525,7 +522,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * @param newData new data * @param opcode extended instruction opcode * @return cacheable data - * @throws DMLRuntimeException if error occurs */ public synchronized T acquireModify(T newData, String opcode) { @@ -568,7 +564,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data return _data; } - public void release() throws DMLRuntimeException { + public void release() { release(null); } @@ -582,7 +578,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * In-Status: READ, MODIFY; * Out-Status: READ(-1), EVICTABLE, EMPTY. * - * @throws DMLRuntimeException if CacheException occurs */ public synchronized void release(String opcode) { @@ -654,7 +649,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * In-Status: EMPTY, EVICTABLE, EVICTED; * Out-Status: EMPTY. * - * @throws DMLRuntimeException if error occurs */ public synchronized void clearData() { @@ -703,7 +697,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * Out-Status: EMPTY, EVICTABLE, EVICTED, READ. * * @param replication ? - * @throws DMLRuntimeException if CacheException occurs */ public synchronized void exportData( int replication ) { exportData(_hdfsFileName, null, replication, null); @@ -738,7 +731,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * @param replication ? * @param formatProperties file format properties * @param opcode instruction opcode if available - * @throws DMLRuntimeException if CacheException occurs */ public synchronized void exportData (String fName, String outputFormat, int replication, FileFormatProperties formatProperties, String opcode) { if( LOG.isTraceEnabled() ) @@ -881,7 +873,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data * Low-level cache I/O method that physically restores the data blob to * main memory. Must be defined by a subclass, never called by users. * - * @throws DMLRuntimeException if CacheException occurs */ protected void restoreBlobIntoMemory() { String cacheFilePathAndName = getCacheFilePathAndName(); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/caching/FrameObject.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/FrameObject.java b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/FrameObject.java index a37ac69..2e8801b 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/FrameObject.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/FrameObject.java @@ -132,9 +132,7 @@ public class FrameObject extends CacheableData<FrameBlock> } @Override - public void refreshMetaData() - throws DMLRuntimeException - { + public void refreshMetaData() { if ( _data == null || _metaData ==null ) //refresh only for existing data throw new DMLRuntimeException("Cannot refresh meta data because there is no data or meta data. "); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/caching/MatrixObject.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/MatrixObject.java b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/MatrixObject.java index 6aefbb3..f258ea8 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/MatrixObject.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/MatrixObject.java @@ -229,11 +229,8 @@ public class MatrixObject extends CacheableData<MatrixBlock> * * @param pred index range * @return matrix block - * @throws DMLRuntimeException if CacheException occurs */ - public synchronized MatrixBlock readMatrixPartition( IndexRange pred ) - throws DMLRuntimeException - { + public synchronized MatrixBlock readMatrixPartition( IndexRange pred ) { if( LOG.isTraceEnabled() ) LOG.trace("Acquire partition "+hashCode()+" "+pred); long t0 = DMLScript.STATISTICS ? System.nanoTime() : 0; @@ -347,7 +344,6 @@ public class MatrixObject extends CacheableData<MatrixBlock> } public String getPartitionFileName( IndexRange pred, int brlen, int bclen ) - throws DMLRuntimeException { if ( !_partitioned ) throw new DMLRuntimeException("MatrixObject not available to indexed read."); http://git-wip-us.apache.org/repos/asf/systemml/blob/583f3448/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java b/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java index 5416d5d..d8dc559 100644 --- a/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java +++ b/src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java @@ -150,7 +150,7 @@ public class ExecutionContext { return _variables.get(name); } - public Data getVariable(CPOperand operand) throws DMLRuntimeException { + public Data getVariable(CPOperand operand) { return operand.getDataType().isScalar() ? getScalarInput(operand) : getVariable(operand.getName()); } @@ -167,15 +167,11 @@ public class ExecutionContext { return _variables.remove(name); } - public void setMetaData(String fname, MetaData md) - throws DMLRuntimeException - { + public void setMetaData(String fname, MetaData md) { _variables.get(fname).setMetaData(md); } - public MetaData getMetaData(String varname) - throws DMLRuntimeException - { + public MetaData getMetaData(String varname) { return _variables.get(varname).getMetaData(); } @@ -184,9 +180,7 @@ public class ExecutionContext { return (dat!= null && dat instanceof MatrixObject); } - public MatrixObject getMatrixObject(String varname) - throws DMLRuntimeException - { + public MatrixObject getMatrixObject(String varname) { Data dat = getVariable(varname); //error handling if non existing or no matrix @@ -198,44 +192,32 @@ public class ExecutionContext { return (MatrixObject) dat; } - public FrameObject getFrameObject(String varname) - throws DMLRuntimeException - { + public FrameObject getFrameObject(String varname) { Data dat = getVariable(varname); - //error handling if non existing or no matrix if( dat == null ) throw new DMLRuntimeException("Variable '"+varname+"' does not exist in the symbol table."); if( !(dat instanceof FrameObject) ) throw new DMLRuntimeException("Variable '"+varname+"' is not a frame."); - return (FrameObject) dat; } - public CacheableData<?> getCacheableData(String varname) - throws DMLRuntimeException - { + public CacheableData<?> getCacheableData(String varname) { Data dat = getVariable(varname); - //error handling if non existing or no matrix if( dat == null ) throw new DMLRuntimeException("Variable '"+varname+"' does not exist in the symbol table."); if( !(dat instanceof CacheableData<?>) ) throw new DMLRuntimeException("Variable '"+varname+"' is not a matrix or frame."); - return (CacheableData<?>) dat; } - public void releaseCacheableData(String varname) - throws DMLRuntimeException - { + public void releaseCacheableData(String varname) { CacheableData<?> dat = getCacheableData(varname); dat.release(); } - public MatrixCharacteristics getMatrixCharacteristics( String varname ) - throws DMLRuntimeException - { + public MatrixCharacteristics getMatrixCharacteristics( String varname ) { return getMetaData(varname).getMatrixCharacteristics(); } @@ -245,9 +227,8 @@ public class ExecutionContext { * @param varName variable name * @param opcode extended opcode * @return matrix block - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public MatrixBlock getMatrixInput(String varName, String opcode) throws DMLRuntimeException { + public MatrixBlock getMatrixInput(String varName, String opcode) { long t1 = opcode != null && DMLScript.STATISTICS && DMLScript.FINEGRAINED_STATISTICS ? System.nanoTime() : 0; MatrixBlock mb = getMatrixInput(varName); if(opcode != null && DMLScript.STATISTICS && DMLScript.FINEGRAINED_STATISTICS) { @@ -265,16 +246,13 @@ public class ExecutionContext { * * @param varName variable name * @return matrix block - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public MatrixBlock getMatrixInput(String varName) - throws DMLRuntimeException - { + public MatrixBlock getMatrixInput(String varName) { MatrixObject mo = getMatrixObject(varName); return mo.acquireRead(); } - public void setMetaData(String varName, long nrows, long ncols) throws DMLRuntimeException { + public void setMetaData(String varName, long nrows, long ncols) { MatrixObject mo = getMatrixObject(varName); if(mo.getNumRows() == nrows && mo.getNumColumns() == ncols) return; @@ -295,9 +273,8 @@ public class ExecutionContext { * @param d1 dimension1 * @param d2 dimension1 * @return valid d1 or d2 - * @throws DMLRuntimeException if error occurs */ - private static long validateDimensions(long d1, long d2) throws DMLRuntimeException { + private static long validateDimensions(long d1, long d2) { if(d1 >= 0 && d2 >= 0 && d1 != d2) { throw new DMLRuntimeException("Incorrect dimensions:" + d1 + " != " + d2); } @@ -310,11 +287,8 @@ public class ExecutionContext { * @param numRows number of rows of matrix object * @param numCols number of columns of matrix object * @return a pair containing the wrapping {@link MatrixObject} and a boolean indicating whether a cuda memory allocation took place (as opposed to the space already being allocated) - * @throws DMLRuntimeException */ - public Pair<MatrixObject, Boolean> getDenseMatrixOutputForGPUInstruction(String varName, long numRows, long numCols) - throws DMLRuntimeException - { + public Pair<MatrixObject, Boolean> getDenseMatrixOutputForGPUInstruction(String varName, long numRows, long numCols) { MatrixObject mo = allocateGPUMatrixObject(varName, numRows, numCols); boolean allocated = mo.getGPUObject(getGPUContext(0)).acquireDeviceModifyDense(); mo.getMatrixCharacteristics().setNonZeros(-1); @@ -330,26 +304,22 @@ public class ExecutionContext { * @param numCols number of columns of matrix object * @param nnz number of non zeroes * @return matrix object - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public Pair<MatrixObject, Boolean> getSparseMatrixOutputForGPUInstruction(String varName, long numRows, long numCols, long nnz) - throws DMLRuntimeException - { + public Pair<MatrixObject, Boolean> getSparseMatrixOutputForGPUInstruction(String varName, long numRows, long numCols, long nnz) { MatrixObject mo = allocateGPUMatrixObject(varName, numRows, numCols); mo.getMatrixCharacteristics().setNonZeros(nnz); boolean allocated = mo.getGPUObject(getGPUContext(0)).acquireDeviceModifySparse(); return new Pair<>(mo, allocated); } - /** + /** * Allocates the {@link GPUObject} for a given LOPS Variable (eg. _mVar3) * @param varName variable name * @param numRows number of rows of matrix object * @param numCols number of columns of matrix object * @return matrix object - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public MatrixObject allocateGPUMatrixObject(String varName, long numRows, long numCols) throws DMLRuntimeException { + public MatrixObject allocateGPUMatrixObject(String varName, long numRows, long numCols) { MatrixObject mo = getMatrixObject(varName); long dim1 = -1; long dim2 = -1; DMLRuntimeException e = null; @@ -381,9 +351,7 @@ public class ExecutionContext { return mo; } - public MatrixObject getMatrixInputForGPUInstruction(String varName, String opcode) - throws DMLRuntimeException - { + public MatrixObject getMatrixInputForGPUInstruction(String varName, String opcode) { GPUContext gCtx = getGPUContext(0); MatrixObject mo = getMatrixObject(varName); if(mo == null) { @@ -403,9 +371,8 @@ public class ExecutionContext { * Unpins a currently pinned matrix variable and update fine-grained statistics. * * @param varName variable name - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public void releaseMatrixInput(String varName, String opcode) throws DMLRuntimeException { + public void releaseMatrixInput(String varName, String opcode) { long t1 = opcode != null && DMLScript.STATISTICS && DMLScript.FINEGRAINED_STATISTICS ? System.nanoTime() : 0; MatrixObject mo = getMatrixObject(varName); mo.release(opcode); @@ -415,14 +382,12 @@ public class ExecutionContext { } } - public void releaseMatrixInput(String varName) throws DMLRuntimeException { + public void releaseMatrixInput(String varName) { MatrixObject mo = getMatrixObject(varName); mo.release(null); } - public void releaseMatrixInputForGPUInstruction(String varName) - throws DMLRuntimeException - { + public void releaseMatrixInputForGPUInstruction(String varName) { MatrixObject mo = getMatrixObject(varName); mo.getGPUObject(getGPUContext(0)).releaseInput(); } @@ -432,11 +397,8 @@ public class ExecutionContext { * * @param varName variable name * @return frame block - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public FrameBlock getFrameInput(String varName) - throws DMLRuntimeException - { + public FrameBlock getFrameInput(String varName) { FrameObject fo = getFrameObject(varName); return fo.acquireRead(); } @@ -445,22 +407,17 @@ public class ExecutionContext { * Unpins a currently pinned frame variable. * * @param varName variable name - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public void releaseFrameInput(String varName) - throws DMLRuntimeException - { + public void releaseFrameInput(String varName) { FrameObject fo = getFrameObject(varName); fo.release(); } - public ScalarObject getScalarInput(CPOperand input) throws DMLRuntimeException { + public ScalarObject getScalarInput(CPOperand input) { return getScalarInput(input.getName(), input.getValueType(), input.isLiteral()); } - public ScalarObject getScalarInput(String name, ValueType vt, boolean isLiteral) - throws DMLRuntimeException - { + public ScalarObject getScalarInput(String name, ValueType vt, boolean isLiteral) { if ( isLiteral ) { return ScalarObjectFactory.createScalarObject(vt, name); } @@ -472,13 +429,11 @@ public class ExecutionContext { } } - public void setScalarOutput(String varName, ScalarObject so) - throws DMLRuntimeException - { + public void setScalarOutput(String varName, ScalarObject so) { setVariable(varName, so); } - public void releaseMatrixOutputForGPUInstruction(String varName) throws DMLRuntimeException { + public void releaseMatrixOutputForGPUInstruction(String varName) { MatrixObject mo = getMatrixObject(varName); if(mo.getGPUObject(getGPUContext(0)) == null || !mo.getGPUObject(getGPUContext(0)).isAllocated()) { throw new DMLRuntimeException("No output is allocated on GPU"); @@ -486,20 +441,18 @@ public class ExecutionContext { mo.getGPUObject(getGPUContext(0)).releaseOutput(); } - public void setMatrixOutput(String varName, MatrixBlock outputData) throws DMLRuntimeException { + public void setMatrixOutput(String varName, MatrixBlock outputData) { setMatrixOutput(varName, outputData, null); } - public void setMatrixOutput(String varName, MatrixBlock outputData, String opcode) throws DMLRuntimeException { + public void setMatrixOutput(String varName, MatrixBlock outputData, String opcode) { MatrixObject mo = getMatrixObject(varName); mo.acquireModify(outputData, opcode); mo.release(opcode); setVariable(varName, mo); } - public void setMatrixOutput(String varName, MatrixBlock outputData, UpdateType flag, String opcode) - throws DMLRuntimeException - { + public void setMatrixOutput(String varName, MatrixBlock outputData, UpdateType flag, String opcode) { if( flag.isInPlace() ) { //modify metadata to carry update status MatrixObject mo = getMatrixObject(varName); @@ -510,9 +463,7 @@ public class ExecutionContext { setMatrixOutput(varName, outputData, opcode); } - public void setFrameOutput(String varName, FrameBlock outputData) - throws DMLRuntimeException - { + public void setFrameOutput(String varName, FrameBlock outputData) { FrameObject fo = getFrameObject(varName); fo.acquireModify(outputData); fo.release(); @@ -604,9 +555,7 @@ public class ExecutionContext { return ret; } - public void cleanupCacheableData(CacheableData<?> mo) - throws DMLRuntimeException - { + public void cleanupCacheableData(CacheableData<?> mo) { //early abort w/o scan of symbol table if no cleanup required boolean fileExists = (mo.isHDFSFileExists() && mo.getFileName() != null); if( !CacheableData.isCachingActive() && !fileExists ) @@ -640,51 +589,45 @@ public class ExecutionContext { } } - public void updateDebugState( int index ) throws DMLRuntimeException - { + public void updateDebugState( int index ) { if(DMLScript.ENABLE_DEBUG_MODE) { _dbState.getPC().setProgramBlockNumber(index); } } - public void updateDebugState( Instruction currInst ) throws DMLRuntimeException - { + public void updateDebugState( Instruction currInst ) { if (DMLScript.ENABLE_DEBUG_MODE) { // New change so that shell doesnot seem like it is hanging while running MR job // Since UI cannot accept instructions when user is submitting the program _dbState.nextCommand = false; // Change to stop before first instruction of a given line //update current instruction ID and line number - _dbState.getPC().setInstID(currInst.getInstID()); + _dbState.getPC().setInstID(currInst.getInstID()); _dbState.getPC().setLineNumber(currInst.getLineNum()); // Change to stop before first instruction of a given line - suspendIfAskedInDebugMode(currInst); + suspendIfAskedInDebugMode(currInst); } } - public void clearDebugProgramCounters() - { + public void clearDebugProgramCounters() { if(DMLScript.ENABLE_DEBUG_MODE) { _dbState.pc = null; } } - public void handleDebugException( Exception ex ) - { + public void handleDebugException( Exception ex ) { _dbState.getDMLStackTrace(ex); _dbState.suspend = true; } - public void handleDebugFunctionEntry( FunctionCallCPInstruction funCallInst ) throws DMLRuntimeException - { + public void handleDebugFunctionEntry( FunctionCallCPInstruction funCallInst ) { //push caller frame into call stack _dbState.pushFrame(getVariables(), _dbState.getPC()); //initialize pc for callee's frame _dbState.pc = new DMLProgramCounter(funCallInst.getNamespace(), funCallInst.getFunctionName(), 0, 0); } - public void handleDebugFunctionExit( FunctionCallCPInstruction funCallInst ) - { + public void handleDebugFunctionExit( FunctionCallCPInstruction funCallInst ) { //pop caller frame from call stack DMLFrame fr = _dbState.popFrame(); //update pc to caller's frame @@ -702,10 +645,9 @@ public class ExecutionContext { * then it will wait until user issues a new debugger command. * * @param currInst current instruction - * @throws DMLRuntimeException if DMLRuntimeException occurs */ @SuppressWarnings("deprecation") - private void suspendIfAskedInDebugMode(Instruction currInst ) throws DMLRuntimeException { + private void suspendIfAskedInDebugMode(Instruction currInst ) { if (!DMLScript.ENABLE_DEBUG_MODE) { System.err.println("ERROR: The function suspendIfAskedInDebugMode should not be called in non-debug mode."); }
