You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2018/03/24 05:18:34 UTC
[01/10] systemml git commit: [SYSTEMML-2202] Remove global data flow
optimizer prototype (level 4)
Repository: systemml
Updated Branches:
refs/heads/master 140f1e1b7 -> 215a1cc6b
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicBlocksizeOrFirst.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicBlocksizeOrFirst.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicBlocksizeOrFirst.java
deleted file mode 100644
index df40724..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicBlocksizeOrFirst.java
+++ /dev/null
@@ -1,49 +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.hops.globalopt.gdfresolve;
-
-import org.apache.sysml.hops.globalopt.RewriteConfig;
-
-public class GDFMismatchHeuristicBlocksizeOrFirst extends GDFMismatchHeuristic
-{
-
- @Override
- public String getName(){
- return "BLOCKSIZE_OR_FIRST";
- }
-
- @Override
- public boolean resolveMismatch( RewriteConfig currRc, RewriteConfig newRc )
- {
- //check for blocksize mismatch
- if( currRc.getBlockSize() != newRc.getBlockSize() )
- {
- //choose the new rewrite config if its blocksize is larger than
- //the current (intuition: we generally prefer larger blocksizes
- //because this often enables better physical operators with constraints
- //like ncol(X) <= blocksize)
- return (currRc.getBlockSize() < newRc.getBlockSize());
- }
-
- //return the current rewrite configuration (first come first served)
- //if the previous check for blocksize mismatch failed
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicFirst.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicFirst.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicFirst.java
deleted file mode 100644
index a96bc33..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristicFirst.java
+++ /dev/null
@@ -1,38 +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.hops.globalopt.gdfresolve;
-
-import org.apache.sysml.hops.globalopt.RewriteConfig;
-
-public class GDFMismatchHeuristicFirst extends GDFMismatchHeuristic
-{
-
- @Override
- public String getName(){
- return "FIRST";
- }
-
- @Override
- public boolean resolveMismatch( RewriteConfig currRc, RewriteConfig newRc )
- {
- //always return the current rewrite configuration (first come first served)
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/MismatchHeuristicFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/MismatchHeuristicFactory.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/MismatchHeuristicFactory.java
deleted file mode 100644
index 9846850..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/MismatchHeuristicFactory.java
+++ /dev/null
@@ -1,41 +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.hops.globalopt.gdfresolve;
-
-import org.apache.sysml.hops.globalopt.gdfresolve.GDFMismatchHeuristic.MismatchHeuristicType;
-import org.apache.sysml.runtime.DMLRuntimeException;
-
-public abstract class MismatchHeuristicFactory
-{
-
- public static GDFMismatchHeuristic createMismatchHeuristic( MismatchHeuristicType type )
- throws DMLRuntimeException
- {
- switch( type ) {
- case FIRST:
- return new GDFMismatchHeuristicFirst();
- case BLOCKSIZE_OR_FIRST:
- return new GDFMismatchHeuristicBlocksizeOrFirst();
-
- default:
- throw new DMLRuntimeException("Unsupported mismatch heuristic: "+type);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/utils/Explain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/utils/Explain.java b/src/main/java/org/apache/sysml/utils/Explain.java
index b72fe99..e0a9c92 100644
--- a/src/main/java/org/apache/sysml/utils/Explain.java
+++ b/src/main/java/org/apache/sysml/utils/Explain.java
@@ -39,9 +39,6 @@ import org.apache.sysml.hops.UnaryOp;
import org.apache.sysml.hops.codegen.cplan.CNode;
import org.apache.sysml.hops.codegen.cplan.CNodeMultiAgg;
import org.apache.sysml.hops.codegen.cplan.CNodeTpl;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFLoopNode;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode.NodeType;
import org.apache.sysml.hops.ipa.FunctionCallGraph;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.parser.DMLProgram;
@@ -474,22 +471,6 @@ public class Explain
return explainCNode(node, level);
}
- public static String explainGDFNodes( ArrayList<GDFNode> gdfnodes )
- throws DMLRuntimeException
- {
- return explainGDFNodes(gdfnodes, 0);
- }
-
- public static String explainGDFNodes( ArrayList<GDFNode> gdfnodes, int level )
- throws DMLRuntimeException
- {
- StringBuilder sb = new StringBuilder();
- HashSet<Long> memo = new HashSet<>();
- for( GDFNode gnode : gdfnodes )
- sb.append(explainGDFNode(gnode, level, memo));
- return sb.toString();
- }
-
/**
* Counts the number of compiled MRJob/Spark instructions in the
* given runtime program.
@@ -980,104 +961,7 @@ public class Explain
return sb.toString();
}
-
- //////////////
- // internal explain GDFNODE
- /**
- * Do a post-order traverse through the GDFNode DAG and explain each GDFNode.
- * Note: nodes referring to literalops are suppressed.
- *
- * @param gnode GDF node
- * @param level offset
- * @param memo memoization table
- * @return string explanation
- * @throws DMLRuntimeException if DMLRuntimeException occurs
- */
- private static String explainGDFNode(GDFNode gnode, int level, HashSet<Long> memo)
- throws DMLRuntimeException
- {
- //basic memoization via memo table since gnode has no visit status
- if( memo.contains(gnode.getID()) ||
- gnode.getNodeType()==NodeType.HOP_NODE && gnode.getHop() instanceof LiteralOp )
- {
- return "";
- }
-
- StringBuilder sb = new StringBuilder();
- String offset = createOffset(level);
-
- for( GDFNode input : gnode.getInputs() )
- sb.append(explainGDFNode(input, level, memo));
-
- //indentation
- sb.append(offset);
-
- //hop id
- String deps = null;
- if( SHOW_DATA_DEPENDENCIES ) {
- sb.append("("+gnode.getID()+") ");
-
- StringBuilder childs = new StringBuilder();
- childs.append(" (");
- boolean childAdded = false;
- for( GDFNode input : gnode.getInputs() ) {
- childs.append(childAdded?",":"");
- childs.append(input.getID());
- childAdded = true;
- }
- childs.append(")");
- if( childAdded )
- deps = childs.toString();
- }
-
- //operation string
- if( gnode instanceof GDFLoopNode ) //LOOP NODES
- {
- GDFLoopNode lgnode = (GDFLoopNode) gnode;
- String offset2 = createOffset(level+1);
- sb.append(lgnode.explain(deps)+"\n"); //loop header
- sb.append(offset2+"PRED:\n");
- sb.append(explainGDFNode(lgnode.getLoopPredicate(),level+2, memo));
- sb.append(offset2+"BODY:\n");
- //note: memo table and already done child explain prevents redundancy
- for( Entry<String,GDFNode> root : lgnode.getLoopOutputs().entrySet() ) {
- sb.append(explainGDFNode(root.getValue(), level+2, memo));
- }
- }
- else //GENERAL CASE (BASIC/CROSSBLOCK NODES)
- {
- sb.append(gnode.explain(deps));
- sb.append('\n');
- }
-
- /*
- //matrix characteristics
- sb.append(" [" + hop.getDim1() + ","
- + hop.getDim2() + ","
- + hop.getRowsInBlock() + ","
- + hop.getColsInBlock() + ","
- + hop.getNnz() + "]");
-
- //memory estimates
- sb.append(" [" + showMem(hop.getInputMemEstimate(), false) + ","
- + showMem(hop.getIntermediateMemEstimate(), false) + ","
- + showMem(hop.getOutputMemEstimate(), false) + " -> "
- + showMem(hop.getMemEstimate(), true) + "]");
-
- //exec type
- if (hop.getExecType() != null)
- sb.append(", " + hop.getExecType());
- */
-
-
- //memoization
- memo.add(gnode.getID());
-
- return sb.toString();
- }
-
-
//////////////
// internal explain RUNTIME
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregCG.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregCG.java b/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregCG.java
deleted file mode 100644
index af5be94..0000000
--- a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregCG.java
+++ /dev/null
@@ -1,171 +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.test.integration.functions.gdfo;
-
-import java.io.File;
-import java.util.HashMap;
-
-import org.junit.Test;
-import org.apache.sysml.api.DMLScript;
-import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
-import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex;
-import org.apache.sysml.test.integration.AutomatedTestBase;
-import org.apache.sysml.test.integration.TestConfiguration;
-import org.apache.sysml.test.utils.TestUtils;
-
-/**
- *
- */
-public class GDFOLinregCG extends AutomatedTestBase
-{
-
- private final static String TEST_NAME1 = "LinregCG";
- private final static String TEST_DIR = "functions/gdfo/";
- private final static String TEST_CLASS_DIR = TEST_DIR + GDFOLinregCG.class.getSimpleName() + "/";
- private final static String TEST_CONF = "SystemML-config-globalopt.xml";
- private final static File TEST_CONF_FILE = new File(SCRIPT_DIR + TEST_DIR, TEST_CONF);
-
- private final static double eps = 1e-5;
-
- private final static int rows = 1468;
- private final static int cols = 1007;
-
- private final static double sparsity1 = 0.7; //dense
- private final static double sparsity2 = 0.1; //sparse
-
- private final static int intercept = 0;
- private final static double epsilon = 0.000000001;
- private final static double maxiter = 10;
-
- @Override
- public void setUp()
- {
- TestUtils.clearAssertionInformation();
- addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "w" }));
- }
-
- @Test
- public void testGDFOLinregCGDenseCP()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.CP);
- }
-
- @Test
- public void testGDFOLinregCGSparseCP()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.CP);
- }
-
- /*
- @Test
- public void testGDFOLinregCGDenseMR()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.MR);
- }
-
- @Test
- public void testGDFOLinregCGSparseMR()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.MR);
- }
-
- @Test
- public void testGDFOLinregCGDenseSP()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.SPARK);
- }
-
- @Test
- public void testGDFOLinregCGSparseSP()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.SPARK);
- }
- */
-
- /**
- *
- * @param sparseM1
- * @param sparseM2
- * @param instType
- */
- private void runGDFOTest( String testname,boolean sparse, ExecType instType)
- {
- //rtplatform for MR
- RUNTIME_PLATFORM platformOld = rtplatform;
- switch( instType ){
- case MR: rtplatform = RUNTIME_PLATFORM.HADOOP; break;
- case SPARK: rtplatform = RUNTIME_PLATFORM.SPARK; break;
- default: rtplatform = RUNTIME_PLATFORM.HYBRID; break;
- }
-
- boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG;
- if( rtplatform == RUNTIME_PLATFORM.SPARK )
- DMLScript.USE_LOCAL_SPARK_CONFIG = true;
-
- try
- {
- String TEST_NAME = testname;
- TestConfiguration config = getTestConfiguration(TEST_NAME);
- loadTestConfiguration(config);
-
- /* This is for running the junit test the new way, i.e., construct the arguments directly */
- String HOME = SCRIPT_DIR + TEST_DIR;
- fullDMLScriptName = HOME + TEST_NAME + ".dml";
- programArgs = new String[]{ "-explain", //"hops",
- "-args", input("X"), input("y"),
- String.valueOf(intercept), String.valueOf(epsilon),
- String.valueOf(maxiter), output("w")};
-
- rCmd = getRCmd(inputDir(), String.valueOf(intercept),String.valueOf(epsilon),
- String.valueOf(maxiter), expectedDir());
-
- //generate actual datasets
- double[][] X = getRandomMatrix(rows, cols, 0, 1, sparse?sparsity2:sparsity1, 7);
- writeInputMatrixWithMTD("X", X, true);
- double[][] y = getRandomMatrix(rows, 1, 0, 10, 1.0, 3);
- writeInputMatrixWithMTD("y", y, true);
-
- runTest(true, false, null, -1);
- runRScript(true);
-
- //compare matrices
- HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("w");
- HashMap<CellIndex, Double> rfile = readRMatrixFromFS("w");
- TestUtils.compareMatrices(dmlfile, rfile, eps, "Stat-DML", "Stat-R");
- }
- finally
- {
- rtplatform = platformOld;
- DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
- }
- }
-
- /**
- * Override default configuration with custom test configuration to ensure
- * scratch space and local temporary directory locations are also updated.
- */
- @Override
- protected File getConfigTemplateFile() {
- // Instrumentation in this test's output log to show custom configuration file used for template.
- System.out.println("This test case overrides default configuration with " + TEST_CONF_FILE.getPath());
- return TEST_CONF_FILE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDS.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDS.java b/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDS.java
deleted file mode 100644
index 61abfea..0000000
--- a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDS.java
+++ /dev/null
@@ -1,166 +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.test.integration.functions.gdfo;
-
-import java.io.File;
-import java.util.HashMap;
-
-import org.junit.Test;
-import org.apache.sysml.api.DMLScript;
-import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
-import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex;
-import org.apache.sysml.test.integration.AutomatedTestBase;
-import org.apache.sysml.test.integration.TestConfiguration;
-import org.apache.sysml.test.utils.TestUtils;
-
-/**
- *
- */
-public class GDFOLinregDS extends AutomatedTestBase
-{
-
- private final static String TEST_NAME1 = "LinregDS";
- private final static String TEST_DIR = "functions/gdfo/";
- private final static String TEST_CLASS_DIR = TEST_DIR + GDFOLinregDS.class.getSimpleName() + "/";
- private final static String TEST_CONF = "SystemML-config-globalopt.xml";
- private final static File TEST_CONF_FILE = new File(SCRIPT_DIR + TEST_DIR, TEST_CONF);
-
- private final static double eps = 1e-8;
-
- private final static int rows = 1468;
- private final static int cols = 1007;
-
- private final static double sparsity1 = 0.7; //dense
- private final static double sparsity2 = 0.1; //sparse
-
- private final static int intercept = 0;
- private final static double lambda = 0.01;
-
- @Override
- public void setUp()
- {
- TestUtils.clearAssertionInformation();
- addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "B" }));
- }
-
- @Test
- public void testGDFOLinregDSDenseCP()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.CP);
- }
-
- @Test
- public void testGDFOLinregDSSparseCP()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.CP);
- }
-
- @Test
- public void testGDFOLinregDSDenseMR()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.MR);
- }
-
- @Test
- public void testGDFOLinregDSSparseMR()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.MR);
- }
-
- @Test
- public void testGDFOLinregDSDenseSP()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.SPARK);
- }
-
- @Test
- public void testGDFOLinregDSSparseSP()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.SPARK);
- }
-
- /**
- *
- * @param sparseM1
- * @param sparseM2
- * @param instType
- */
- private void runGDFOTest( String testname,boolean sparse, ExecType instType)
- {
- //rtplatform for MR
- RUNTIME_PLATFORM platformOld = rtplatform;
- switch( instType ){
- case MR: rtplatform = RUNTIME_PLATFORM.HADOOP; break;
- case SPARK: rtplatform = RUNTIME_PLATFORM.SPARK; break;
- default: rtplatform = RUNTIME_PLATFORM.HYBRID; break;
- }
-
- boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG;
- if( rtplatform == RUNTIME_PLATFORM.SPARK )
- DMLScript.USE_LOCAL_SPARK_CONFIG = true;
-
- try
- {
- String TEST_NAME = testname;
- TestConfiguration config = getTestConfiguration(TEST_NAME);
- loadTestConfiguration(config);
-
- /* This is for running the junit test the new way, i.e., construct the arguments directly */
- String HOME = SCRIPT_DIR + TEST_DIR;
- fullDMLScriptName = HOME + TEST_NAME + ".dml";
- programArgs = new String[]{ "-explain","hops",
- "-args", input("X"), input("y"),
- String.valueOf(intercept), String.valueOf(lambda), output("B")};
-
- rCmd = getRCmd(inputDir(), String.valueOf(intercept), String.valueOf(lambda), expectedDir());
-
- //generate actual datasets
- double[][] X = getRandomMatrix(rows, cols, 0, 1, sparse?sparsity2:sparsity1, 7);
- writeInputMatrixWithMTD("X", X, true);
- double[][] y = getRandomMatrix(rows, 1, 0, 10, 1.0, 3);
- writeInputMatrixWithMTD("y", y, true);
-
- runTest(true, false, null, -1);
- runRScript(true);
-
- //compare matrices
- HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("B");
- HashMap<CellIndex, Double> rfile = readRMatrixFromFS("B");
- TestUtils.compareMatrices(dmlfile, rfile, eps, "Stat-DML", "Stat-R");
- }
- finally
- {
- rtplatform = platformOld;
- DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
- }
- }
-
- /**
- * Override default configuration with custom test configuration to ensure
- * scratch space and local temporary directory locations are also updated.
- */
- @Override
- protected File getConfigTemplateFile() {
- // Instrumentation in this test's output log to show custom configuration file used for template.
- System.out.println("This test case overrides default configuration with " + TEST_CONF_FILE.getPath());
- return TEST_CONF_FILE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDSsimpl.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDSsimpl.java b/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDSsimpl.java
deleted file mode 100644
index f095844..0000000
--- a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOLinregDSsimpl.java
+++ /dev/null
@@ -1,166 +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.test.integration.functions.gdfo;
-
-import java.io.File;
-import java.util.HashMap;
-
-import org.junit.Test;
-import org.apache.sysml.api.DMLScript;
-import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
-import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex;
-import org.apache.sysml.test.integration.AutomatedTestBase;
-import org.apache.sysml.test.integration.TestConfiguration;
-import org.apache.sysml.test.utils.TestUtils;
-
-/**
- *
- */
-public class GDFOLinregDSsimpl extends AutomatedTestBase
-{
-
- private final static String TEST_NAME1 = "LinregDSsimpl";
- private final static String TEST_DIR = "functions/gdfo/";
- private final static String TEST_CLASS_DIR = TEST_DIR + GDFOLinregDSsimpl.class.getSimpleName() + "/";
- private final static String TEST_CONF = "SystemML-config-globalopt.xml";
- private final static File TEST_CONF_FILE = new File(SCRIPT_DIR + TEST_DIR, TEST_CONF);
-
- private final static double eps = 1e-8;
-
- private final static int rows = 1468;
- private final static int cols = 1007;
-
- private final static double sparsity1 = 0.7; //dense
- private final static double sparsity2 = 0.1; //sparse
-
- private final static int intercept = 0;
- private final static double lambda = 0.01;
-
- @Override
- public void setUp()
- {
- TestUtils.clearAssertionInformation();
- addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "B" }));
- }
-
- @Test
- public void testGDFOLinregDSDenseCP()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.CP);
- }
-
- @Test
- public void testGDFOLinregDSSparseCP()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.CP);
- }
-
- @Test
- public void testGDFOLinregDSDenseMR()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.MR);
- }
-
- @Test
- public void testGDFOLinregDSSparseMR()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.MR);
- }
-
- @Test
- public void testGDFOLinregDSDenseSP()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.SPARK);
- }
-
- @Test
- public void testGDFOLinregDSSparseSP()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.SPARK);
- }
-
- /**
- *
- * @param sparseM1
- * @param sparseM2
- * @param instType
- */
- private void runGDFOTest( String testname,boolean sparse, ExecType instType)
- {
- //rtplatform for MR
- RUNTIME_PLATFORM platformOld = rtplatform;
- switch( instType ){
- case MR: rtplatform = RUNTIME_PLATFORM.HADOOP; break;
- case SPARK: rtplatform = RUNTIME_PLATFORM.SPARK; break;
- default: rtplatform = RUNTIME_PLATFORM.HYBRID; break;
- }
-
- boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG;
- if( rtplatform == RUNTIME_PLATFORM.SPARK )
- DMLScript.USE_LOCAL_SPARK_CONFIG = true;
-
- try
- {
- String TEST_NAME = testname;
- TestConfiguration config = getTestConfiguration(TEST_NAME);
- loadTestConfiguration(config);
-
- /* This is for running the junit test the new way, i.e., construct the arguments directly */
- String HOME = SCRIPT_DIR + TEST_DIR;
- fullDMLScriptName = HOME + TEST_NAME + ".dml";
- programArgs = new String[]{ "-explain","hops",
- "-args", input("X"), input("y"),
- String.valueOf(intercept), String.valueOf(lambda), output("B")};
-
- rCmd = getRCmd(inputDir(), String.valueOf(intercept), String.valueOf(lambda), expectedDir());
-
- //generate actual datasets
- double[][] X = getRandomMatrix(rows, cols, 0, 1, sparse?sparsity2:sparsity1, 7);
- writeInputMatrixWithMTD("X", X, true);
- double[][] y = getRandomMatrix(rows, 1, 0, 10, 1.0, 3);
- writeInputMatrixWithMTD("y", y, true);
-
- runTest(true, false, null, -1);
- runRScript(true);
-
- //compare matrices
- HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("B");
- HashMap<CellIndex, Double> rfile = readRMatrixFromFS("B");
- TestUtils.compareMatrices(dmlfile, rfile, eps, "Stat-DML", "Stat-R");
- }
- finally
- {
- rtplatform = platformOld;
- DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld;
- }
- }
-
- /**
- * Override default configuration with custom test configuration to ensure
- * scratch space and local temporary directory locations are also updated.
- */
- @Override
- protected File getConfigTemplateFile() {
- // Instrumentation in this test's output log to show custom configuration file used for template.
- System.out.println("This test case overrides default configuration with " + TEST_CONF_FILE.getPath());
- return TEST_CONF_FILE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOMMChainLoop.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOMMChainLoop.java b/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOMMChainLoop.java
deleted file mode 100644
index 7f29b9a..0000000
--- a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/GDFOMMChainLoop.java
+++ /dev/null
@@ -1,132 +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.test.integration.functions.gdfo;
-
-import java.io.File;
-import java.util.HashMap;
-
-import org.junit.Test;
-import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
-import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex;
-import org.apache.sysml.test.integration.AutomatedTestBase;
-import org.apache.sysml.test.integration.TestConfiguration;
-import org.apache.sysml.test.utils.TestUtils;
-
-/**
- *
- */
-public class GDFOMMChainLoop extends AutomatedTestBase
-{
-
- private final static String TEST_NAME1 = "MMChainLoop";
- private final static String TEST_DIR = "functions/gdfo/";
- private final static String TEST_CLASS_DIR = TEST_DIR + GDFOMMChainLoop.class.getSimpleName() + "/";
- private final static String TEST_CONF = "SystemML-config-globalopt.xml";
- private final static File TEST_CONF_FILE = new File(SCRIPT_DIR + TEST_DIR, TEST_CONF);
-
- private final static double eps = 1e-10;
-
- private final static int rows = 1468;
- private final static int cols = 1007;
-
- private final static double sparsity1 = 0.7; //dense
- private final static double sparsity2 = 0.1; //sparse
-
- private final static double maxiter = 10;
-
- @Override
- public void setUp()
- {
- TestUtils.clearAssertionInformation();
- addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "w" }));
- }
-
- @Test
- public void testMMChainLoopDenseCP()
- {
- runGDFOTest(TEST_NAME1, false, ExecType.CP);
- }
-
- @Test
- public void testMMChainLoopSparseCP()
- {
- runGDFOTest(TEST_NAME1, true, ExecType.CP);
- }
-
- /**
- *
- * @param sparseM1
- * @param sparseM2
- * @param instType
- */
- private void runGDFOTest( String testname,boolean sparse, ExecType instType)
- {
- //rtplatform for MR
- RUNTIME_PLATFORM platformOld = rtplatform;
- rtplatform = (instType==ExecType.MR) ? RUNTIME_PLATFORM.HADOOP : RUNTIME_PLATFORM.HYBRID;
-
- try
- {
- String TEST_NAME = testname;
- TestConfiguration config = getTestConfiguration(TEST_NAME);
- loadTestConfiguration(config);
-
- /* This is for running the junit test the new way, i.e., construct the arguments directly */
- String HOME = SCRIPT_DIR + TEST_DIR;
- fullDMLScriptName = HOME + TEST_NAME + ".dml";
- programArgs = new String[]{ "-explain", //"hops",
- "-args", input("X"), input("v"),
- String.valueOf(maxiter), output("w")};
-
- rCmd = getRCmd(inputDir(), String.valueOf(maxiter), expectedDir());
-
- //generate actual datasets
- double[][] X = getRandomMatrix(rows, cols, 0, 1, sparse?sparsity2:sparsity1, 7);
- writeInputMatrixWithMTD("X", X, true);
- double[][] y = getRandomMatrix(cols, 1, 0, 1, 1.0, 3);
- writeInputMatrixWithMTD("v", y, true);
-
- runTest(true, false, null, -1);
- runRScript(true);
-
- //compare matrices
- HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS("w");
- HashMap<CellIndex, Double> rfile = readRMatrixFromFS("w");
- double absEps = rfile.get(new CellIndex(1,1)).doubleValue() * eps;
- TestUtils.compareMatrices(dmlfile, rfile, absEps, "Stat-DML", "Stat-R");
- }
- finally
- {
- rtplatform = platformOld;
- }
- }
-
- /**
- * Override default configuration with custom test configuration to ensure
- * scratch space and local temporary directory locations are also updated.
- */
- @Override
- protected File getConfigTemplateFile() {
- // Instrumentation in this test's output log to show custom configuration file used for template.
- System.out.println("This test case overrides default configuration with " + TEST_CONF_FILE.getPath());
- return TEST_CONF_FILE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/java/org/apache/sysml/test/integration/functions/gdfo/HashInterestingPropertiesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/HashInterestingPropertiesTest.java b/src/test/java/org/apache/sysml/test/integration/functions/gdfo/HashInterestingPropertiesTest.java
deleted file mode 100644
index 50b34dd..0000000
--- a/src/test/java/org/apache/sysml/test/integration/functions/gdfo/HashInterestingPropertiesTest.java
+++ /dev/null
@@ -1,96 +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.test.integration.functions.gdfo;
-
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import org.apache.sysml.hops.globalopt.InterestingProperties;
-import org.apache.sysml.hops.globalopt.InterestingProperties.Format;
-import org.apache.sysml.hops.globalopt.InterestingProperties.Location;
-import org.apache.sysml.hops.globalopt.InterestingProperties.Partitioning;
-import org.apache.sysml.test.integration.AutomatedTestBase;
-import org.apache.sysml.test.utils.TestUtils;
-
-public class HashInterestingPropertiesTest extends AutomatedTestBase
-{
-
- @Override
- public void setUp()
- {
- TestUtils.clearAssertionInformation();
- }
-
- @Test
- public void testCopyEquivalence()
- {
- InterestingProperties ips1 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.MEM, Partitioning.NONE, 1, true);
- InterestingProperties ips2 = new InterestingProperties(ips1);
- InterestingProperties ips3 = new InterestingProperties(ips2);
-
- //test hash functions
- Assert.assertEquals(ips1.hashCode(), ips2.hashCode());
- Assert.assertEquals(ips2.hashCode(), ips3.hashCode());
-
- //test equals (used inside hash maps)
- Assert.assertTrue(ips1.equals(ips2));
- Assert.assertTrue(ips2.equals(ips3));
- }
-
- @Test
- public void testValueEquivalence()
- {
- InterestingProperties ips1 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.MEM, Partitioning.NONE, 1, true);
- InterestingProperties ips2 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.MEM, Partitioning.NONE, 1, true);
- InterestingProperties ips3 = new InterestingProperties(2000, Format.BINARY_BLOCK, Location.MEM, Partitioning.NONE, 1, true);
- InterestingProperties ips4 = new InterestingProperties(1000, Format.TEXT_CELL, Location.MEM, Partitioning.NONE, 1, true);
- InterestingProperties ips5 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.HDFS, Partitioning.NONE, 1, true);
- InterestingProperties ips6 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.MEM, Partitioning.COL_WISE, 1, true);
- InterestingProperties ips7 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.MEM, Partitioning.NONE, 1, false);
-
- //test hash functions
- Assert.assertEquals(ips1.hashCode(), ips2.hashCode());
-
- //test equals (used inside hash maps)
- Assert.assertTrue(ips1.equals(ips2));
- Assert.assertFalse(ips2.equals(ips3));
- Assert.assertFalse(ips2.equals(ips4));
- Assert.assertFalse(ips2.equals(ips5));
- Assert.assertFalse(ips2.equals(ips6));
- Assert.assertFalse(ips2.equals(ips7));
- }
-
- @Test
- public void testValueEquivalenceWithNull()
- {
- InterestingProperties ips1 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.MEM, Partitioning.NONE, 1, true);
- InterestingProperties ips2 = new InterestingProperties(1000, null, Location.MEM, Partitioning.NONE, 1, true);
- InterestingProperties ips3 = new InterestingProperties(1000, Format.BINARY_BLOCK, null, Partitioning.NONE, 1, true);
- InterestingProperties ips4 = new InterestingProperties(1000, Format.BINARY_BLOCK, Location.MEM, null, 1, true);
- InterestingProperties ips5 = new InterestingProperties(1000, Format.ANY, Location.MEM, Partitioning.NONE, 1, true);
-
- //test equals (used inside hash maps)
- Assert.assertFalse(ips1.equals(ips2));
- Assert.assertFalse(ips1.equals(ips3));
- Assert.assertFalse(ips1.equals(ips4));
- Assert.assertFalse(ips1.equals(ips5));
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextTest.java b/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextTest.java
index a6b2ea2..39b9652 100644
--- a/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextTest.java
@@ -407,11 +407,8 @@ public class MLContextTest extends MLContextTestBase {
Script script = new Script("print('" + testString + "');", org.apache.sysml.api.mlcontext.ScriptType.DML);
ScriptExecutor scriptExecutor = new ScriptExecutor() {
- // turn off global data flow optimization check
@Override
- protected void globalDataFlowOptimization() {
- return;
- }
+ protected void showExplanation() {}
};
ml.execute(script, scriptExecutor);
}
@@ -424,11 +421,8 @@ public class MLContextTest extends MLContextTestBase {
Script script = new Script("print('" + testString + "')", org.apache.sysml.api.mlcontext.ScriptType.PYDML);
ScriptExecutor scriptExecutor = new ScriptExecutor() {
- // turn off global data flow optimization check
@Override
- protected void globalDataFlowOptimization() {
- return;
- }
+ protected void showExplanation() {}
};
ml.execute(script, scriptExecutor);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/LinregCG.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/LinregCG.R b/src/test/scripts/functions/gdfo/LinregCG.R
deleted file mode 100644
index 5dcad95..0000000
--- a/src/test/scripts/functions/gdfo/LinregCG.R
+++ /dev/null
@@ -1,57 +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.
-#
-#-------------------------------------------------------------
-
-
-args <- commandArgs(TRUE)
-options(digits=22)
-library("Matrix")
-
-X = readMM(paste(args[1], "X.mtx", sep=""))
-y = readMM(paste(args[1], "y.mtx", sep=""))
-
-intercept = as.integer(args[2]);
-eps = as.double(args[3]);
-maxiter = as.double(args[4]);
-
-if( intercept == 1 ){
- ones = matrix(1, nrow(X), 1);
- X = cbind(X, ones);
-}
-
-r = -(t(X) %*% y);
-p = -r;
-norm_r2 = sum(r * r);
-w = matrix(0, ncol(X), 1);
-
-i = 0;
-while(i < maxiter) {
- q = ((t(X) %*% (X %*% p)) + eps * p);
- alpha = norm_r2 / ((t(p) %*% q)[1:1]);
- w = w + alpha * p;
- old_norm_r2 = norm_r2;
- r = r + alpha * q;
- norm_r2 = sum(r * r);
- beta = norm_r2 / old_norm_r2;
- p = -r + beta * p;
- i = i + 1;
-}
-
-writeMM(as(w,"CsparseMatrix"), paste(args[5], "w", sep=""))
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/LinregCG.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/LinregCG.dml b/src/test/scripts/functions/gdfo/LinregCG.dml
deleted file mode 100644
index 01dcae7..0000000
--- a/src/test/scripts/functions/gdfo/LinregCG.dml
+++ /dev/null
@@ -1,56 +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.
-#
-#-------------------------------------------------------------
-
-
-X = read($1);
-y = read($2);
-intercept = $3;
-eps = $4;
-maxiter = $5;
-
-if( intercept == 1 ){
- ones = matrix(1, nrow(X), 1);
- X = cbind(X, ones);
-}
-
-r = -(t(X) %*% y);
-p = -r;
-norm_r2 = sum(r * r);
-w = matrix(0, rows = ncol(X), cols = 1);
-
-i = 0;
-while(i < maxiter) {
- q = ((t(X) %*% (X %*% p)) + eps * p);
- alpha = norm_r2 / as.scalar(t(p) %*% q);
- w = w + alpha * p;
- old_norm_r2 = norm_r2;
- r = r + alpha * q;
- norm_r2 = sum(r * r);
- beta = norm_r2 / old_norm_r2;
- p = -r + beta * p;
- i = i + 1;
-}
-
-write(w, $6);
-
-
-
-
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/LinregDS.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/LinregDS.R b/src/test/scripts/functions/gdfo/LinregDS.R
deleted file mode 100644
index 752e862..0000000
--- a/src/test/scripts/functions/gdfo/LinregDS.R
+++ /dev/null
@@ -1,43 +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.
-#
-#-------------------------------------------------------------
-
-
-args <- commandArgs(TRUE)
-options(digits=22)
-library("Matrix")
-
-X = as.matrix(readMM(paste(args[1], "X.mtx", sep="")))
-y = as.matrix(readMM(paste(args[1], "y.mtx", sep="")))
-I = as.vector(matrix(1, ncol(X), 1));
-intercept = as.integer(args[2])
-lambda = as.double(args[3]);
-
-if( intercept == 1 ){
- ones = matrix(1, nrow(X), 1);
- X = cbind(X, ones);
- I = as.vector(matrix(1, ncol(X), 1));
-}
-
-A = t(X) %*% X + diag(I)*lambda;
-b = t(X) %*% y;
-beta = solve(A, b);
-
-writeMM(as(beta,"CsparseMatrix"), paste(args[4], "B", sep=""))
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/LinregDS.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/LinregDS.dml b/src/test/scripts/functions/gdfo/LinregDS.dml
deleted file mode 100644
index a985340..0000000
--- a/src/test/scripts/functions/gdfo/LinregDS.dml
+++ /dev/null
@@ -1,39 +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.
-#
-#-------------------------------------------------------------
-
-
-X = read($1);
-y = read($2);
-I = matrix(1, ncol(X), 1);
-intercept = $3;
-lambda = $4;
-
-if( intercept == 1 ){
- ones = matrix(1, nrow(X), 1);
- X = cbind(X, ones);
- I = matrix(1, ncol(X), 1);
-}
-
-A = t(X) %*% X + diag(I)*lambda;
-b = t(X) %*% y;
-beta = solve(A, b);
-
-write(beta, $5);
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/LinregDSsimpl.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/LinregDSsimpl.R b/src/test/scripts/functions/gdfo/LinregDSsimpl.R
deleted file mode 100644
index 5b90875..0000000
--- a/src/test/scripts/functions/gdfo/LinregDSsimpl.R
+++ /dev/null
@@ -1,35 +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.
-#
-#-------------------------------------------------------------
-
-
-args <- commandArgs(TRUE)
-options(digits=22)
-library("Matrix")
-
-X = as.matrix(readMM(paste(args[1], "X.mtx", sep="")))
-y = as.matrix(readMM(paste(args[1], "y.mtx", sep="")))
-I = as.vector(matrix(1, ncol(X), 1));
-lambda = as.double(args[3]);
-A = t(X) %*% X + diag(I)*lambda;
-b = t(X) %*% y;
-beta = solve(A, b);
-
-writeMM(as(beta,"CsparseMatrix"), paste(args[4], "B", sep=""))
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/LinregDSsimpl.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/LinregDSsimpl.dml b/src/test/scripts/functions/gdfo/LinregDSsimpl.dml
deleted file mode 100644
index 576d1ce..0000000
--- a/src/test/scripts/functions/gdfo/LinregDSsimpl.dml
+++ /dev/null
@@ -1,31 +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.
-#
-#-------------------------------------------------------------
-
-
-X = read($1);
-y = read($2);
-I = matrix(1, ncol(X), 1);
-lambda = $4;
-A = t(X) %*% X + diag(I)*lambda;
-b = t(X) %*% y;
-beta = solve(A, b);
-
-write(beta, $5);
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/MMChainLoop.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/MMChainLoop.R b/src/test/scripts/functions/gdfo/MMChainLoop.R
deleted file mode 100644
index e2177f7..0000000
--- a/src/test/scripts/functions/gdfo/MMChainLoop.R
+++ /dev/null
@@ -1,37 +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.
-#
-#-------------------------------------------------------------
-
-
-args <- commandArgs(TRUE)
-options(digits=22)
-library("Matrix")
-
-X = readMM(paste(args[1], "X.mtx", sep=""))
-v = readMM(paste(args[1], "v.mtx", sep=""))
-maxiter = as.double(args[2]);
-
-i = 0;
-while(i < maxiter) {
- v = t(X) %*% (X %*% v);
- i = i + 1;
-}
-
-writeMM(as(v,"CsparseMatrix"), paste(args[3], "w", sep=""))
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/MMChainLoop.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/MMChainLoop.dml b/src/test/scripts/functions/gdfo/MMChainLoop.dml
deleted file mode 100644
index a68c79b..0000000
--- a/src/test/scripts/functions/gdfo/MMChainLoop.dml
+++ /dev/null
@@ -1,37 +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.
-#
-#-------------------------------------------------------------
-
-
-X = read($1);
-v = read($2);
-maxiter = $3;
-
-i = 0;
-while(i < maxiter) {
- v = t(X) %*% (X %*% v);
- i = i + 1;
-}
-
-write(v, $4);
-
-
-
-
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test/scripts/functions/gdfo/SystemML-config-globalopt.xml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/gdfo/SystemML-config-globalopt.xml b/src/test/scripts/functions/gdfo/SystemML-config-globalopt.xml
deleted file mode 100644
index 01c4c9a..0000000
--- a/src/test/scripts/functions/gdfo/SystemML-config-globalopt.xml
+++ /dev/null
@@ -1,26 +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.
--->
-
-<root>
- <sysml.localtmpdir>/tmp/systemml</sysml.localtmpdir>
- <sysml.scratch>scratch_space</sysml.scratch>
- <sysml.optlevel>4</sysml.optlevel>
- <!-- piggybacked test for custom mapred/mapreduce configurations -->
- <mapreduce.task.io.sort.mb>50</mapreduce.task.io.sort.mb>
-</root>
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/test_suites/java/org/apache/sysml/test/integration/functions/gdfo/ZPackageSuite.java
----------------------------------------------------------------------
diff --git a/src/test_suites/java/org/apache/sysml/test/integration/functions/gdfo/ZPackageSuite.java b/src/test_suites/java/org/apache/sysml/test/integration/functions/gdfo/ZPackageSuite.java
deleted file mode 100644
index 074aec8..0000000
--- a/src/test_suites/java/org/apache/sysml/test/integration/functions/gdfo/ZPackageSuite.java
+++ /dev/null
@@ -1,40 +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.test.integration.functions.gdfo;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/** Group together the tests in this package into a single suite so that the Maven build
- * won't run two of them at once. */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- GDFOLinregCG.class,
- GDFOLinregDS.class,
- GDFOLinregDSsimpl.class,
- GDFOMMChainLoop.class,
- HashInterestingPropertiesTest.class
-})
-
-
-/** This class is just a holder for the above JUnit annotations. */
-public class ZPackageSuite {
-
-}
[02/10] systemml git commit: [SYSTEMML-2202] Remove global data flow
optimizer prototype (level 4)
Posted by mb...@apache.org.
[SYSTEMML-2202] Remove global data flow optimizer prototype (level 4)
This patch removes the early prototype of the global data flow
optimizer, which was written for map-reduce and never reached
production-ready status. While the general idea is still viable, we
would need to redesign it from scratch to make it practical and
outperform basic heuristic rewrites.
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/b3419b09
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/b3419b09
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/b3419b09
Branch: refs/heads/master
Commit: b3419b09fbd5d8a16c2c2f66bc4a1838539be051
Parents: 140f1e1
Author: Matthias Boehm <mb...@gmail.com>
Authored: Fri Mar 23 17:52:54 2018 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Fri Mar 23 22:18:24 2018 -0700
----------------------------------------------------------------------
pom.xml | 1 -
.../java/org/apache/sysml/api/DMLScript.java | 10 -
.../sysml/api/mlcontext/ScriptExecutor.java | 20 -
.../sysml/hops/globalopt/GDFEnumOptimizer.java | 568 -------------------
.../sysml/hops/globalopt/GlobalOptimizer.java | 47 --
.../hops/globalopt/GlobalOptimizerWrapper.java | 118 ----
.../hops/globalopt/InterestingProperties.java | 115 ----
.../sysml/hops/globalopt/MemoStructure.java | 96 ----
.../org/apache/sysml/hops/globalopt/Plan.java | 225 --------
.../apache/sysml/hops/globalopt/PlanSet.java | 149 -----
.../sysml/hops/globalopt/RewriteConfig.java | 94 ---
.../apache/sysml/hops/globalopt/Summary.java | 101 ----
.../globalopt/gdfgraph/GDFCrossBlockNode.java | 95 ----
.../sysml/hops/globalopt/gdfgraph/GDFGraph.java | 49 --
.../hops/globalopt/gdfgraph/GDFLoopNode.java | 66 ---
.../sysml/hops/globalopt/gdfgraph/GDFNode.java | 165 ------
.../hops/globalopt/gdfgraph/GraphBuilder.java | 300 ----------
.../gdfresolve/GDFMismatchHeuristic.java | 48 --
.../GDFMismatchHeuristicBlocksizeOrFirst.java | 49 --
.../gdfresolve/GDFMismatchHeuristicFirst.java | 38 --
.../gdfresolve/MismatchHeuristicFactory.java | 41 --
.../java/org/apache/sysml/utils/Explain.java | 116 ----
.../functions/gdfo/GDFOLinregCG.java | 171 ------
.../functions/gdfo/GDFOLinregDS.java | 166 ------
.../functions/gdfo/GDFOLinregDSsimpl.java | 166 ------
.../functions/gdfo/GDFOMMChainLoop.java | 132 -----
.../gdfo/HashInterestingPropertiesTest.java | 96 ----
.../integration/mlcontext/MLContextTest.java | 10 +-
src/test/scripts/functions/gdfo/LinregCG.R | 57 --
src/test/scripts/functions/gdfo/LinregCG.dml | 56 --
src/test/scripts/functions/gdfo/LinregDS.R | 43 --
src/test/scripts/functions/gdfo/LinregDS.dml | 39 --
src/test/scripts/functions/gdfo/LinregDSsimpl.R | 35 --
.../scripts/functions/gdfo/LinregDSsimpl.dml | 31 -
src/test/scripts/functions/gdfo/MMChainLoop.R | 37 --
src/test/scripts/functions/gdfo/MMChainLoop.dml | 37 --
.../gdfo/SystemML-config-globalopt.xml | 26 -
.../functions/gdfo/ZPackageSuite.java | 40 --
38 files changed, 2 insertions(+), 3651 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b79f119..5dfaf11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -442,7 +442,6 @@
<include>**/integration/applications/**/*Suite.java</include>
<include>**/integration/conversion/*Suite.java</include>
<include>**/integration/functions/data/*Suite.java</include>
- <include>**/integration/functions/gdfo/*Suite.java</include>
<include>**/integration/functions/sparse/*Suite.java</include>
<include>**/integration/functions/codegenalg/*Suite.java</include>
<include>**/integration/functions/**/*Test*.java</include>
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/api/DMLScript.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/DMLScript.java b/src/main/java/org/apache/sysml/api/DMLScript.java
index 7a44838..7e5e1f3 100644
--- a/src/main/java/org/apache/sysml/api/DMLScript.java
+++ b/src/main/java/org/apache/sysml/api/DMLScript.java
@@ -64,8 +64,6 @@ import org.apache.sysml.debug.DMLDebuggerException;
import org.apache.sysml.debug.DMLDebuggerProgramInfo;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
-import org.apache.sysml.hops.OptimizerUtils.OptimizationLevel;
-import org.apache.sysml.hops.globalopt.GlobalOptimizerWrapper;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopsException;
import org.apache.sysml.parser.DMLProgram;
@@ -731,14 +729,6 @@ public class DMLScript
//Step 7: generate runtime program, incl codegen
Program rtprog = dmlt.getRuntimeProgram(prog, dmlconf);
- //Step 8: [optional global data flow optimization]
- if(OptimizerUtils.isOptLevel(OptimizationLevel.O4_GLOBAL_TIME_MEMORY) )
- {
- LOG.warn("Optimization level '" + OptimizationLevel.O4_GLOBAL_TIME_MEMORY + "' " +
- "is still in experimental state and not intended for production use.");
- rtprog = GlobalOptimizerWrapper.optimizeProgram(prog, rtprog);
- }
-
//launch SystemML appmaster (if requested and not already in launched AM)
if( dmlconf.getBooleanValue(DMLConfig.YARN_APPMASTER) ){
if( !isActiveAM() && DMLYarnClientProxy.launchDMLYarnAppmaster(dmlScriptStr, dmlconf, allArgs, rtprog) )
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java b/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
index 9b0dfc8..1fa9e4e 100644
--- a/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
+++ b/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
@@ -37,8 +37,6 @@ import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.conf.DMLConfig;
import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
-import org.apache.sysml.hops.OptimizerUtils.OptimizationLevel;
-import org.apache.sysml.hops.globalopt.GlobalOptimizerWrapper;
import org.apache.sysml.hops.rewrite.ProgramRewriter;
import org.apache.sysml.hops.rewrite.RewriteRemovePersistentReadWrite;
import org.apache.sysml.lops.LopsException;
@@ -337,7 +335,6 @@ public class ScriptExecutor {
constructLops();
generateRuntimeProgram();
showExplanation();
- globalDataFlowOptimization();
countCompiledMRJobsAndSparkInstructions();
initializeCachingAndScratchSpace();
cleanupRuntimeProgram();
@@ -477,23 +474,6 @@ public class ScriptExecutor {
}
/**
- * Optimize the program.
- */
- protected void globalDataFlowOptimization() {
- if (OptimizerUtils.isOptLevel(OptimizationLevel.O4_GLOBAL_TIME_MEMORY)) {
- try {
- runtimeProgram = GlobalOptimizerWrapper.optimizeProgram(dmlProgram, runtimeProgram);
- } catch (DMLRuntimeException e) {
- throw new MLContextException("Exception occurred during global data flow optimization", e);
- } catch (HopsException e) {
- throw new MLContextException("Exception occurred during global data flow optimization", e);
- } catch (LopsException e) {
- throw new MLContextException("Exception occurred during global data flow optimization", e);
- }
- }
- }
-
- /**
* Parse the script into an ANTLR parse tree, and convert this parse tree
* into a SystemML program. Parsing includes lexical/syntactic analysis.
*/
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java b/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java
deleted file mode 100644
index 50284b1..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/GDFEnumOptimizer.java
+++ /dev/null
@@ -1,568 +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.hops.globalopt;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sysml.conf.ConfigurationManager;
-import org.apache.sysml.hops.DataOp;
-import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.HopsException;
-import org.apache.sysml.hops.Hop.FileFormatTypes;
-import org.apache.sysml.hops.OptimizerUtils;
-import org.apache.sysml.hops.cost.CostEstimationWrapper;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFGraph;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFLoopNode;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode.NodeType;
-import org.apache.sysml.hops.globalopt.gdfresolve.GDFMismatchHeuristic;
-import org.apache.sysml.hops.globalopt.gdfresolve.GDFMismatchHeuristic.MismatchHeuristicType;
-import org.apache.sysml.hops.globalopt.gdfresolve.MismatchHeuristicFactory;
-import org.apache.sysml.hops.rewrite.HopRewriteUtils;
-import org.apache.sysml.hops.recompile.Recompiler;
-import org.apache.sysml.hops.recompile.Recompiler.ResetType;
-import org.apache.sysml.lops.LopsException;
-import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.LocalVariableMap;
-import org.apache.sysml.runtime.controlprogram.Program;
-import org.apache.sysml.runtime.controlprogram.ProgramBlock;
-import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.controlprogram.context.ExecutionContextFactory;
-import org.apache.sysml.runtime.controlprogram.parfor.stat.Timing;
-
-/**
- * Global data flow optimization via enumeration-based optimizer (dynamic programming).
- *
- *
- * ADDITIONAL PERFORMANCE OPT (once everything is completely working)
- * TODO cache for interesting properties
- * TODO partial runtime plan generation
- * TODO partial runtime plan costing
- *
- */
-public class GDFEnumOptimizer extends GlobalOptimizer
-{
-
- private static final Log LOG = LogFactory.getLog(GDFEnumOptimizer.class);
-
- //internal configuration parameters
- //note: that branch and bound pruning is invalid if we cost entire programs
- private static final boolean BRANCH_AND_BOUND_PRUNING = true;
- private static final boolean PREFERRED_PLAN_SELECTION = true;
- private static final boolean COST_FULL_PROGRAMS = false;
- private static final boolean ENUM_CP_BLOCKSIZES = false;
- private static final MismatchHeuristicType DEFAULT_MISMATCH_HEURISTIC = MismatchHeuristicType.FIRST;
-
- //internal configuration parameters
- private static final int[] BLOCK_SIZES = new int[]{ 1024,//1 * DMLTranslator.DMLBlockSize,
- 2048,//2 * DMLTranslator.DMLBlockSize,
- 4096};//4 * DMLTranslator.DMLBlockSize};
- private static final double BRANCH_AND_BOUND_REL_THRES = Math.pow(10, -5);
- //private static final int[] REPLICATION_FACTORS = new int[]{1,3,5};
-
- private MemoStructure _memo = null; //plan memoization table
- private static GDFMismatchHeuristic _resolve = null;
- private static long _enumeratedPlans = 0;
- private static long _prunedInvalidPlans = 0;
- private static long _prunedSuboptimalPlans = 0;
- private static long _compiledPlans = 0;
- private static long _costedPlans = 0;
- private static long _planMismatches = 0;
-
-
- public GDFEnumOptimizer( )
- throws DMLRuntimeException
- {
- //init internal memo structure
- _memo = new MemoStructure();
-
- //init mismatch heuristic
- _resolve = MismatchHeuristicFactory.createMismatchHeuristic(
- DEFAULT_MISMATCH_HEURISTIC);
- }
-
- @Override
- public GDFGraph optimize(GDFGraph gdfgraph, Summary summary)
- throws DMLRuntimeException, HopsException, LopsException
- {
- Timing time = new Timing(true);
-
- Program prog = gdfgraph.getRuntimeProgram();
- ExecutionContext ec = ExecutionContextFactory.createContext(prog);
- ArrayList<GDFNode> roots = gdfgraph.getGraphRootNodes();
-
- //Step 1: baseline costing for branch and bound costs
- double initCosts = Double.MAX_VALUE;
- if( BRANCH_AND_BOUND_PRUNING ) {
- initCosts = CostEstimationWrapper.getTimeEstimate(prog, ec);
- initCosts = initCosts * (1+BRANCH_AND_BOUND_REL_THRES);
- }
-
- //Step 2: dynamic programming plan generation
- //(finally, pick optimal root plans over all interesting property sets)
- ArrayList<Plan> rootPlans = new ArrayList<>();
- for( GDFNode node : roots ) {
- PlanSet ps = enumOpt(node, _memo, initCosts);
- Plan optPlan = ps.getPlanWithMinCosts();
- rootPlans.add( optPlan );
- }
- long enumPlanMismatch = getPlanMismatches();
-
- //check for final containment of independent roots and pick optimal
- HashMap<Long, Plan> memo = new HashMap<>();
- resetPlanMismatches();
- for( Plan p : rootPlans )
- rSetRuntimePlanConfig(p, memo);
- long finalPlanMismatch = getPlanMismatches();
-
- //generate final runtime plan (w/ optimal config)
- Recompiler.recompileProgramBlockHierarchy(prog.getProgramBlocks(),
- new LocalVariableMap(), 0, ResetType.NO_RESET);
-
- ec = ExecutionContextFactory.createContext(prog);
- double optCosts = CostEstimationWrapper.getTimeEstimate(prog, ec);
-
- //maintain optimization summary statistics
- summary.setCostsInitial( initCosts );
- summary.setCostsOptimal( optCosts );
- summary.setNumEnumPlans( _enumeratedPlans );
- summary.setNumPrunedInvalidPlans( _prunedInvalidPlans );
- summary.setNumPrunedSuboptPlans( _prunedSuboptimalPlans );
- summary.setNumCompiledPlans( _compiledPlans );
- summary.setNumCostedPlans( _costedPlans );
- summary.setNumEnumPlanMismatch( enumPlanMismatch );
- summary.setNumFinalPlanMismatch( finalPlanMismatch );
- summary.setTimeOptim( time.stop() );
-
- return gdfgraph;
- }
-
- /**
- * Core dynamic programming enumeration algorithm
- * for global data flow optimization.
- *
- * @param node the GDF node
- * @param memo the memo structure
- * @param maxCosts max costs
- * @return the plan set
- * @throws DMLRuntimeException if DMLRuntimeException occurs
- */
- public static PlanSet enumOpt( GDFNode node, MemoStructure memo, double maxCosts )
- throws DMLRuntimeException
- {
- //memoization of already enumerated subgraphs
- if( memo.constainsEntry(node) )
- return memo.getEntry(node);
-
- //enumerate node plans
- PlanSet P = enumNodePlans( node, memo, maxCosts );
- //System.out.println("Plans after enumNodePlan:\n"+P.toString());
-
- //combine local node plan with optimal child plans
- for( GDFNode c : node.getInputs() )
- {
- //recursive optimization
- PlanSet Pc = enumOpt( c, memo, maxCosts );
- if( c instanceof GDFLoopNode )
- Pc = Pc.selectChild( node );
-
- //combine parent-child plans
- P = P.crossProductChild(Pc);
- _enumeratedPlans += P.size();
-
- //prune invalid plans
- pruneInvalidPlans( P );
- }
-
- //prune suboptimal plans
- pruneSuboptimalPlans( P, maxCosts );
-
- //memoization of created entries
- memo.putEntry(node, P);
-
- return P;
- }
-
- private static PlanSet enumNodePlans( GDFNode node, MemoStructure memo, double maxCosts )
- throws DMLRuntimeException
- {
- ArrayList<Plan> plans = new ArrayList<>();
- ExecType CLUSTER = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
-
- //ENUMERATE HOP PLANS
- // CASE 1: core hop enumeration (other than persistent/transient read/write)
- if( node.getNodeType() == NodeType.HOP_NODE && !(node.getHop() instanceof DataOp ) )
- {
- //core rewrite enumeration for cp and mr
- enumHopNodePlans(node, plans);
- }
- //CASE 2: dataop hop enumeration
- else if( node.getHop() instanceof DataOp )
- {
- DataOp dhop = (DataOp)node.getHop();
-
- if( dhop.getDataOpType()==DataOpTypes.PERSISTENTREAD )
- {
- //for persistent read the interesting properties are fixed by the input
- //but we can decide on output properties
- ExecType et = (dhop.getMemEstimate()>OptimizerUtils.getLocalMemBudget()
- || HopRewriteUtils.alwaysRequiresReblock(dhop)) ?
- CLUSTER : ExecType.CP;
-
- int[] blocksizes = (et == CLUSTER) ? BLOCK_SIZES : new int[]{BLOCK_SIZES[0]};
- for( Integer bs : blocksizes )
- {
- RewriteConfig rcmr = new RewriteConfig(et, bs, FileFormatTypes.BINARY);
- InterestingProperties ipsmr = rcmr.deriveInterestingProperties();
- Plan mrplan = new Plan(node, ipsmr, rcmr, null);
- plans.add( mrplan );
- }
- }
- else if( dhop.getDataOpType()==DataOpTypes.PERSISTENTWRITE )
- {
- //for persistent write the interesting properties are fixed by the given
- //write specification
- ExecType et = (dhop.getMemEstimate()>OptimizerUtils.getLocalMemBudget()) ?
- CLUSTER : ExecType.CP;
-
- RewriteConfig rcmr = new RewriteConfig(et, (int)dhop.getRowsInBlock(), dhop.getInputFormatType());
- InterestingProperties ipsmr = rcmr.deriveInterestingProperties();
- Plan mrplan = new Plan(node, ipsmr, rcmr, null);
- plans.add( mrplan );
- }
- else if( dhop.getDataOpType()==DataOpTypes.TRANSIENTREAD
- || dhop.getDataOpType()==DataOpTypes.TRANSIENTWRITE)
- {
- //note: full enumeration for transient read and write; otherwise the properties
- //of these hops are never set because pass-through plans refer to different hops
- enumHopNodePlans(node, plans);
- }
- }
- //ENUMERATE LOOP PLANS
- else if( node.getNodeType() == NodeType.LOOP_NODE )
- {
- //TODO consistency checks inputs and outputs (updated vars)
-
- GDFLoopNode lnode = (GDFLoopNode) node;
-
- //step 0: recursive call optimize on inputs
- //no additional pruning (validity, optimality) required
- for( GDFNode in : lnode.getLoopInputs().values() )
- enumOpt(in, memo, maxCosts);
-
- //step 1: enumerate loop plan, incl partitioning/checkpoints/reblock for inputs
- RewriteConfig rc = new RewriteConfig(ExecType.CP, -1, null);
- InterestingProperties ips = rc.deriveInterestingProperties();
- Plan lplan = new Plan(node, ips, rc, null);
- plans.add( lplan );
-
- //step 2: recursive call optimize on predicate
- //(predicate might be null if single variable)
- if( lnode.getLoopPredicate() != null )
- enumOpt(lnode.getLoopPredicate(), memo, maxCosts);
-
- //step 3: recursive call optimize on outputs
- //(return union of all output plans, later selected by output var)
- PlanSet Pout = new PlanSet();
- for( GDFNode out : lnode.getLoopOutputs().values() )
- Pout = Pout.union( enumOpt(out, memo, maxCosts) );
- plans.addAll(Pout.getPlans());
-
- //note: global pruning later done when returning to enumOpt
- //for the entire loop node
- }
- //CREATE DUMMY CROSSBLOCK PLAN
- else if( node.getNodeType() == NodeType.CROSS_BLOCK_NODE )
- {
- //do nothing (leads to pass-through on crossProductChild)
- }
-
- return new PlanSet(plans);
- }
-
- private static void enumHopNodePlans(GDFNode node, ArrayList<Plan> plans)
- {
- ExecType CLUSTER = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
-
- //create cp plan, if allowed (note: most interesting properties are irrelevant for CP)
- if( node.getHop().getMemEstimate() < OptimizerUtils.getLocalMemBudget() ) {
- int[] bstmp = ENUM_CP_BLOCKSIZES ? BLOCK_SIZES : new int[]{BLOCK_SIZES[0]};
- for( Integer bs : bstmp ) {
- RewriteConfig rccp = new RewriteConfig(ExecType.CP, bs, FileFormatTypes.BINARY);
- InterestingProperties ipscp = rccp.deriveInterestingProperties();
- Plan cpplan = new Plan(node, ipscp, rccp, null);
- plans.add( cpplan );
- }
- }
-
- //create mr plans, if required
- if( node.requiresMREnumeration() ) {
- for( Integer bs : BLOCK_SIZES )
- {
- RewriteConfig rcmr = new RewriteConfig(CLUSTER, bs, FileFormatTypes.BINARY);
- InterestingProperties ipsmr = rcmr.deriveInterestingProperties();
- Plan mrplan = new Plan(node, ipsmr, rcmr, null);
- plans.add( mrplan );
- }
- }
- }
-
- private static void pruneInvalidPlans( PlanSet plans )
- {
- ArrayList<Plan> valid = new ArrayList<>();
-
- //check each plan in planset for validity
- for( Plan plan : plans.getPlans() )
- {
- //a) check matching blocksizes if operation in MR
- if( !plan.checkValidBlocksizesInMR() ) {
- //System.out.println("pruned invalid blocksize mr op");
- continue;
- }
-
- //b) check matching blocksizes of tread/twrite pairs
- if( !plan.checkValidBlocksizesTRead() ) {
- //System.out.println("pruned invalid blocksize tread");
- continue;
- }
-
- //c) check valid format in MR
- if( !plan.checkValidFormatInMR() ) {
- //System.out.println("pruned invalid format: "+plan.getNode().getHop().getClass());
- continue;
- }
-
- //d) check valid execution type per hop (e.g., function, reblock)
- if( !plan.checkValidExecutionType() ) {
- //System.out.println("pruned invalid execution type: "+plan.getNode().getHop().getClass());
- continue;
- }
-
- valid.add( plan );
- }
-
- //debug output
- int sizeBefore = plans.size();
- int sizeAfter = valid.size();
- _prunedInvalidPlans += (sizeBefore-sizeAfter);
- LOG.debug("Pruned invalid plans: "+sizeBefore+" --> "+sizeAfter);
-
- plans.setPlans( valid );
- }
-
- private static void pruneSuboptimalPlans( PlanSet plans, double maxCosts )
- throws DMLRuntimeException
- {
- //costing of all plans incl containment check
- for( Plan p : plans.getPlans() ) {
- p.setCosts( costRuntimePlan(p) );
- }
-
- //build and probe for optimal plans (hash-groupby on IPC, min costs)
- HashMap<InterestingProperties, Plan> probeMap = new HashMap<>();
- for( Plan p : plans.getPlans() )
- {
- //max cost pruning filter (branch-and-bound)
- if( BRANCH_AND_BOUND_PRUNING && p.getCosts() > maxCosts ) {
- continue;
- }
-
- //plan cost per IPS pruning filter (allow smaller or equal costs)
- Plan best = probeMap.get(p.getInterestingProperties());
- if( best!=null && p.getCosts() > best.getCosts() ) {
- continue;
- }
-
- //non-preferred plan pruning filter (allow smaller cost or equal cost and preferred plan)
- if( PREFERRED_PLAN_SELECTION && best!=null &&
- p.getCosts() == best.getCosts() && !p.isPreferredPlan() ) {
- continue;
- }
-
- //add plan as best per IPS
- probeMap.put(p.getInterestingProperties(), p);
-
- }
-
- //copy over plans per IPC into one plan set
- ArrayList<Plan> optimal = new ArrayList<>(probeMap.values());
-
- int sizeBefore = plans.size();
- int sizeAfter = optimal.size();
- _prunedSuboptimalPlans += (sizeBefore-sizeAfter);
- LOG.debug("Pruned suboptimal plans: "+sizeBefore+" --> "+sizeAfter);
-
- plans.setPlans(optimal);
- }
-
- private static double costRuntimePlan(Plan p)
- throws DMLRuntimeException
- {
- Program prog = p.getNode().getProgram();
- if( prog == null )
- throw new DMLRuntimeException("Program not available for runtime plan costing.");
-
- //put data flow configuration into program
- rSetRuntimePlanConfig(p, new HashMap<Long,Plan>());
-
- double costs = -1;
- if( COST_FULL_PROGRAMS ||
- (p.getNode().getHop()==null || p.getNode().getProgramBlock()==null) )
- {
- //recompile entire runtime program
- Recompiler.recompileProgramBlockHierarchy(prog.getProgramBlocks(),
- new LocalVariableMap(), 0, ResetType.NO_RESET);
- _compiledPlans++;
-
- //cost entire runtime program
- ExecutionContext ec = ExecutionContextFactory.createContext(prog);
- costs = CostEstimationWrapper.getTimeEstimate(prog, ec);
- }
- else
- {
- Hop currentHop = p.getNode().getHop();
- ProgramBlock pb = p.getNode().getProgramBlock();
-
- //keep the old dag roots
- ArrayList<Hop> oldRoots = pb.getStatementBlock().getHops();
- Hop tmpHop = null;
- if( !(currentHop instanceof DataOp && ((DataOp)currentHop).isWrite()) ){
- ArrayList<Hop> newRoots = new ArrayList<>();
- tmpHop = new DataOp("_tmp", currentHop.getDataType(), currentHop.getValueType(), currentHop, DataOpTypes.TRANSIENTWRITE, "tmp");
- tmpHop.setVisited(); //ensure recursive visitstatus reset on recompile
- newRoots.add(tmpHop);
- pb.getStatementBlock().setHops(newRoots);
- }
-
- //recompile modified runtime program
- Recompiler.recompileProgramBlockHierarchy(prog.getProgramBlocks(),
- new LocalVariableMap(), 0, ResetType.NO_RESET);
- _compiledPlans++;
-
- //cost partial runtime program up to current hop
- ExecutionContext ec = ExecutionContextFactory.createContext(prog);
- costs = CostEstimationWrapper.getTimeEstimate(prog, ec);
-
- //restore original hop dag
- if( tmpHop !=null )
- HopRewriteUtils.removeChildReference(tmpHop, currentHop);
- pb.getStatementBlock().setHops(oldRoots);
- }
-
- //release forced data flow configuration from program
- rResetRuntimePlanConfig(p, new HashMap<Long,Plan>());
- _costedPlans++;
-
- return costs;
- }
-
- private static void rSetRuntimePlanConfig( Plan p, HashMap<Long, Plan> memo )
- {
- ExecType CLUSTER = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
-
- //basic memoization including containment check
- if( memo.containsKey(p.getNode().getID()) ) {
- Plan pmemo = memo.get(p.getNode().getID());
- if( !p.getInterestingProperties().equals( pmemo.getInterestingProperties()) )
- {
- //replace plan in memo with new plan
- //TODO this would require additional cleanup in special cases
- if( _resolve.resolveMismatch(pmemo.getRewriteConfig(), p.getRewriteConfig()) )
- memo.put(p.getNode().getID(), p);
- //logging of encounter plan mismatch
- LOG.warn("Configuration mismatch on shared node ("+p.getNode().getHop().getHopID()+"). Falling back to heuristic '"+_resolve.getName()+"'.");
- LOG.warn(p.getInterestingProperties().toString());
- LOG.warn(memo.get(p.getNode().getID()).getInterestingProperties());
- _planMismatches++;
- return;
- }
- }
-
- //set plan configuration
- Hop hop = p.getNode().getHop();
- if( hop!=null )
- {
- RewriteConfig rc = p.getRewriteConfig();
- //set exec type
- hop.setForcedExecType(rc.getExecType());
- //set blocksizes and reblock
- hop.setRowsInBlock(rc.getBlockSize());
- hop.setColsInBlock(rc.getBlockSize());
- if( rc.getExecType()==CLUSTER ) //after blocksize update
- {
- //TODO double check dataop condition - side effect from plan validity
- boolean reblock = HopRewriteUtils.alwaysRequiresReblock(hop) ||
- (hop.hasMatrixInputWithDifferentBlocksizes() && !(hop instanceof DataOp));
- hop.setRequiresReblock(reblock);
- }
- else
- hop.setRequiresReblock(false);
- }
-
- //process childs
- if( p.getChilds() != null )
- for( Plan c : p.getChilds() )
- rSetRuntimePlanConfig(c, memo);
-
- //memoization (mark as processed)
- memo.put(p.getNode().getID(), p);
- }
-
- private static void rResetRuntimePlanConfig( Plan p, HashMap<Long, Plan> memo )
- {
- //basic memoization including containment check
- if( memo.containsKey(p.getNode().getID()) ) {
- return;
- }
-
- //release forced plan configuration
- Hop hop = p.getNode().getHop();
- if( hop!=null )
- {
- hop.setForcedExecType(null);
- hop.setRowsInBlock(ConfigurationManager.getBlocksize());
- hop.setColsInBlock(ConfigurationManager.getBlocksize());
- if( !HopRewriteUtils.alwaysRequiresReblock(hop) ) {
- hop.setRequiresReblock(false);
- }
- }
-
- //process childs
- if( p.getChilds() != null )
- for( Plan c : p.getChilds() )
- rResetRuntimePlanConfig(c, memo);
-
- //memoization (mark as processed)
- memo.put(p.getNode().getID(), p);
- }
-
- private static long getPlanMismatches(){
- return _planMismatches;
- }
-
- private static void resetPlanMismatches(){
- _planMismatches = 0;
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizer.java b/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizer.java
deleted file mode 100644
index f2c6748..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizer.java
+++ /dev/null
@@ -1,47 +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.hops.globalopt;
-
-import org.apache.sysml.hops.HopsException;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFGraph;
-import org.apache.sysml.lops.LopsException;
-import org.apache.sysml.runtime.DMLRuntimeException;
-
-/**
- * Super class for all optimizers (e.g., transformation-based, and enumeration-based)
- *
- */
-public abstract class GlobalOptimizer
-{
-
- /**
- * Core optimizer call, to be implemented by an instance of a global
- * data flow optimizer.
- *
- * @param gdfgraph the GDF graph
- * @param summary the summaruy
- * @return the GDF graph
- * @throws DMLRuntimeException if DMLRuntimeException occurs
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
- */
- public abstract GDFGraph optimize( GDFGraph gdfgraph, Summary summary )
- throws DMLRuntimeException, HopsException, LopsException;
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizerWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizerWrapper.java b/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizerWrapper.java
deleted file mode 100644
index 9d716b6..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/GlobalOptimizerWrapper.java
+++ /dev/null
@@ -1,118 +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.hops.globalopt;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
-import org.apache.sysml.hops.HopsException;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFGraph;
-import org.apache.sysml.hops.globalopt.gdfgraph.GraphBuilder;
-import org.apache.sysml.lops.LopsException;
-import org.apache.sysml.parser.DMLProgram;
-import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.Program;
-import org.apache.sysml.runtime.controlprogram.parfor.stat.Timing;
-import org.apache.sysml.utils.Explain;
-
-/**
- * Main entry point for Global Data Flow Optimization. It is intended to be invoked after
- * the initial runtime program was created (and thus with constructed hops and lops).
- *
- *
- */
-public class GlobalOptimizerWrapper
-{
-
- private static final Log LOG = LogFactory.getLog(GlobalOptimizerWrapper.class);
- private static final boolean LDEBUG = true; //local debug flag
-
- //supported optimizers
- public enum GlobalOptimizerType{
- ENUMERATE_DP,
- TRANSFORM
- }
-
- //internal parameters
- private static final GlobalOptimizerType OPTIM = GlobalOptimizerType.ENUMERATE_DP;
-
- static
- {
- // for internal debugging only
- if( LDEBUG ) {
- Logger.getLogger("org.apache.sysml.hops.globalopt")
- .setLevel((Level) Level.DEBUG);
- }
- }
-
- public static Program optimizeProgram(DMLProgram prog, Program rtprog)
- throws DMLRuntimeException, HopsException, LopsException
- {
- LOG.debug("Starting global data flow optimization.");
- Timing time = new Timing(true);
-
- //create optimizer instance
- GlobalOptimizer optimizer = createGlobalOptimizer( OPTIM );
-
- //create global data flow graph
- Summary summary = new Summary();
- GDFGraph graph = GraphBuilder.constructGlobalDataFlowGraph(rtprog, summary);
- if( LOG.isDebugEnabled() ) {
- LOG.debug("EXPLAIN GDFGraph:\n" + Explain.explainGDFNodes(graph.getGraphRootNodes(),1));
- }
-
- //core global data flow optimization
- graph = optimizer.optimize(graph, summary);
-
- //get the final runtime program
- rtprog = graph.getRuntimeProgram();
-
- //print global optimizer summary
- LOG.info( summary );
-
- LOG.debug("Finished global data flow optimization in " + time.stop() + " ms.");
- return rtprog;
- }
-
- private static GlobalOptimizer createGlobalOptimizer( GlobalOptimizerType type )
- throws HopsException, DMLRuntimeException
- {
- GlobalOptimizer optimizer = null;
-
- switch( type )
- {
- case ENUMERATE_DP:
- optimizer = new GDFEnumOptimizer();
- break;
-
- //case TRANSFORM:
- // optimizer = new GlobalTransformationOptimizer(Strategy.CANONICAL);
- // ((GlobalTransformationOptimizer)optimizer).addRule(new BlockSizeRule());
- // break;
-
- default:
- throw new HopsException("Unsupported global optimizer type: "+type+".");
- }
-
- return optimizer;
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/InterestingProperties.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/InterestingProperties.java b/src/main/java/org/apache/sysml/hops/globalopt/InterestingProperties.java
deleted file mode 100644
index ce641f5..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/InterestingProperties.java
+++ /dev/null
@@ -1,115 +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.hops.globalopt;
-
-import java.util.Arrays;
-
-/**
- * An instance of this class represents one 'interesting property set' defined by the instances
- * of all interesting properties. We do not use objects per interesting property in order to
- * (1) simplify the creation and interesting property sets, and (2) prevent excessive object
- * creation and garbage collection.
- *
- */
-public class InterestingProperties
-{
-
- public enum Location {
- MEM,
- HDFS_CACHE,
- HDFS
- }
-
- public enum Format {
- ANY,
- BINARY_BLOCK,
- BINARY_CELL,
- TEXT_CELL,
- TEXT_MM,
- TEXT_CSV
- }
-
- public enum Partitioning {
- NONE,
- ROW_WISE,
- COL_WISE
- //ROW_BLOCK_WISE,
- //COL_BLOCK_WISE,
- }
-
- //supported interesting properties
- private int _blocksize = -1; //-1 for any
- private Format _format = null;
- private Location _location = null;
- private Partitioning _pformat = null;
- private int _replication = -1;
- private boolean _emptyblocks = false;
-
-
- public InterestingProperties( int blocksize, Format format, Location location, Partitioning pformat, int replication, boolean emptyblocks )
- {
- _blocksize = blocksize;
- _format = format;
- _location = location;
- _pformat = pformat;
- _replication = replication;
- _emptyblocks = emptyblocks;
- }
-
- public InterestingProperties( InterestingProperties that )
- {
- _blocksize = that._blocksize;
- _format = that._format;
- _location = that._location;
- _pformat = that._pformat;
- _replication = that._replication;
- _emptyblocks = that._emptyblocks;
- }
-
- @Override
- public boolean equals(Object o)
- {
- if( !(o instanceof InterestingProperties) )
- return false;
-
- InterestingProperties that = (InterestingProperties)o;
- return ( _blocksize == that._blocksize
- && _format == that._format
- && _location == that._location
- && _pformat == that._pformat
- && _replication == that._replication
- && _emptyblocks == that._emptyblocks );
- }
-
- @Override
- public int hashCode()
- {
- Object[] array = new Object[] { _blocksize, (_format != null) ? _format.ordinal() : -1,
- (_location != null) ? _location.ordinal() : -1, (_pformat != null) ? _pformat.ordinal() : -1,
- _replication, _emptyblocks };
- return Arrays.hashCode(array);
- }
-
- @Override
- public String toString()
- {
- return "IPS[" + _blocksize + "," + _format + "," + _location + "," + _pformat + "," + _replication + "," + _emptyblocks + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/MemoStructure.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/MemoStructure.java b/src/main/java/org/apache/sysml/hops/globalopt/MemoStructure.java
deleted file mode 100644
index 056db69..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/MemoStructure.java
+++ /dev/null
@@ -1,96 +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.hops.globalopt;
-
-import java.util.HashMap;
-import java.util.Map.Entry;
-
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode;
-
-/**
- * This MemoStructure is the central location for storing enumerated plans (configurations) and serves
- * two purposes:
- *
- * 1) Plan Memoization: Due to the DAG structure (where a single node is reachable over alternative
- * paths), our top-down, recursive optimization procedure might visit an operator multiple times.
- * The memo structure memoizes and reuses already generated plans.
- *
- * 2) config set cache
- *
- * The internal structure is as follows:
- * Memo Structure := | LONG GDFNodeID | MemoEntry | *
- * Memo Entry := | InterestingPropertySet | DOUBLE COST | *
- *
- */
-public class MemoStructure
-{
-
- private HashMap<Long, PlanSet> _entries = null; //NODEID | PLANSET
- private HashMap<Long, Long> _nodeIDs = null; //NODEID | HOPID
-
- public MemoStructure()
- {
- _entries = new HashMap<>();
- _nodeIDs = new HashMap<>();
- }
-
- ///////////////////////////////////////////////////
- // basic access to memo structure entries
-
- public boolean constainsEntry( GDFNode node )
- {
- return _entries.containsKey( node.getID() );
- }
-
- public void putEntry( GDFNode node, PlanSet entry )
- {
- _entries.put( node.getID(), entry );
- if( node.getHop()!=null )
- _nodeIDs.put( node.getID(), node.getHop().getHopID() );
- else
- _nodeIDs.put( node.getID(), -1L );
- }
-
- public PlanSet getEntry( GDFNode node )
- {
- return _entries.get( node.getID()) ;
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append("------------------------------------\n");
- sb.append("MEMO STRUCTURE (gdfnodeid, plans): \n");
- sb.append("------------------------------------\n");
-
- for( Entry<Long, PlanSet> e : _entries.entrySet() )
- {
- sb.append("------------------------------------\n");
- sb.append("Node "+e.getKey()+" (hop "+_nodeIDs.get(e.getKey())+"):\n");
- for( Plan p : e.getValue().getPlans() ) {
- sb.append(p.toString());
- sb.append("\n");
- }
- }
-
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/Plan.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/Plan.java b/src/main/java/org/apache/sysml/hops/globalopt/Plan.java
deleted file mode 100644
index d62c0fc..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/Plan.java
+++ /dev/null
@@ -1,225 +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.hops.globalopt;
-
-import java.util.ArrayList;
-
-import org.apache.sysml.hops.DataOp;
-import org.apache.sysml.hops.FunctionOp;
-import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.OptimizerUtils;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode.NodeType;
-import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.parser.Expression.DataType;
-import org.apache.sysml.runtime.controlprogram.parfor.util.IDSequence;
-
-
-public class Plan
-{
- private static IDSequence _seqID = new IDSequence();
-
- private long _ID = -1;
- private GDFNode _node = null;
-
- private InterestingProperties _ips = null;
- private RewriteConfig _conf = null;
- private ArrayList<Plan> _childs = null;
- private double _costs = -1;
-
- public Plan(GDFNode node, InterestingProperties ips, RewriteConfig rc, ArrayList<Plan> childs)
- {
- _ID = _seqID.getNextID();
- _node = node;
- _ips = ips;
- _conf = rc;
- if( childs != null && !childs.isEmpty() )
- _childs = childs;
- else
- _childs = new ArrayList<>();
- }
-
- public Plan( Plan p )
- {
- _ID = _seqID.getNextID();
- _node = p._node;
- _ips = new InterestingProperties(p._ips);
- _conf = new RewriteConfig(p._conf);
- _costs = p._costs;
-
- if( p._childs != null && !p._childs.isEmpty() )
- _childs = new ArrayList<>(p._childs);
- else
- _childs = new ArrayList<>();
- }
-
- public GDFNode getNode()
- {
- return _node;
- }
-
- public void addChild( Plan c )
- {
- _childs.add(c);
- }
-
- public ArrayList<Plan> getChilds()
- {
- return _childs;
- }
-
- public InterestingProperties getInterestingProperties()
- {
- return _ips;
- }
-
- public RewriteConfig getRewriteConfig()
- {
- return _conf;
- }
-
- public void setCosts( double costs )
- {
- _costs = costs;
- }
-
- public double getCosts()
- {
- return _costs;
- }
-
- /**
- * If operation is executed in MR, all input blocksizes need to match.
- * Note that the output blocksize can be different since we would add
- * additional reblocks after that operation.
- *
- * @return true if valid blocksizes in MR
- */
- public boolean checkValidBlocksizesInMR()
- {
- boolean ret = true;
- ExecType CLUSTER = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
-
- if( _conf.getExecType()==CLUSTER
- && _childs != null && _childs.size() > 1 )
- {
- int size0 = _childs.get(0)._conf.getBlockSize();
- if( size0 > 0 ) { //-1 compatible with everything
- for( Plan c : _childs )
- ret &= ( c._conf.getBlockSize() == size0
- ||c._conf.getBlockSize() <= 0 );
- }
- }
-
- return ret;
- }
-
- public boolean checkValidBlocksizesTRead()
- {
- boolean ret = true;
-
- if( _node.getNodeType() == NodeType.HOP_NODE
- && _node.getHop() instanceof DataOp
- && ((DataOp)_node.getHop()).getDataOpType() == DataOpTypes.TRANSIENTREAD )
- {
- for( Plan c : _childs )
- ret &= ( _conf.getBlockSize() == c._conf.getBlockSize() );
- }
-
- if( _node.getNodeType() == NodeType.CROSS_BLOCK_NODE )
- {
- for( Plan c : _childs )
- ret &= ( _conf.getBlockSize() == c._conf.getBlockSize() );
- }
-
- return ret;
- }
-
- /**
- * If operation is executed in MR, only certain operations allow
- * all formats. In general, unary operations also allow for cell inputs.
- * TODO: check and test current format assumptions
- *
- * @return true if valid format in MR
- */
- public boolean checkValidFormatInMR()
- {
- boolean ret = true;
- ExecType CLUSTER = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
-
- if( _conf.getExecType()==CLUSTER )
- {
- if( _childs != null )
- for( Plan c : _childs )
- ret &= _node.isValidInputFormatForOperation(c._conf.getFormat());
- }
-
- return ret;
- }
-
- public boolean checkValidExecutionType()
- {
- boolean ret = true;
-
- ret &= !( _node.getHop() instanceof FunctionOp && _conf.getExecType()!=ExecType.CP );
- //unnecessary, because reblock now merged into base hop
- //ret &= !( _node.getHop() instanceof ReblockOp && _conf.getExecType()!=ExecType.MR );
-
- return ret;
- }
-
- /**
- * A plan is defined as preferred if its output interesting properties
- * match the interesting properties of all its matrix inputs.
- *
- * @return true if preferred plan
- */
- public boolean isPreferredPlan()
- {
- boolean ret = true;
-
- for( Plan c : _childs )
- if( c.getNode().getDataType()==DataType.MATRIX )
- ret &= _ips.equals( c.getInterestingProperties() );
-
- return ret;
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append("PLAN("+_ID+") [");
- sb.append(_ips.toString());
- sb.append(",");
- sb.append(_conf.toString());
- sb.append(",{");
- for( Plan c : _childs ){
- sb.append(c._ID);
- sb.append(",");
- }
- sb.setLength(sb.length()-1);
- sb.append("},");
- sb.append(_costs);
- sb.append("]");
-
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/PlanSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/PlanSet.java b/src/main/java/org/apache/sysml/hops/globalopt/PlanSet.java
deleted file mode 100644
index 41ee5f9..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/PlanSet.java
+++ /dev/null
@@ -1,149 +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.hops.globalopt;
-
-import java.util.ArrayList;
-
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFCrossBlockNode;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode;
-import org.apache.sysml.hops.globalopt.gdfgraph.GDFNode.NodeType;
-
-public class PlanSet
-{
- private ArrayList<Plan> _plans = null;
-
- public PlanSet() {
- _plans = new ArrayList<>();
- }
-
- public PlanSet(ArrayList<Plan> plans)
- {
- _plans = plans;
- }
-
- public ArrayList<Plan> getPlans()
- {
- return _plans;
- }
-
- public void setPlans(ArrayList<Plan> plans)
- {
- _plans = plans;
- }
-
- public int size()
- {
- if( _plans == null )
- return 0;
-
- return _plans.size();
- }
-
- public boolean isEmpty()
- {
- if( _plans == null )
- return true;
-
- return _plans.isEmpty();
- }
-
- public PlanSet crossProductChild(PlanSet pc)
- {
- //check for empty child plan set (return current plan set)
- if( pc==null || pc.isEmpty() ) {
- return this;
- }
- //check for empty parent plan set (pass-through child)
- //(e.g., for crossblockop; this also implicitly reused costed runtime plans)
- if( _plans == null || _plans.isEmpty() ) {
- return pc;
- }
-
- ArrayList<Plan> Pnew = new ArrayList<>();
-
- // create cross product of plansets between partial and child plans
- for( Plan p : _plans )
- for( Plan c : pc.getPlans() )
- {
- Plan pnew = new Plan(p);
- pnew.addChild( c );
- Pnew.add( pnew );
- }
-
- return new PlanSet(Pnew);
- }
-
- public PlanSet selectChild( GDFNode node )
- {
- String varname = (node.getNodeType()==NodeType.HOP_NODE) ? node.getHop().getName() :
- ((GDFCrossBlockNode)node).getName();
-
- ArrayList<Plan> Pnew = new ArrayList<>();
- for( Plan p : _plans )
- if( p.getNode().getHop()!=null
- &&p.getNode().getHop().getName().equals(varname) )
- {
- Pnew.add( p );
- }
-
- return new PlanSet(Pnew);
- }
-
- public PlanSet union( PlanSet ps )
- {
- ArrayList<Plan> Pnew = new ArrayList<>(_plans);
- for( Plan p : ps._plans )
- Pnew.add( p );
-
- return new PlanSet(Pnew);
- }
-
- public Plan getPlanWithMinCosts()
- {
- //init global optimal plan and costs
- double optCosts = Double.MAX_VALUE;
- Plan optPlan = null;
-
- //compare costs of all plans
- for( Plan p : _plans ) {
- if( p.getCosts() < optCosts ) {
- optCosts = p.getCosts();
- optPlan = p;
- }
- }
-
- return optPlan;
- }
-
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append("PLAN_SET@"+super.hashCode()+":\n");
- for( Plan p : _plans ) {
- sb.append("--");
- sb.append( p.toString() );
- sb.append("\n");
- }
-
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/RewriteConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/RewriteConfig.java b/src/main/java/org/apache/sysml/hops/globalopt/RewriteConfig.java
deleted file mode 100644
index 5372451..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/RewriteConfig.java
+++ /dev/null
@@ -1,94 +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.hops.globalopt;
-
-import org.apache.sysml.hops.Hop.FileFormatTypes;
-import org.apache.sysml.hops.globalopt.InterestingProperties.Location;
-import org.apache.sysml.lops.LopProperties.ExecType;
-
-
-
-/**
- * This RewriteConfig represents an instance configuration of a particular rewrite.
- *
- */
-public class RewriteConfig
-{
-
- /*
- public enum RewriteConfigType {
- BLOCK_SIZE,
- FORMAT_CHANGE,
- EXEC_TYPE,
- DATA_PARTITIONING,
- VECTORIZATION,
- REPLICATION_FACTOR
- }
- */
-
- private ExecType _rewriteSetExecType = null;
- private int _rewriteSetBlockSize = -1;
- private FileFormatTypes _rewriteFormat = null;
-
- public RewriteConfig( ExecType et, int bs, FileFormatTypes format )
- {
- _rewriteSetExecType = et;
- _rewriteSetBlockSize = bs;
- _rewriteFormat = format;
- }
-
- public RewriteConfig( RewriteConfig rc )
- {
- _rewriteSetExecType = rc._rewriteSetExecType;
- _rewriteSetBlockSize = rc._rewriteSetBlockSize;
- _rewriteFormat = rc._rewriteFormat;
- }
-
- public ExecType getExecType()
- {
- return _rewriteSetExecType;
- }
-
- public int getBlockSize()
- {
- return _rewriteSetBlockSize;
- }
-
- public FileFormatTypes getFormat()
- {
- return _rewriteFormat;
- }
-
- public InterestingProperties deriveInterestingProperties()
- {
- int bs = _rewriteSetBlockSize;
- Location loc = (_rewriteSetExecType==ExecType.CP) ? Location.MEM : Location.HDFS;
-
- return new InterestingProperties(bs, null, loc, null, -1, true);
- }
-
-
- @Override
- public String toString()
- {
- return "RC["+_rewriteSetExecType+","+_rewriteSetBlockSize+"]";//+_type+"="+_value + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/Summary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/Summary.java b/src/main/java/org/apache/sysml/hops/globalopt/Summary.java
deleted file mode 100644
index 0ae93d3..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/Summary.java
+++ /dev/null
@@ -1,101 +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.hops.globalopt;
-
-public class Summary
-{
-
- private double _costsInitial = -1;
- private double _costsOptimal = -1;
- private long _numEnumPlans = -1;
- private long _numPrunedInvalidPlans = -1;
- private long _numPrunedSuboptPlans = -1;
- private long _numCompiledPlans = -1;
- private long _numCostedPlans = -1;
- private long _numEnumPlanMismatch = -1;
- private long _numFinalPlanMismatch = -1;
- private double _timeGDFGraph = -1;
- private double _timeOptim = -1;
-
- public void setCostsInitial(double costsInitial) {
- _costsInitial = costsInitial;
- }
-
- public void setCostsOptimal(double costsOptimal) {
- _costsOptimal = costsOptimal;
- }
-
- public void setNumEnumPlans(long numEnumPlans) {
- _numEnumPlans = numEnumPlans;
- }
-
- public void setNumPrunedInvalidPlans(long numPrunedInvalidPlans) {
- _numPrunedInvalidPlans = numPrunedInvalidPlans;
- }
-
- public void setNumPrunedSuboptPlans(long numPrunedSuboptPlans) {
- _numPrunedSuboptPlans = numPrunedSuboptPlans;
- }
-
- public void setNumCompiledPlans(long numCompiledPlans) {
- _numCompiledPlans = numCompiledPlans;
- }
-
- public void setNumCostedPlans(long numCostedPlans) {
- _numCostedPlans = numCostedPlans;
- }
-
- public void setNumEnumPlanMismatch(long numEnumPlanMismatch) {
- _numEnumPlanMismatch = numEnumPlanMismatch;
- }
-
- public void setNumFinalPlanMismatch(long numFinalPlanMismatch) {
- _numFinalPlanMismatch = numFinalPlanMismatch;
- }
-
- public void setTimeGDFGraph(double timeGDFGraph) {
- _timeGDFGraph = timeGDFGraph;
- }
-
- public void setTimeOptim(double timeOptim) {
- _timeOptim = timeOptim;
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append("\nGlobal Optimization Summary:\n");
- sb.append("-- costs of initial plan: "+_costsInitial +"\n");
- sb.append("-- costs of optimal plan: "+_costsOptimal +"\n");
- sb.append("-- # enumerated plans: "+_numEnumPlans +"\n");
- sb.append("-- # pruned invalid plans: "+_numPrunedInvalidPlans +"\n");
- sb.append("-- # pruned subopt plans: "+_numPrunedSuboptPlans +"\n");
- sb.append("-- # program compilations: "+_numCompiledPlans +"\n");
- sb.append("-- # program costings: "+_numCostedPlans +"\n");
- sb.append("-- # enum plan mismatch: "+_numEnumPlanMismatch +"\n");
- sb.append("-- # final plan mismatch: "+_numFinalPlanMismatch +"\n");
- sb.append("-- graph creation time: "+String.format("%.3f", _timeGDFGraph/1000)+" sec.\n");
- sb.append("-- optimization time: "+String.format("%.3f", _timeOptim/1000)+" sec.");
-
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFCrossBlockNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFCrossBlockNode.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFCrossBlockNode.java
deleted file mode 100644
index 52d988d..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFCrossBlockNode.java
+++ /dev/null
@@ -1,95 +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.hops.globalopt.gdfgraph;
-
-import java.util.ArrayList;
-
-import org.apache.sysml.hops.Hop;
-import org.apache.sysml.runtime.controlprogram.ProgramBlock;
-
-/**
- * Crossblock operators represent
- *
- */
-public class GDFCrossBlockNode extends GDFNode
-{
-
-
- public enum CrossBlockNodeType {
- PLAIN,
- MERGE,
- }
-
- private CrossBlockNodeType _cbtype = null;
- private String _name = null;
-
- /**
- * Constructor PLAIN crossblocknode
- *
- * @param hop high-level operator
- * @param pb program block
- * @param input GDF node
- * @param name the name
- */
- public GDFCrossBlockNode( Hop hop, ProgramBlock pb, GDFNode input, String name )
- {
- super(hop, pb, null);
- _type = NodeType.CROSS_BLOCK_NODE;
- _inputs = new ArrayList<>();
- _inputs.add( input );
-
- _cbtype = CrossBlockNodeType.PLAIN;
- _name = name;
- }
-
- /**
- * Constructor MERGE crossblocknode
- *
- * @param hop high-level operator
- * @param pb program block
- * @param input1 GDF node 1
- * @param input2 GDF node 2
- * @param name the name
- */
- public GDFCrossBlockNode( Hop hop, ProgramBlock pb, GDFNode input1, GDFNode input2, String name )
- {
- super(hop, pb, null);
- _type = NodeType.CROSS_BLOCK_NODE;
- _inputs = new ArrayList<>();
- _inputs.add( input1 );
- _inputs.add( input2 );
-
- _cbtype = CrossBlockNodeType.MERGE;
- _name = name;
- }
-
- public String getName()
- {
- return _name;
- }
-
- @Override
- public String explain(String deps)
- {
- String ldeps = (deps!=null) ? deps : "";
-
- return "CBNode "+ldeps+" ["+_name+", "+_cbtype.toString().toLowerCase()+"]";
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFGraph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFGraph.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFGraph.java
deleted file mode 100644
index 669f982..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFGraph.java
+++ /dev/null
@@ -1,49 +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.hops.globalopt.gdfgraph;
-
-import java.util.ArrayList;
-
-import org.apache.sysml.runtime.controlprogram.Program;
-
-public class GDFGraph
-{
-
-
- private ArrayList<GDFNode> _roots = null;
- private Program _rtprog = null;
-
-
- public GDFGraph( Program prog, ArrayList<GDFNode> roots )
- {
- _rtprog = prog;
- _roots = roots;
- }
-
- public ArrayList<GDFNode> getGraphRootNodes()
- {
- return _roots;
- }
-
- public Program getRuntimeProgram()
- {
- return _rtprog;
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFLoopNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFLoopNode.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFLoopNode.java
deleted file mode 100644
index 010ca1d..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFLoopNode.java
+++ /dev/null
@@ -1,66 +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.hops.globalopt.gdfgraph;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.apache.sysml.runtime.controlprogram.ProgramBlock;
-
-public class GDFLoopNode extends GDFNode
-{
-
- private GDFNode _predicate = null;
- private HashMap<String,GDFNode> _linputs = null; //all read variables
- private HashMap<String,GDFNode> _loutputs = null; //all updated variables, not necessarily liveout
-
- public GDFLoopNode( ProgramBlock pb, GDFNode predicate, HashMap<String, GDFNode> inputs, HashMap<String,GDFNode> outputs )
- {
- super(null, pb, new ArrayList<>(inputs.values()));
- _type = NodeType.LOOP_NODE;
- _predicate = predicate;
- _linputs = inputs;
- _loutputs = outputs;
- }
-
- public HashMap<String, GDFNode> getLoopInputs()
- {
- return _linputs;
- }
-
- public HashMap<String, GDFNode> getLoopOutputs()
- {
- return _loutputs;
- }
-
- public GDFNode getLoopPredicate()
- {
- return _predicate;
- }
-
- @Override
- public String explain(String deps)
- {
- String ldeps = (deps!=null) ? deps : "";
-
- //current node details
- return "LoopNode "+ldeps+" ["+_linputs.keySet().toString()+","+_loutputs.keySet().toString()+"]";
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFNode.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFNode.java
deleted file mode 100644
index e385a86..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GDFNode.java
+++ /dev/null
@@ -1,165 +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.hops.globalopt.gdfgraph;
-
-import java.util.ArrayList;
-
-import org.apache.sysml.hops.AggUnaryOp;
-import org.apache.sysml.hops.DataGenOp;
-import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.Hop.DataGenMethod;
-import org.apache.sysml.hops.Hop.Direction;
-import org.apache.sysml.hops.Hop.FileFormatTypes;
-import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.UnaryOp;
-import org.apache.sysml.hops.rewrite.HopRewriteUtils;
-import org.apache.sysml.parser.Expression.DataType;
-import org.apache.sysml.runtime.controlprogram.Program;
-import org.apache.sysml.runtime.controlprogram.ProgramBlock;
-import org.apache.sysml.runtime.controlprogram.parfor.util.IDSequence;
-
-/**
- * The reason of a custom graph structure is to unify both within DAG
- * and cross DAG enumeration. Conceptually, we would only need interesting
- * properties of transient reads and could compile locally.
- *
- * Furthermore, having a global graph structure also allows for more advanced
- * algebraic simplification rewrites because the semantics of transient read
- * inputs are always available.
- *
- */
-public class GDFNode
-{
-
- public enum NodeType{
- HOP_NODE,
- LOOP_NODE,
- CROSS_BLOCK_NODE,
- }
-
- private static IDSequence _seqID = new IDSequence();
-
- protected NodeType _type = null;
- protected long _ID = -1;
-
- //references to original program and hop dag
- protected Hop _hop = null;
- protected ProgramBlock _pb = null;
-
- //input nodes
- protected ArrayList<GDFNode> _inputs = null;
-
- public GDFNode()
- {
- _ID = _seqID.getNextID();
- }
-
- public GDFNode( Hop hop, ProgramBlock pb, ArrayList<GDFNode> inputs )
- {
- this();
- _type = NodeType.HOP_NODE;
- _hop = hop;
- _pb = pb;
- _inputs = inputs;
- }
-
- public NodeType getNodeType()
- {
- return _type;
- }
-
- public long getID()
- {
- return _ID;
- }
-
- public Hop getHop()
- {
- return _hop;
- }
-
- public ProgramBlock getProgramBlock()
- {
- return _pb;
- }
-
- public Program getProgram()
- {
- if( _pb != null )
- return _pb.getProgram();
- return null;
- }
-
- public ArrayList<GDFNode> getInputs()
- {
- return _inputs;
- }
-
- public DataType getDataType()
- {
- return _hop.getDataType();
- }
-
- /**
- * If the output or any input is a matrix we need to consider
- * MR configurations. This for examples excludes Literals or
- * any purely scalar operation.
- *
- * @return true if requires MR enumeration
- */
- public boolean requiresMREnumeration()
- {
- //general rule: MR generation required if at least one matrix input/output
- boolean ret = (_hop.getDataType() == DataType.MATRIX);
- for( Hop c : _hop.getInput() )
- ret |= (c.getDataType() == DataType.MATRIX);
-
- //special cases of CP-only operators
- if( _hop instanceof UnaryOp && ((UnaryOp)_hop).getOp()==OpOp1.CAST_AS_SCALAR ) //as.scalar
- ret = false;
- if( _hop instanceof DataGenOp && ((DataGenOp)_hop).getOp()==DataGenMethod.SINIT ) //matrix(str, )
- ret = false;
- if( _hop instanceof UnaryOp && ((UnaryOp)_hop).getOp()==OpOp1.NROW ) //nrow - meta data only
- ret = false;
- if( _hop instanceof UnaryOp && ((UnaryOp)_hop).getOp()==OpOp1.NCOL ) //ncol - meta data only
- ret = false;
-
- return ret;
- }
-
- public boolean isValidInputFormatForOperation( FileFormatTypes format )
- {
- return ( _hop instanceof UnaryOp && format!=FileFormatTypes.CSV
- || (_hop instanceof AggUnaryOp && ((AggUnaryOp)_hop).getDirection()==Direction.RowCol && format!=FileFormatTypes.CSV)
- || (HopRewriteUtils.isTransposeOperation(_hop) && format!=FileFormatTypes.CSV)
- || format==FileFormatTypes.BINARY ); //any op
- }
-
- public String explain(String deps)
- {
- String ldeps = (deps!=null) ? deps : "";
-
- //node details
- if( _hop!=null )
- return "Node "+ldeps+" ["+_hop.getHopID()+", "+_hop.getOpString()+"]";
- else
- return "Node "+ldeps+" [null]";
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GraphBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GraphBuilder.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GraphBuilder.java
deleted file mode 100644
index 923807e..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfgraph/GraphBuilder.java
+++ /dev/null
@@ -1,300 +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.hops.globalopt.gdfgraph;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.sysml.hops.DataOp;
-import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.globalopt.Summary;
-import org.apache.sysml.hops.HopsException;
-import org.apache.sysml.parser.ForStatementBlock;
-import org.apache.sysml.parser.IfStatementBlock;
-import org.apache.sysml.parser.StatementBlock;
-import org.apache.sysml.parser.WhileStatementBlock;
-import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.ForProgramBlock;
-import org.apache.sysml.runtime.controlprogram.FunctionProgramBlock;
-import org.apache.sysml.runtime.controlprogram.IfProgramBlock;
-import org.apache.sysml.runtime.controlprogram.Program;
-import org.apache.sysml.runtime.controlprogram.ProgramBlock;
-import org.apache.sysml.runtime.controlprogram.WhileProgramBlock;
-import org.apache.sysml.runtime.controlprogram.parfor.stat.Timing;
-import org.apache.sysml.utils.Explain;
-
-/**
- * GENERAL 'GDF GRAPH' STRUCTURE, by MB:
- * 1) Each hop is represented by an GDFNode
- * 2) Each loop is represented by a structured GDFLoopNode
- * 3) Transient Read/Write connections are represented via CrossBlockNodes,
- * a) type PLAIN: single input crossblocknode represents unconditional data flow
- * b) type MERGE: two inputs crossblocknode represent conditional data flow merge
- *
- * In detail, the graph builder essentially does a single pass over the entire program
- * and constructs the global data flow graph bottom up. We create crossblocknodes for
- * every transient write, loop nodes for for/while programblocks, and crossblocknodes
- * after every if programblock.
- *
- */
-public class GraphBuilder
-{
-
- private static final boolean IGNORE_UNBOUND_UPDATED_VARS = true;
-
- public static GDFGraph constructGlobalDataFlowGraph( Program prog, Summary summary )
- throws DMLRuntimeException, HopsException
- {
- Timing time = new Timing(true);
-
- HashMap<String, GDFNode> roots = new HashMap<>();
- for( ProgramBlock pb : prog.getProgramBlocks() )
- constructGDFGraph( pb, roots );
-
- //create GDF graph root nodes
- ArrayList<GDFNode> ret = new ArrayList<>();
- for( GDFNode root : roots.values() )
- if( !(root instanceof GDFCrossBlockNode) )
- ret.add(root);
-
- //create GDF graph
- GDFGraph graph = new GDFGraph(prog, ret);
-
- summary.setTimeGDFGraph(time.stop());
- return graph;
- }
-
- @SuppressWarnings("unchecked")
- private static void constructGDFGraph( ProgramBlock pb, HashMap<String, GDFNode> roots )
- throws DMLRuntimeException, HopsException
- {
- if (pb instanceof FunctionProgramBlock )
- {
- throw new DMLRuntimeException("FunctionProgramBlocks not implemented yet.");
- }
- else if (pb instanceof WhileProgramBlock)
- {
- WhileProgramBlock wpb = (WhileProgramBlock) pb;
- WhileStatementBlock wsb = (WhileStatementBlock) pb.getStatementBlock();
- //construct predicate node (conceptually sequence of from/to/incr)
- GDFNode pred = constructGDFGraph(wsb.getPredicateHops(), wpb, new HashMap<Long, GDFNode>(), roots);
- HashMap<String,GDFNode> inputs = constructLoopInputNodes(wpb, wsb, roots);
- HashMap<String,GDFNode> lroots = (HashMap<String, GDFNode>) inputs.clone();
- //process childs blocks
- for( ProgramBlock pbc : wpb.getChildBlocks() )
- constructGDFGraph(pbc, lroots);
- HashMap<String,GDFNode> outputs = constructLoopOutputNodes(wsb, lroots);
- GDFLoopNode lnode = new GDFLoopNode(wpb, pred, inputs, outputs );
- //construct crossblock nodes
- constructLoopOutputCrossBlockNodes(wsb, lnode, outputs, roots, wpb);
- }
- else if (pb instanceof IfProgramBlock)
- {
- IfProgramBlock ipb = (IfProgramBlock) pb;
- IfStatementBlock isb = (IfStatementBlock) pb.getStatementBlock();
- //construct predicate
- if( isb.getPredicateHops()!=null ) {
- Hop pred = isb.getPredicateHops();
- roots.put(pred.getName(), constructGDFGraph(pred, ipb, new HashMap<Long,GDFNode>(), roots));
- }
- //construct if and else branch separately
- HashMap<String,GDFNode> ifRoots = (HashMap<String, GDFNode>) roots.clone();
- HashMap<String,GDFNode> elseRoots = (HashMap<String, GDFNode>) roots.clone();
- for( ProgramBlock pbc : ipb.getChildBlocksIfBody() )
- constructGDFGraph(pbc, ifRoots);
- if( ipb.getChildBlocksElseBody()!=null )
- for( ProgramBlock pbc : ipb.getChildBlocksElseBody() )
- constructGDFGraph(pbc, elseRoots);
- //merge data flow roots (if no else, elseRoots refer to original roots)
- reconcileMergeIfProgramBlockOutputs(ifRoots, elseRoots, roots, ipb);
- }
- else if (pb instanceof ForProgramBlock) //incl parfor
- {
- ForProgramBlock fpb = (ForProgramBlock) pb;
- ForStatementBlock fsb = (ForStatementBlock)pb.getStatementBlock();
- //construct predicate node (conceptually sequence of from/to/incr)
- GDFNode pred = constructForPredicateNode(fpb, fsb, roots);
- HashMap<String,GDFNode> inputs = constructLoopInputNodes(fpb, fsb, roots);
- HashMap<String,GDFNode> lroots = (HashMap<String, GDFNode>) inputs.clone();
- //process childs blocks
- for( ProgramBlock pbc : fpb.getChildBlocks() )
- constructGDFGraph(pbc, lroots);
- HashMap<String,GDFNode> outputs = constructLoopOutputNodes(fsb, lroots);
- GDFLoopNode lnode = new GDFLoopNode(fpb, pred, inputs, outputs );
- //construct crossblock nodes
- constructLoopOutputCrossBlockNodes(fsb, lnode, outputs, roots, fpb);
- }
- else //last-level program block
- {
- StatementBlock sb = pb.getStatementBlock();
- ArrayList<Hop> hops = sb.getHops();
- if( hops != null )
- {
- //create new local memo structure for local dag
- HashMap<Long, GDFNode> lmemo = new HashMap<>();
- for( Hop hop : hops )
- {
- //recursively construct GDF graph for hop dag root
- GDFNode root = constructGDFGraph(hop, pb, lmemo, roots);
- if( root == null )
- throw new HopsException( "GDFGraphBuilder: failed to constuct dag root for: "+Explain.explain(hop) );
-
- //create cross block nodes for all transient writes
- if( hop instanceof DataOp && ((DataOp)hop).getDataOpType()==DataOpTypes.TRANSIENTWRITE )
- root = new GDFCrossBlockNode(hop, pb, root, hop.getName());
-
- //add GDF root node to global roots
- roots.put(hop.getName(), root);
- }
- }
-
- }
- }
-
- private static GDFNode constructGDFGraph( Hop hop, ProgramBlock pb, HashMap<Long, GDFNode> lmemo, HashMap<String, GDFNode> roots )
- {
- if( lmemo.containsKey(hop.getHopID()) )
- return lmemo.get(hop.getHopID());
-
- //process childs recursively first
- ArrayList<GDFNode> inputs = new ArrayList<>();
- for( Hop c : hop.getInput() )
- inputs.add( constructGDFGraph(c, pb, lmemo, roots) );
-
- //connect transient reads to existing roots of data flow graph
- if( hop instanceof DataOp && ((DataOp)hop).getDataOpType()==DataOpTypes.TRANSIENTREAD ){
- inputs.add(roots.get(hop.getName()));
- }
-
- //add current hop
- GDFNode gnode = new GDFNode(hop, pb, inputs);
-
- //add GDF node of updated variables to global roots (necessary for loops, where updated local
- //variables might never be bound to their logical variables names
- if( !IGNORE_UNBOUND_UPDATED_VARS ) {
- //NOTE: currently disabled because unnecessary, if no transientwrite by definition included in other transientwrite
- if( pb.getStatementBlock()!=null && pb.getStatementBlock().variablesUpdated().containsVariable(hop.getName()) ) {
- roots.put(hop.getName(), gnode);
- }
- }
-
- //memoize current node
- lmemo.put(hop.getHopID(), gnode);
-
- return gnode;
- }
-
- private static GDFNode constructForPredicateNode(ForProgramBlock fpb, ForStatementBlock fsb, HashMap<String, GDFNode> roots)
- {
- HashMap<Long, GDFNode> memo = new HashMap<>();
- GDFNode from = (fsb.getFromHops()!=null)? constructGDFGraph(fsb.getFromHops(), fpb, memo, roots) : null;
- GDFNode to = (fsb.getToHops()!=null)? constructGDFGraph(fsb.getToHops(), fpb, memo, roots) : null;
- GDFNode incr = (fsb.getIncrementHops()!=null)? constructGDFGraph(fsb.getIncrementHops(), fpb, memo, roots) : null;
- ArrayList<GDFNode> inputs = new ArrayList<>();
- inputs.add(from);
- inputs.add(to);
- inputs.add(incr);
- //TODO for predicates
- GDFNode pred = new GDFNode(null, fpb, inputs );
-
- return pred;
- }
-
- private static HashMap<String, GDFNode> constructLoopInputNodes( ProgramBlock fpb, StatementBlock fsb, HashMap<String, GDFNode> roots )
- throws DMLRuntimeException
- {
- HashMap<String, GDFNode> ret = new HashMap<>();
- Set<String> invars = fsb.variablesRead().getVariableNames();
- for( String var : invars ) {
- if( fsb.liveIn().containsVariable(var) ) {
- GDFNode node = roots.get(var);
- if( node == null )
- throw new DMLRuntimeException("GDFGraphBuilder: Non-existing input node for variable: "+var);
- ret.put(var, node);
- }
- }
-
- return ret;
- }
-
- private static HashMap<String, GDFNode> constructLoopOutputNodes( StatementBlock fsb, HashMap<String, GDFNode> roots )
- throws HopsException
- {
- HashMap<String, GDFNode> ret = new HashMap<>();
-
- Set<String> outvars = fsb.variablesUpdated().getVariableNames();
- for( String var : outvars )
- {
- GDFNode node = roots.get(var);
-
- //handle non-existing nodes
- if( node == null ) {
- if( !IGNORE_UNBOUND_UPDATED_VARS )
- throw new HopsException( "GDFGraphBuilder: failed to constuct loop output for variable: "+var );
- else
- continue; //skip unbound updated variables
- }
-
- //add existing node to loop outputs
- ret.put(var, node);
- }
-
- return ret;
- }
-
- private static void reconcileMergeIfProgramBlockOutputs( HashMap<String, GDFNode> ifRoots, HashMap<String, GDFNode> elseRoots, HashMap<String, GDFNode> roots, IfProgramBlock pb )
- {
- //merge same variable names, different data
- //( incl add new vars from if branch if node2==null)
- for( Entry<String, GDFNode> e : ifRoots.entrySet() ){
- GDFNode node1 = e.getValue();
- GDFNode node2 = elseRoots.get(e.getKey()); //original or new
- if( node1 != node2 )
- node1 = new GDFCrossBlockNode(null, pb, node1, node2, e.getKey() );
- roots.put(e.getKey(), node1);
- }
-
- //add new vars from else branch
- for( Entry<String, GDFNode> e : elseRoots.entrySet() ){
- if( !ifRoots.containsKey(e.getKey()) )
- roots.put(e.getKey(), e.getValue());
- }
- }
-
- private static void constructLoopOutputCrossBlockNodes(StatementBlock sb, GDFLoopNode loop, HashMap<String, GDFNode> loutputs, HashMap<String, GDFNode> roots, ProgramBlock pb)
- {
- //iterate over all output (updated) variables
- for( Entry<String,GDFNode> e : loutputs.entrySet() )
- {
- //create crossblocknode, if updated variable is also in liveout
- if( sb.liveOut().containsVariable(e.getKey()) ) {
- GDFCrossBlockNode node = null;
- if( roots.containsKey(e.getKey()) )
- node = new GDFCrossBlockNode(null, pb, roots.get(e.getKey()), loop, e.getKey()); //MERGE
- else
- node = new GDFCrossBlockNode(null, pb, loop, e.getKey()); //PLAIN
- roots.put(e.getKey(), node);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/b3419b09/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristic.java b/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristic.java
deleted file mode 100644
index c2a44b1..0000000
--- a/src/main/java/org/apache/sysml/hops/globalopt/gdfresolve/GDFMismatchHeuristic.java
+++ /dev/null
@@ -1,48 +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.hops.globalopt.gdfresolve;
-
-import org.apache.sysml.hops.globalopt.RewriteConfig;
-
-public abstract class GDFMismatchHeuristic
-{
-
- public enum MismatchHeuristicType {
- FIRST,
- BLOCKSIZE_OR_FIRST,
- }
-
- /**
- * Returns the name of the implementing mismatch heuristic.
- *
- * @return the name of the implementing mismatch heuristic
- */
- public abstract String getName();
-
- /**
- * Resolve the mismatch of two given rewrite configurations. This call returns true,
- * if and only if the new configuration is chosen.
- *
- * @param currRc the current rewrite config
- * @param newRc the new rewrite config
- * @return true if and only if the new configuration is chosen
- */
- public abstract boolean resolveMismatch( RewriteConfig currRc, RewriteConfig newRc );
-}
[09/10] systemml git commit: [SYSTEMML-2191] Cleanup exception
hierarchy and handling, part 1
Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/QuaternaryOp.java b/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
index 6395d6a..947f2ba 100644
--- a/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/QuaternaryOp.java
@@ -168,7 +168,7 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() == 3 || _input.size() == 4, this,
"should have arity 3 or 4 but has arity %d", _input.size());
}
@@ -194,8 +194,7 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -302,7 +301,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructCPLopsWeightedSquaredLoss(WeightsType wtype)
- throws HopsException, LopsException
{
WeightedSquaredLoss wsloss = new WeightedSquaredLoss(
getInput().get(0).constructLops(),
@@ -320,7 +318,7 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
setLops( wsloss );
}
- private Lop constructLeftFactorMRLop(Hop U, Hop V, boolean cacheU, double m1Size) throws HopsException, LopsException {
+ private Lop constructLeftFactorMRLop(Hop U, Hop V, boolean cacheU, double m1Size) {
Lop lU = null;
if (cacheU) {
// partitioning of U for read through distributed cache
@@ -349,7 +347,7 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
return lU;
}
- private Lop constructRightFactorMRLop(Hop U, Hop V, boolean cacheV, double m2Size) throws HopsException, LopsException {
+ private Lop constructRightFactorMRLop(Hop U, Hop V, boolean cacheV, double m2Size) {
Lop lV = null;
if (cacheV) {
// partitioning of V for read through distributed cache
@@ -384,7 +382,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructMRLopsWeightedSquaredLoss(WeightsType wtype)
- throws HopsException, LopsException
{
//NOTE: the common case for wsloss are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -484,7 +481,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructSparkLopsWeightedSquaredLoss(WeightsType wtype)
- throws HopsException, LopsException
{
//NOTE: the common case for wsloss are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -533,9 +529,7 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
}
- private void constructCPLopsWeightedSigmoid(WSigmoidType wtype)
- throws HopsException, LopsException
- {
+ private void constructCPLopsWeightedSigmoid(WSigmoidType wtype) {
WeightedSigmoid wsig = new WeightedSigmoid(
getInput().get(0).constructLops(),
getInput().get(1).constructLops(),
@@ -551,9 +545,7 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
setLops( wsig );
}
- private void constructMRLopsWeightedSigmoid( WSigmoidType wtype )
- throws HopsException, LopsException
- {
+ private void constructMRLopsWeightedSigmoid( WSigmoidType wtype ) {
//NOTE: the common case for wsigmoid are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
//by applying the hop rewrite for Weighted Sigmoid only if this constraint holds.
@@ -622,7 +614,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructSparkLopsWeightedSigmoid( WSigmoidType wtype )
- throws HopsException, LopsException
{
//NOTE: the common case for wsigmoid are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -671,7 +662,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructCPLopsWeightedDivMM(WDivMMType wtype)
- throws HopsException, LopsException
{
WeightedDivMM wdiv = new WeightedDivMM(
getInput().get(0).constructLops(),
@@ -690,7 +680,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructMRLopsWeightedDivMM( WDivMMType wtype )
- throws HopsException, LopsException
{
//NOTE: the common case for wdivmm are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -777,7 +766,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructSparkLopsWeightedDivMM( WDivMMType wtype )
- throws HopsException, LopsException
{
//NOTE: the common case for wdivmm are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -827,7 +815,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructCPLopsWeightedCeMM(WCeMMType wtype)
- throws HopsException, LopsException
{
WeightedCrossEntropy wcemm = new WeightedCrossEntropy(
getInput().get(0).constructLops(),
@@ -846,7 +833,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructMRLopsWeightedCeMM(WCeMMType wtype)
- throws HopsException, LopsException
{
//NOTE: the common case for wcemm are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -939,7 +925,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructSparkLopsWeightedCeMM(WCeMMType wtype)
- throws HopsException, LopsException
{
//NOTE: the common case for wcemm are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -989,7 +974,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructCPLopsWeightedUMM(WUMMType wtype)
- throws HopsException, LopsException
{
Unary.OperationTypes uop = _uop!=null ?
HopsOpOp1LopsU.get(_uop) : _sop==OpOp2.POW ?
@@ -1011,7 +995,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructMRLopsWeightedUMM( WUMMType wtype )
- throws HopsException, LopsException
{
//NOTE: the common case for wumm are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -1085,7 +1068,6 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
}
private void constructSparkLopsWeightedUMM( WUMMType wtype )
- throws HopsException, LopsException
{
//NOTE: the common case for wumm are factors U/V with a rank of 10s to 100s; the current runtime only
//supports single block outer products (U/V rank <= blocksize, i.e., 1000 by default); we enforce this
@@ -1268,13 +1250,12 @@ public class QuaternaryOp extends Hop implements MultiThreadedHop
@Override
protected ExecType optFindExecType()
- throws HopsException
- {
+ {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
- if( _etypeForced != null )
+ if( _etypeForced != null )
{
_etype = _etypeForced;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ReorgOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ReorgOp.java b/src/main/java/org/apache/sysml/hops/ReorgOp.java
index 2ac6389..b8b0139 100644
--- a/src/main/java/org/apache/sysml/hops/ReorgOp.java
+++ b/src/main/java/org/apache/sysml/hops/ReorgOp.java
@@ -87,7 +87,7 @@ public class ReorgOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
int sz = _input.size();
switch( op ) {
case TRANSPOSE:
@@ -157,7 +157,6 @@ public class ReorgOp extends Hop implements MultiThreadedHop
@Override
public Lop constructLops()
- throws HopsException, LopsException
{
//return already created lops
if( getLops() != null )
@@ -387,7 +386,6 @@ public class ReorgOp extends Hop implements MultiThreadedHop
}
private static Lop constructCPOrSparkSortLop( Hop input, Hop by, Hop desc, Hop ixret, ExecType et, boolean bSortIndInMem )
- throws HopsException, LopsException
{
Hop[] hinputs = new Hop[]{input, by, desc, ixret};
Lop[] linputs = new Lop[4];
@@ -514,13 +512,13 @@ public class ReorgOp extends Hop implements MultiThreadedHop
}
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
- if( _etypeForced != null )
+ if( _etypeForced != null )
{
_etype = _etypeForced;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/TernaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/TernaryOp.java b/src/main/java/org/apache/sysml/hops/TernaryOp.java
index 4dd4c40..1e7876a 100644
--- a/src/main/java/org/apache/sysml/hops/TernaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/TernaryOp.java
@@ -107,7 +107,7 @@ public class TernaryOp extends Hop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
int sz = _input.size();
if (_dimInputsPresent) {
// only CTABLE
@@ -147,8 +147,7 @@ public class TernaryOp extends Hop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -196,12 +195,8 @@ public class TernaryOp extends Hop
/**
* Method to construct LOPs when op = CENTRAILMOMENT.
- *
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
- private void constructLopsCentralMoment()
- throws HopsException, LopsException
+ private void constructLopsCentralMoment()
{
if ( _op != OpOp3.CENTRALMOMENT )
throw new HopsException("Unexpected operation: " + _op + ", expecting " + OpOp3.CENTRALMOMENT );
@@ -250,13 +245,8 @@ public class TernaryOp extends Hop
/**
* Method to construct LOPs when op = COVARIANCE.
- *
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
- private void constructLopsCovariance()
- throws HopsException, LopsException
- {
+ private void constructLopsCovariance() {
if ( _op != OpOp3.COVARIANCE )
throw new HopsException("Unexpected operation: " + _op + ", expecting " + OpOp3.COVARIANCE );
@@ -308,11 +298,8 @@ public class TernaryOp extends Hop
/**
* Method to construct LOPs when op = QUANTILE | INTERQUANTILE.
- *
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
- private void constructLopsQuantile() throws HopsException, LopsException {
+ private void constructLopsQuantile() {
if ( _op != OpOp3.QUANTILE && _op != OpOp3.INTERQUANTILE )
throw new HopsException("Unexpected operation: " + _op + ", expecting " + OpOp3.QUANTILE + " or " + OpOp3.INTERQUANTILE );
@@ -390,11 +377,8 @@ public class TernaryOp extends Hop
/**
* Method to construct LOPs when op = CTABLE.
- *
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
- private void constructLopsCtable() throws HopsException, LopsException {
+ private void constructLopsCtable() {
if ( _op != OpOp3.CTABLE )
throw new HopsException("Unexpected operation: " + _op + ", expecting " + OpOp3.CTABLE );
@@ -645,7 +629,6 @@ public class TernaryOp extends Hop
}
private void constructLopsTernaryDefault()
- throws HopsException, LopsException
{
ExecType et = optFindExecType();
if( getInput().stream().allMatch(h -> h.getDataType().isScalar()) )
@@ -831,8 +814,7 @@ public class TernaryOp extends Hop
@Override
protected ExecType optFindExecType()
- throws HopsException
- {
+ {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/UnaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/UnaryOp.java b/src/main/java/org/apache/sysml/hops/UnaryOp.java
index e16cb4c..a6a9d66 100644
--- a/src/main/java/org/apache/sysml/hops/UnaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/UnaryOp.java
@@ -33,7 +33,6 @@ import org.apache.sysml.lops.Data;
import org.apache.sysml.lops.Group;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.PartialAggregate;
import org.apache.sysml.lops.PartialAggregate.CorrectionLocationType;
import org.apache.sysml.lops.PickByCount;
@@ -72,7 +71,7 @@ public class UnaryOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() == 1, this, "should have arity 1 but has arity %d", _input.size());
}
@@ -126,8 +125,7 @@ public class UnaryOp extends Hop implements MultiThreadedHop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//reuse existing lop
if( getLops() != null )
return getLops();
@@ -201,7 +199,6 @@ public class UnaryOp extends Hop implements MultiThreadedHop
private Lop constructLopsMedian()
- throws HopsException, LopsException
{
ExecType et = optFindExecType();
@@ -269,7 +266,6 @@ public class UnaryOp extends Hop implements MultiThreadedHop
}
private Lop constructLopsIQM()
- throws HopsException, LopsException
{
ExecType et = optFindExecType();
@@ -380,11 +376,8 @@ public class UnaryOp extends Hop implements MultiThreadedHop
* fit into the map task memory budget) or by creating custom job types.
*
* @return low-level operator
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
private Lop constructLopsMRCumulativeUnary()
- throws HopsException, LopsException
{
Hop input = getInput().get(0);
long rlen = input.getDim1();
@@ -460,7 +453,6 @@ public class UnaryOp extends Hop implements MultiThreadedHop
}
private Lop constructLopsSparkCumulativeUnary()
- throws HopsException, LopsException
{
Hop input = getInput().get(0);
long rlen = input.getDim1();
@@ -639,15 +631,14 @@ public class UnaryOp extends Hop implements MultiThreadedHop
@Override
protected ExecType optFindExecType()
- throws HopsException
- {
+ {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
- if( _etypeForced != null )
+ if( _etypeForced != null )
{
- _etype = _etypeForced;
+ _etype = _etypeForced;
}
else
{
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java b/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
index 647a5c8..e4a6f49 100644
--- a/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
+++ b/src/main/java/org/apache/sysml/hops/codegen/SpoofCompiler.java
@@ -19,7 +19,6 @@
package org.apache.sysml.hops.codegen;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -66,14 +65,12 @@ import org.apache.sysml.hops.recompile.Recompiler;
import org.apache.sysml.hops.AggUnaryOp;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.hops.rewrite.HopRewriteUtils;
import org.apache.sysml.hops.rewrite.ProgramRewriteStatus;
import org.apache.sysml.hops.rewrite.ProgramRewriter;
import org.apache.sysml.hops.rewrite.RewriteCommonSubexpressionElimination;
import org.apache.sysml.hops.rewrite.RewriteRemoveUnnecessaryCasts;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.parser.DMLProgram;
import org.apache.sysml.parser.ForStatement;
import org.apache.sysml.parser.ForStatementBlock;
@@ -81,7 +78,6 @@ import org.apache.sysml.parser.FunctionStatement;
import org.apache.sysml.parser.FunctionStatementBlock;
import org.apache.sysml.parser.IfStatement;
import org.apache.sysml.parser.IfStatementBlock;
-import org.apache.sysml.parser.LanguageException;
import org.apache.sysml.parser.StatementBlock;
import org.apache.sysml.parser.WhileStatement;
import org.apache.sysml.parser.WhileStatementBlock;
@@ -170,9 +166,7 @@ public class SpoofCompiler
new RewriteCommonSubexpressionElimination(true),
new RewriteRemoveUnnecessaryCasts());
- public static void generateCode(DMLProgram dmlprog)
- throws LanguageException, HopsException, DMLRuntimeException
- {
+ public static void generateCode(DMLProgram dmlprog) {
// for each namespace, handle function statement blocks
for (String namespaceKey : dmlprog.getNamespaces().keySet()) {
for (String fname : dmlprog.getFunctionStatementBlocks(namespaceKey).keySet()) {
@@ -188,9 +182,7 @@ public class SpoofCompiler
}
}
- public static void generateCode(Program rtprog)
- throws LanguageException, HopsException, DMLRuntimeException, LopsException, IOException
- {
+ public static void generateCode(Program rtprog) {
// handle all function program blocks
for( FunctionProgramBlock pb : rtprog.getFunctionProgramBlocks().values() )
generateCodeFromProgramBlock(pb);
@@ -200,9 +192,7 @@ public class SpoofCompiler
generateCodeFromProgramBlock(pb);
}
- public static void generateCodeFromStatementBlock(StatementBlock current)
- throws HopsException, DMLRuntimeException
- {
+ public static void generateCodeFromStatementBlock(StatementBlock current) {
if (current instanceof FunctionStatementBlock)
{
FunctionStatementBlock fsb = (FunctionStatementBlock)current;
@@ -246,7 +236,6 @@ public class SpoofCompiler
}
public static void generateCodeFromProgramBlock(ProgramBlock current)
- throws HopsException, DMLRuntimeException, LopsException, IOException
{
if (current instanceof FunctionProgramBlock)
{
@@ -295,9 +284,7 @@ public class SpoofCompiler
}
}
- public static ArrayList<Hop> generateCodeFromHopDAGs(ArrayList<Hop> roots)
- throws HopsException, DMLRuntimeException
- {
+ public static ArrayList<Hop> generateCodeFromHopDAGs(ArrayList<Hop> roots) {
if( roots == null )
return roots;
@@ -308,17 +295,13 @@ public class SpoofCompiler
return optimized;
}
- public static ArrayList<Instruction> generateCodeFromHopDAGsToInst(StatementBlock sb, ArrayList<Hop> roots)
- throws DMLRuntimeException, HopsException, LopsException, IOException
- {
+ public static ArrayList<Instruction> generateCodeFromHopDAGsToInst(StatementBlock sb, ArrayList<Hop> roots) {
//create copy of hop dag, call codegen, and generate instructions
return Recompiler.recompileHopsDag(sb, roots,
new LocalVariableMap(), new RecompileStatus(true), false, false, 0);
}
- public static ArrayList<Instruction> generateCodeFromHopDAGsToInst(Hop root)
- throws DMLRuntimeException, HopsException, LopsException, IOException
- {
+ public static ArrayList<Instruction> generateCodeFromHopDAGsToInst(Hop root) {
//create copy of hop dag, call codegen, and generate instructions
return Recompiler.recompileHopsDag(root,
new LocalVariableMap(), new RecompileStatus(true), false, false, 0);
@@ -331,9 +314,8 @@ public class SpoofCompiler
* @param root dag root node
* @param recompile true if invoked during dynamic recompilation
* @return dag root node of modified dag
- * @throws DMLRuntimeException if optimization failed
*/
- public static Hop optimize( Hop root, boolean recompile ) throws DMLRuntimeException {
+ public static Hop optimize( Hop root, boolean recompile ) {
if( root == null )
return root;
return optimize(new ArrayList<>(
@@ -346,10 +328,8 @@ public class SpoofCompiler
* @param roots dag root nodes
* @param recompile true if invoked during dynamic recompilation
* @return dag root nodes of modified dag
- * @throws DMLRuntimeException if optimization failed
*/
public static ArrayList<Hop> optimize(ArrayList<Hop> roots, boolean recompile)
- throws DMLRuntimeException
{
if( roots == null || roots.isEmpty() )
return roots;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/codegen/SpoofFusedOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/codegen/SpoofFusedOp.java b/src/main/java/org/apache/sysml/hops/codegen/SpoofFusedOp.java
index 235aa88..07e71a9 100644
--- a/src/main/java/org/apache/sysml/hops/codegen/SpoofFusedOp.java
+++ b/src/main/java/org/apache/sysml/hops/codegen/SpoofFusedOp.java
@@ -23,12 +23,10 @@ import java.util.ArrayList;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.MultiThreadedHop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.MemoTable;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.SpoofFused;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.parser.Expression.ValueType;
@@ -70,7 +68,7 @@ public class SpoofFusedOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {}
+ public void checkArity() {}
@Override
public void setMaxNumThreads(int k) {
@@ -105,7 +103,7 @@ public class SpoofFusedOp extends Hop implements MultiThreadedHop
}
@Override
- public Lop constructLops() throws HopsException, LopsException {
+ public Lop constructLops() {
if( getLops() != null )
return getLops();
@@ -125,7 +123,7 @@ public class SpoofFusedOp extends Hop implements MultiThreadedHop
}
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/cost/CostEstimationWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/cost/CostEstimationWrapper.java b/src/main/java/org/apache/sysml/hops/cost/CostEstimationWrapper.java
index a87221f..91300e7 100644
--- a/src/main/java/org/apache/sysml/hops/cost/CostEstimationWrapper.java
+++ b/src/main/java/org/apache/sysml/hops/cost/CostEstimationWrapper.java
@@ -67,9 +67,7 @@ public class CostEstimationWrapper
}
}
- public static double getTimeEstimate(Program rtprog, ExecutionContext ec)
- throws DMLRuntimeException
- {
+ public static double getTimeEstimate(Program rtprog, ExecutionContext ec) {
Timing time = new Timing(true);
HashMap<String,VarStats> stats = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java b/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
index f09de20..37e588f 100644
--- a/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
+++ b/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
@@ -31,7 +31,6 @@ import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.parser.DMLProgram;
-import org.apache.sysml.runtime.DMLRuntimeException;
import org.apache.sysml.runtime.controlprogram.ExternalFunctionProgramBlock;
import org.apache.sysml.runtime.controlprogram.ForProgramBlock;
import org.apache.sysml.runtime.controlprogram.FunctionProgramBlock;
@@ -74,9 +73,7 @@ public abstract class CostEstimator
protected static final VarStats _unknownStats = new VarStats(1,1,-1,-1,-1,false);
protected static final VarStats _scalarStats = new VarStats(1,1,1,1,1,true);
- public double getTimeEstimate(Program rtprog, LocalVariableMap vars, HashMap<String,VarStats> stats)
- throws DMLRuntimeException
- {
+ public double getTimeEstimate(Program rtprog, LocalVariableMap vars, HashMap<String,VarStats> stats) {
double costs = 0;
//obtain stats from symboltable (e.g., during recompile)
@@ -89,9 +86,7 @@ public abstract class CostEstimator
return costs;
}
- public double getTimeEstimate(ProgramBlock pb, LocalVariableMap vars, HashMap<String,VarStats> stats, boolean recursive)
- throws DMLRuntimeException
- {
+ public double getTimeEstimate(ProgramBlock pb, LocalVariableMap vars, HashMap<String,VarStats> stats, boolean recursive) {
//obtain stats from symboltable (e.g., during recompile)
maintainVariableStatistics(vars, stats);
@@ -99,9 +94,7 @@ public abstract class CostEstimator
return rGetTimeEstimate(pb, stats, new HashSet<String>(), recursive);
}
- private double rGetTimeEstimate(ProgramBlock pb, HashMap<String,VarStats> stats, HashSet<String> memoFunc, boolean recursive)
- throws DMLRuntimeException
- {
+ private double rGetTimeEstimate(ProgramBlock pb, HashMap<String,VarStats> stats, HashSet<String> memoFunc, boolean recursive) {
double ret = 0;
if (pb instanceof WhileProgramBlock)
@@ -216,9 +209,7 @@ public abstract class CostEstimator
return ret;
}
- private static void maintainVariableStatistics( LocalVariableMap vars, HashMap<String, VarStats> stats )
- throws DMLRuntimeException
- {
+ private static void maintainVariableStatistics( LocalVariableMap vars, HashMap<String, VarStats> stats ) {
for( String varname : vars.keySet() )
{
Data dat = vars.get(varname);
@@ -308,9 +299,7 @@ public abstract class CostEstimator
}
}
- private void maintainMRJobInstVariableStatistics( Instruction inst, HashMap<String, VarStats> stats )
- throws DMLRuntimeException
- {
+ private void maintainMRJobInstVariableStatistics( Instruction inst, HashMap<String, VarStats> stats ) {
MRJobInstruction jobinst = (MRJobInstruction)inst;
//input sizes (varname, index mapping)
@@ -631,9 +620,7 @@ public abstract class CostEstimator
return OptimizerUtils.getNumIterations(pb, DEFAULT_NUMITER);
}
- protected abstract double getCPInstTimeEstimate( Instruction inst, VarStats[] vs, String[] args )
- throws DMLRuntimeException;
+ protected abstract double getCPInstTimeEstimate( Instruction inst, VarStats[] vs, String[] args );
- protected abstract double getMRJobInstTimeEstimate( Instruction inst, VarStats[] vs, String[] args )
- throws DMLRuntimeException;
+ protected abstract double getMRJobInstTimeEstimate( Instruction inst, VarStats[] vs, String[] args );
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java b/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
index 8329493..675fdf9 100644
--- a/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
+++ b/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
@@ -99,8 +99,7 @@ public class CostEstimatorStaticRuntime extends CostEstimator
@Override
@SuppressWarnings("unused")
- protected double getCPInstTimeEstimate( Instruction inst, VarStats[] vs, String[] args )
- throws DMLRuntimeException
+ protected double getCPInstTimeEstimate( Instruction inst, VarStats[] vs, String[] args )
{
CPInstruction cpinst = (CPInstruction)inst;
@@ -156,7 +155,6 @@ public class CostEstimatorStaticRuntime extends CostEstimator
@Override
protected double getMRJobInstTimeEstimate( Instruction inst, VarStats[] vs, String[] args )
- throws DMLRuntimeException
{
MRJobInstruction jinst = (MRJobInstruction) inst;
@@ -315,7 +313,6 @@ public class CostEstimatorStaticRuntime extends CostEstimator
}
private Object[] extractMRInstStatistics( String inst, VarStats[] stats )
- throws DMLRuntimeException
{
Object[] ret = new Object[2]; //stats, attrs
VarStats[] vs = new VarStats[3];
@@ -487,8 +484,7 @@ public class CostEstimatorStaticRuntime extends CostEstimator
return inIx;
}
- private byte[] getMapOutputIndexes( byte[] inIx, byte[] retIx, String rdInst, String mapInst, String shfInst, String aggInst, String otherInst )
- throws DMLRuntimeException
+ private byte[] getMapOutputIndexes( byte[] inIx, byte[] retIx, String rdInst, String mapInst, String shfInst, String aggInst, String otherInst )
{
//note: this is a simplified version of MRJobConfiguration.setUpOutputIndexesForMapper
@@ -611,9 +607,7 @@ public class CostEstimatorStaticRuntime extends CostEstimator
return Math.max(1, ret);
}
- private static int getDistcacheIndex(String inst)
- throws DMLRuntimeException
- {
+ private static int getDistcacheIndex(String inst) {
ArrayList<Byte> indexes = new ArrayList<>();
if( InstructionUtils.isDistributedCacheUsed(inst) ) {
@@ -747,15 +741,13 @@ public class CostEstimatorStaticRuntime extends CostEstimator
// Operation Costs //
/////////////////////
- private static double getInstTimeEstimate(String opcode, VarStats[] vs, String[] args, ExecType et)
- throws DMLRuntimeException
- {
+ private static double getInstTimeEstimate(String opcode, VarStats[] vs, String[] args, ExecType et) {
boolean inMR = (et == ExecType.MR);
- return getInstTimeEstimate(opcode, inMR,
- vs[0]._rlen, vs[0]._clen, (vs[0]._nnz<0)? 1.0:(double)vs[0]._nnz/vs[0]._rlen/vs[0]._clen,
- vs[1]._rlen, vs[1]._clen, (vs[1]._nnz<0)? 1.0:(double)vs[1]._nnz/vs[1]._rlen/vs[1]._clen,
- vs[2]._rlen, vs[2]._clen, (vs[2]._nnz<0)? 1.0:(double)vs[2]._nnz/vs[2]._rlen/vs[2]._clen,
- args);
+ return getInstTimeEstimate(opcode, inMR,
+ vs[0]._rlen, vs[0]._clen, (vs[0]._nnz<0)? 1.0:(double)vs[0]._nnz/vs[0]._rlen/vs[0]._clen,
+ vs[1]._rlen, vs[1]._clen, (vs[1]._nnz<0)? 1.0:(double)vs[1]._nnz/vs[1]._rlen/vs[1]._clen,
+ vs[2]._rlen, vs[2]._clen, (vs[2]._nnz<0)? 1.0:(double)vs[2]._nnz/vs[2]._rlen/vs[2]._clen,
+ args);
}
/**
@@ -777,9 +769,8 @@ public class CostEstimatorStaticRuntime extends CostEstimator
* @param d3s ?
* @param args ?
* @return estimated instruction execution time
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- private static double getInstTimeEstimate( String opcode, boolean inMR, long d1m, long d1n, double d1s, long d2m, long d2n, double d2s, long d3m, long d3n, double d3s, String[] args ) throws DMLRuntimeException
+ private static double getInstTimeEstimate( String opcode, boolean inMR, long d1m, long d1n, double d1s, long d2m, long d2n, double d2s, long d3m, long d3n, double d3s, String[] args )
{
double nflops = getNFLOP(opcode, inMR, d1m, d1n, d1s, d2m, d2n, d2s, d3m, d3n, d3s, args);
double time = nflops / DEFAULT_FLOPS;
@@ -790,8 +781,7 @@ public class CostEstimatorStaticRuntime extends CostEstimator
return time;
}
- private static double getNFLOP( String optype, boolean inMR, long d1m, long d1n, double d1s, long d2m, long d2n, double d2s, long d3m, long d3n, double d3s, String[] args )
- throws DMLRuntimeException
+ private static double getNFLOP( String optype, boolean inMR, long d1m, long d1n, double d1s, long d2m, long d2n, double d2s, long d3m, long d3n, double d3s, String[] args )
{
//operation costs in FLOP on matrix block level (for CP and MR instructions)
//(excludes IO and parallelism; assumes known dims for all inputs, outputs )
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/FunctionCallGraph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/FunctionCallGraph.java b/src/main/java/org/apache/sysml/hops/ipa/FunctionCallGraph.java
index 5105716..78cba3d 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/FunctionCallGraph.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/FunctionCallGraph.java
@@ -281,9 +281,7 @@ public class FunctionCallGraph
}
}
- private boolean rConstructFunctionCallGraph(String fkey, StatementBlock sb, Stack<String> fstack, HashSet<String> lfset)
- throws HopsException
- {
+ private boolean rConstructFunctionCallGraph(String fkey, StatementBlock sb, Stack<String> fstack, HashSet<String> lfset) {
boolean ret = false;
if (sb instanceof WhileStatementBlock) {
WhileStatement ws = (WhileStatement)sb.getStatement(0);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/FunctionCallSizeInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/FunctionCallSizeInfo.java b/src/main/java/org/apache/sysml/hops/ipa/FunctionCallSizeInfo.java
index 337f7da..2d2f658 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/FunctionCallSizeInfo.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/FunctionCallSizeInfo.java
@@ -29,7 +29,6 @@ import java.util.Set;
import org.apache.sysml.hops.FunctionOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.rewrite.HopRewriteUtils;
@@ -68,11 +67,8 @@ public class FunctionCallSizeInfo
* reachable from the main program.
*
* @param fgraph function call graph
- * @throws HopsException
*/
- public FunctionCallSizeInfo(FunctionCallGraph fgraph)
- throws HopsException
- {
+ public FunctionCallSizeInfo(FunctionCallGraph fgraph) {
this(fgraph, true);
}
@@ -82,11 +78,8 @@ public class FunctionCallSizeInfo
*
* @param fgraph function call graph
* @param init initialize function candidates
- * @throws HopsException
*/
- public FunctionCallSizeInfo(FunctionCallGraph fgraph, boolean init)
- throws HopsException
- {
+ public FunctionCallSizeInfo(FunctionCallGraph fgraph, boolean init) {
_fgraph = fgraph;
_fcand = new HashSet<>();
_fcandUnary = new HashSet<>();
@@ -212,7 +205,6 @@ public class FunctionCallSizeInfo
}
private void constructFunctionCallSizeInfo()
- throws HopsException
{
//step 1: determine function candidates by evaluating all function calls
for( String fkey : _fgraph.getReachableFunctions() ) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPass.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPass.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPass.java
index f3a4912..bb0c3c7 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPass.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPass.java
@@ -21,7 +21,6 @@ package org.apache.sysml.hops.ipa;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.DMLProgram;
/**
@@ -48,8 +47,6 @@ public abstract class IPAPass
* @param prog dml program
* @param fgraph function call graph
* @param fcallSizes function call size infos
- * @throws HopsException
*/
- public abstract void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException;
+ public abstract void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes );
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPassApplyStaticHopRewrites.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPassApplyStaticHopRewrites.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPassApplyStaticHopRewrites.java
index 57bff00..9413ba5 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPassApplyStaticHopRewrites.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPassApplyStaticHopRewrites.java
@@ -40,9 +40,7 @@ public class IPAPassApplyStaticHopRewrites extends IPAPass
}
@Override
- public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException
- {
+ public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes ) {
try {
//construct rewriter w/o checkpoint injection to avoid redundancy
ProgramRewriter rewriter = new ProgramRewriter(true, false);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPassFlagFunctionsRecompileOnce.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPassFlagFunctionsRecompileOnce.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPassFlagFunctionsRecompileOnce.java
index a552df1..4280830 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPassFlagFunctionsRecompileOnce.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPassFlagFunctionsRecompileOnce.java
@@ -50,7 +50,6 @@ public class IPAPassFlagFunctionsRecompileOnce extends IPAPass
@Override
public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException
{
if( !ConfigurationManager.isDynamicRecompilation() )
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPassInlineFunctions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPassInlineFunctions.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPassInlineFunctions.java
index 61bc895..51e3754 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPassInlineFunctions.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPassInlineFunctions.java
@@ -26,7 +26,6 @@ import java.util.List;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.FunctionOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.Hop.DataOpTypes;
import org.apache.sysml.hops.recompile.Recompiler;
@@ -52,7 +51,6 @@ public class IPAPassInlineFunctions extends IPAPass
@Override
public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException
{
//NOTE: we inline single-statement-block (i.e., last-level block) functions
//that do not contain other functions, and either are small or called once
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPassPropagateReplaceLiterals.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPassPropagateReplaceLiterals.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPassPropagateReplaceLiterals.java
index 2e4649d..4d9af5a 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPassPropagateReplaceLiterals.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPassPropagateReplaceLiterals.java
@@ -54,7 +54,6 @@ public class IPAPassPropagateReplaceLiterals extends IPAPass
@Override
public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException
{
for( String fkey : fgraph.getReachableFunctions() ) {
FunctionOp first = fgraph.getFunctionCalls(fkey).get(0);
@@ -82,7 +81,6 @@ public class IPAPassPropagateReplaceLiterals extends IPAPass
}
private void rReplaceLiterals(StatementBlock sb, LocalVariableMap constants)
- throws HopsException
{
//remove updated literals
for( String varname : sb.variablesUpdated().getVariableNames() )
@@ -120,9 +118,7 @@ public class IPAPassPropagateReplaceLiterals extends IPAPass
}
}
- private static void replaceLiterals(ArrayList<Hop> roots, LocalVariableMap constants)
- throws HopsException
- {
+ private static void replaceLiterals(ArrayList<Hop> roots, LocalVariableMap constants) {
if( roots == null )
return;
@@ -137,9 +133,7 @@ public class IPAPassPropagateReplaceLiterals extends IPAPass
}
}
- private static void replaceLiterals(Hop root, LocalVariableMap constants)
- throws HopsException
- {
+ private static void replaceLiterals(Hop root, LocalVariableMap constants) {
if( root == null )
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveConstantBinaryOps.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveConstantBinaryOps.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveConstantBinaryOps.java
index d79379b..df44961 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveConstantBinaryOps.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveConstantBinaryOps.java
@@ -26,7 +26,6 @@ import org.apache.sysml.hops.BinaryOp;
import org.apache.sysml.hops.DataGenOp;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.Hop.DataGenMethod;
import org.apache.sysml.hops.Hop.DataOpTypes;
@@ -57,9 +56,7 @@ public class IPAPassRemoveConstantBinaryOps extends IPAPass
}
@Override
- public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException
- {
+ public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes ) {
//approach: scan over top-level program (guaranteed to be unconditional),
//collect ones=matrix(1,...); remove b(*)ones if not outer operation
HashMap<String, Hop> mOnes = new HashMap<>();
@@ -99,9 +96,7 @@ public class IPAPassRemoveConstantBinaryOps extends IPAPass
}
}
- private static void rRemoveConstantBinaryOp(StatementBlock sb, HashMap<String,Hop> mOnes)
- throws HopsException
- {
+ private static void rRemoveConstantBinaryOp(StatementBlock sb, HashMap<String,Hop> mOnes) {
if( sb instanceof IfStatementBlock )
{
IfStatementBlock isb = (IfStatementBlock) sb;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnnecessaryCheckpoints.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnnecessaryCheckpoints.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnnecessaryCheckpoints.java
index 07d694e..498db64 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnnecessaryCheckpoints.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnnecessaryCheckpoints.java
@@ -28,7 +28,6 @@ import java.util.Set;
import org.apache.sysml.hops.AggUnaryOp;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.hops.UnaryOp;
import org.apache.sysml.hops.Hop.DataOpTypes;
@@ -56,9 +55,7 @@ public class IPAPassRemoveUnnecessaryCheckpoints extends IPAPass
}
@Override
- public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException
- {
+ public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes ) {
//remove unnecessary checkpoint before update
removeCheckpointBeforeUpdate(prog);
@@ -69,9 +66,7 @@ public class IPAPassRemoveUnnecessaryCheckpoints extends IPAPass
removeCheckpointReadWrite(prog);
}
- private static void removeCheckpointBeforeUpdate(DMLProgram dmlp)
- throws HopsException
- {
+ private static void removeCheckpointBeforeUpdate(DMLProgram dmlp) {
//approach: scan over top-level program (guaranteed to be unconditional),
//collect checkpoints; determine if used before update; remove first checkpoint
//on second checkpoint if update in between and not used before update
@@ -138,9 +133,7 @@ public class IPAPassRemoveUnnecessaryCheckpoints extends IPAPass
}
}
- private static void moveCheckpointAfterUpdate(DMLProgram dmlp)
- throws HopsException
- {
+ private static void moveCheckpointAfterUpdate(DMLProgram dmlp) {
//approach: scan over top-level program (guaranteed to be unconditional),
//collect checkpoints; determine if used before update; move first checkpoint
//after update if not used before update (best effort move which often avoids
@@ -210,9 +203,7 @@ public class IPAPassRemoveUnnecessaryCheckpoints extends IPAPass
}
}
- private static void removeCheckpointReadWrite(DMLProgram dmlp)
- throws HopsException
- {
+ private static void removeCheckpointReadWrite(DMLProgram dmlp) {
List<StatementBlock> sbs = dmlp.getStatementBlocks();
if (sbs.size() == 1 && !(sbs.get(0) instanceof IfStatementBlock
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnusedFunctions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnusedFunctions.java b/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnusedFunctions.java
index a4c112c..1420ca6 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnusedFunctions.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/IPAPassRemoveUnusedFunctions.java
@@ -44,9 +44,7 @@ public class IPAPassRemoveUnusedFunctions extends IPAPass
}
@Override
- public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes )
- throws HopsException
- {
+ public void rewriteProgram( DMLProgram prog, FunctionCallGraph fgraph, FunctionCallSizeInfo fcallSizes ) {
try {
Set<String> fnamespaces = prog.getNamespaces().keySet();
for( String fnspace : fnamespaces ) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java b/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
index 0a182cc..553fbb6 100644
--- a/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
+++ b/src/main/java/org/apache/sysml/hops/ipa/InterProceduralAnalysis.java
@@ -48,7 +48,6 @@ import org.apache.sysml.parser.FunctionStatement;
import org.apache.sysml.parser.FunctionStatementBlock;
import org.apache.sysml.parser.IfStatement;
import org.apache.sysml.parser.IfStatementBlock;
-import org.apache.sysml.parser.ParseException;
import org.apache.sysml.parser.StatementBlock;
import org.apache.sysml.parser.WhileStatement;
import org.apache.sysml.parser.WhileStatementBlock;
@@ -153,9 +152,8 @@ public class InterProceduralAnalysis
/**
* Main interface to perform IPA over a given DML program.
*
- * @throws HopsException in case of compilation errors
*/
- public void analyzeProgram() throws HopsException {
+ public void analyzeProgram() {
analyzeProgram(1); //single run
}
@@ -163,11 +161,8 @@ public class InterProceduralAnalysis
* Main interface to perform IPA over a given DML program.
*
* @param repetitions number of IPA rounds
- * @throws HopsException in case of compilation errors
*/
- public void analyzeProgram(int repetitions)
- throws HopsException
- {
+ public void analyzeProgram(int repetitions) {
//sanity check for valid number of repetitions
if( repetitions <= 0 )
throw new HopsException("Invalid number of IPA repetitions: " + repetitions);
@@ -221,9 +216,7 @@ public class InterProceduralAnalysis
rmFuns.rewriteProgram(_prog, graph2, null);
}
- public Set<String> analyzeSubProgram()
- throws HopsException, ParseException
- {
+ public Set<String> analyzeSubProgram() {
DMLTranslator.resetHopsDAGVisitStatus(_sb);
//get function call size infos to obtain candidates for statistics propagation
@@ -239,9 +232,7 @@ public class InterProceduralAnalysis
return fcallSizes.getValidFunctions();
}
- private boolean isUnarySizePreservingFunction(FunctionStatementBlock fsb)
- throws HopsException
- {
+ private boolean isUnarySizePreservingFunction(FunctionStatementBlock fsb) {
FunctionStatement fstmt = (FunctionStatement) fsb.getStatement(0);
//check unary functions over matrices
@@ -282,7 +273,6 @@ public class InterProceduralAnalysis
//////
private void propagateStatisticsAcrossBlock( StatementBlock sb, LocalVariableMap callVars, FunctionCallSizeInfo fcallSizes, Set<String> fnStack )
- throws HopsException
{
if (sb instanceof FunctionStatementBlock)
{
@@ -380,11 +370,8 @@ public class InterProceduralAnalysis
*
* @param roots List of HOPs.
* @param vars Map of variables eligible for propagation.
- * @throws HopsException If a HopsException occurs.
*/
- private static void propagateScalarsAcrossDAG(ArrayList<Hop> roots, LocalVariableMap vars)
- throws HopsException
- {
+ private static void propagateScalarsAcrossDAG(ArrayList<Hop> roots, LocalVariableMap vars) {
for (Hop hop : roots) {
try {
Recompiler.rReplaceLiterals(hop, vars, true);
@@ -394,9 +381,7 @@ public class InterProceduralAnalysis
}
}
- private static void propagateStatisticsAcrossPredicateDAG( Hop root, LocalVariableMap vars )
- throws HopsException
- {
+ private static void propagateStatisticsAcrossPredicateDAG( Hop root, LocalVariableMap vars ) {
if( root == null )
return;
@@ -417,11 +402,8 @@ public class InterProceduralAnalysis
*
* @param roots List of HOP DAG root nodes.
* @param vars Map of variables eligible for propagation.
- * @throws HopsException If a HopsException occurs.
*/
- private static void propagateStatisticsAcrossDAG( ArrayList<Hop> roots, LocalVariableMap vars )
- throws HopsException
- {
+ private static void propagateStatisticsAcrossDAG( ArrayList<Hop> roots, LocalVariableMap vars ) {
if( roots == null )
return;
@@ -452,11 +434,8 @@ public class InterProceduralAnalysis
* @param callVars Calling program's map of variables eligible for propagation.
* @param fcallSizes function call summary
* @param fnStack Function stack to determine current scope.
- * @throws HopsException If a HopsException occurs.
*/
- private void propagateStatisticsIntoFunctions(DMLProgram prog, ArrayList<Hop> roots, LocalVariableMap callVars, FunctionCallSizeInfo fcallSizes, Set<String> fnStack)
- throws HopsException
- {
+ private void propagateStatisticsIntoFunctions(DMLProgram prog, ArrayList<Hop> roots, LocalVariableMap callVars, FunctionCallSizeInfo fcallSizes, Set<String> fnStack) {
for( Hop root : roots )
propagateStatisticsIntoFunctions(prog, root, callVars, fcallSizes, fnStack);
}
@@ -470,10 +449,8 @@ public class InterProceduralAnalysis
* @param callVars Calling program's map of variables eligible for propagation.
* @param fcallSizes function call summary
* @param fnStack Function stack to determine current scope.
- * @throws HopsException If a HopsException occurs.
*/
private void propagateStatisticsIntoFunctions(DMLProgram prog, Hop hop, LocalVariableMap callVars, FunctionCallSizeInfo fcallSizes, Set<String> fnStack )
- throws HopsException
{
if( hop.isVisited() )
return;
@@ -535,7 +512,6 @@ public class InterProceduralAnalysis
}
private static void populateLocalVariableMapForFunctionCall( FunctionStatement fstmt, FunctionOp fop, LocalVariableMap callvars, LocalVariableMap vars, FunctionCallSizeInfo fcallSizes )
- throws HopsException
{
ArrayList<DataIdentifier> inputVars = fstmt.getInputParams();
ArrayList<Hop> inputOps = fop.getInput();
@@ -592,11 +568,8 @@ public class InterProceduralAnalysis
* @param callVars Calling program's map of variables.
* @param overwrite Whether or not to overwrite variables in the
* calling program's variable map.
- * @throws HopsException If a HopsException occurs.
*/
- private static void extractFunctionCallReturnStatistics( FunctionStatement fstmt, FunctionOp fop, LocalVariableMap tmpVars, LocalVariableMap callVars, boolean overwrite )
- throws HopsException
- {
+ private static void extractFunctionCallReturnStatistics( FunctionStatement fstmt, FunctionOp fop, LocalVariableMap tmpVars, LocalVariableMap callVars, boolean overwrite ) {
ArrayList<DataIdentifier> foutputOps = fstmt.getOutputParams();
String[] outputVars = fop.getOutputVariableNames();
String fkey = fop.getFunctionKey();
@@ -659,7 +632,6 @@ public class InterProceduralAnalysis
}
private static void extractFunctionCallUnknownReturnStatistics( FunctionStatement fstmt, FunctionOp fop, LocalVariableMap callVars )
- throws HopsException
{
ArrayList<DataIdentifier> foutputOps = fstmt.getOutputParams();
String[] outputVars = fop.getOutputVariableNames();
@@ -686,7 +658,6 @@ public class InterProceduralAnalysis
}
private static void extractFunctionCallEquivalentReturnStatistics( FunctionStatement fstmt, FunctionOp fop, LocalVariableMap callVars )
- throws HopsException
{
try {
Hop input = fop.getInput().get(0);
@@ -700,7 +671,6 @@ public class InterProceduralAnalysis
}
private static void extractExternalFunctionCallReturnStatistics( ExternalFunctionStatement fstmt, FunctionOp fop, LocalVariableMap callVars )
- throws HopsException
{
String className = fstmt.getOtherParams().get(ExternalFunctionStatement.CLASS_NAME);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java b/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
index 6c38740..de04ed9 100644
--- a/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
+++ b/src/main/java/org/apache/sysml/hops/recompile/LiteralReplacement.java
@@ -50,8 +50,7 @@ public class LiteralReplacement
private static final long REPLACE_LITERALS_MAX_MATRIX_SIZE = 1000000; //10^6 cells (8MB)
private static final boolean REPORT_LITERAL_REPLACE_OPS_STATS = true;
- protected static void rReplaceLiterals( Hop hop, LocalVariableMap vars, boolean scalarsOnly )
- throws DMLRuntimeException
+ protected static void rReplaceLiterals( Hop hop, LocalVariableMap vars, boolean scalarsOnly )
{
if( hop.isVisited() )
return;
@@ -172,8 +171,7 @@ public class LiteralReplacement
return ret;
}
- private static LiteralOp replaceLiteralValueTypeCastLiteral( Hop c, LocalVariableMap vars )
- throws DMLRuntimeException
+ private static LiteralOp replaceLiteralValueTypeCastLiteral( Hop c, LocalVariableMap vars )
{
LiteralOp ret = null;
@@ -212,8 +210,7 @@ public class LiteralReplacement
return ret;
}
- private static LiteralOp replaceLiteralDataTypeCastMatrixRead( Hop c, LocalVariableMap vars )
- throws DMLRuntimeException
+ private static LiteralOp replaceLiteralDataTypeCastMatrixRead( Hop c, LocalVariableMap vars )
{
LiteralOp ret = null;
@@ -242,7 +239,6 @@ public class LiteralReplacement
}
private static LiteralOp replaceLiteralValueTypeCastRightIndexing( Hop c, LocalVariableMap vars )
- throws DMLRuntimeException
{
LiteralOp ret = null;
@@ -284,8 +280,7 @@ public class LiteralReplacement
return ret;
}
- private static LiteralOp replaceLiteralFullUnaryAggregate( Hop c, LocalVariableMap vars )
- throws DMLRuntimeException
+ private static LiteralOp replaceLiteralFullUnaryAggregate( Hop c, LocalVariableMap vars )
{
LiteralOp ret = null;
@@ -314,8 +309,7 @@ public class LiteralReplacement
return ret;
}
- private static LiteralOp replaceLiteralFullUnaryAggregateRightIndexing( Hop c, LocalVariableMap vars )
- throws DMLRuntimeException
+ private static LiteralOp replaceLiteralFullUnaryAggregateRightIndexing( Hop c, LocalVariableMap vars )
{
LiteralOp ret = null;
@@ -374,8 +368,7 @@ public class LiteralReplacement
&& h.getInput().get(0) instanceof DataOp && vars.keySet().contains(h.getInput().get(0).getName())) );
}
- private static long getIntValueDataLiteral(Hop hop, LocalVariableMap vars)
- throws DMLRuntimeException
+ private static long getIntValueDataLiteral(Hop hop, LocalVariableMap vars)
{
long value = -1;
@@ -425,8 +418,7 @@ public class LiteralReplacement
return cdir && cop;
}
- private static double replaceUnaryAggregate( AggUnaryOp auop, MatrixBlock mb )
- throws DMLRuntimeException
+ private static double replaceUnaryAggregate( AggUnaryOp auop, MatrixBlock mb )
{
//setup stats reporting if necessary
boolean REPORT_STATS = (DMLScript.STATISTICS && REPORT_LITERAL_REPLACE_OPS_STATS);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java b/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
index ca9546f..e10e006 100644
--- a/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
+++ b/src/main/java/org/apache/sysml/hops/recompile/Recompiler.java
@@ -60,7 +60,6 @@ import org.apache.sysml.lops.CSVReBlock;
import org.apache.sysml.lops.DataGen;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.ReBlock;
import org.apache.sysml.lops.compile.Dag;
import org.apache.sysml.parser.DMLProgram;
@@ -153,7 +152,6 @@ public class Recompiler
public static ArrayList<Instruction> recompileHopsDag( StatementBlock sb, ArrayList<Hop> hops,
LocalVariableMap vars, RecompileStatus status, boolean inplace, boolean replaceLit, long tid )
- throws DMLRuntimeException, HopsException, LopsException
{
ArrayList<Instruction> newInst = null;
@@ -180,7 +178,6 @@ public class Recompiler
public static ArrayList<Instruction> recompileHopsDag( Hop hop, LocalVariableMap vars,
RecompileStatus status, boolean inplace, boolean replaceLit, long tid )
- throws DMLRuntimeException, HopsException, LopsException
{
ArrayList<Instruction> newInst = null;
@@ -202,7 +199,6 @@ public class Recompiler
}
public static ArrayList<Instruction> recompileHopsDag2Forced( StatementBlock sb, ArrayList<Hop> hops, long tid, ExecType et )
- throws DMLRuntimeException, HopsException, LopsException
{
ArrayList<Instruction> newInst = null;
@@ -225,7 +221,6 @@ public class Recompiler
}
public static ArrayList<Instruction> recompileHopsDag2Forced( Hop hop, long tid, ExecType et )
- throws DMLRuntimeException, HopsException, LopsException
{
ArrayList<Instruction> newInst = null;
@@ -248,7 +243,6 @@ public class Recompiler
}
public static ArrayList<Instruction> recompileHopsDagInstructions( StatementBlock sb, ArrayList<Hop> hops )
- throws DMLRuntimeException, HopsException, LopsException
{
ArrayList<Instruction> newInst = null;
@@ -267,7 +261,6 @@ public class Recompiler
}
public static ArrayList<Instruction> recompileHopsDagInstructions( Hop hop )
- throws DMLRuntimeException, HopsException, LopsException
{
ArrayList<Instruction> newInst = null;
@@ -301,13 +294,9 @@ public class Recompiler
* @param et given execution type
* @param tid thread id, 0 for main or before worker creation
* @return modified list of instructions
- * @throws HopsException if hop compile error
- * @throws LopsException if lop compile error
- * @throws DMLRuntimeException if runtime error on literal replacement
*/
private static ArrayList<Instruction> recompile(StatementBlock sb, ArrayList<Hop> hops, LocalVariableMap vars, RecompileStatus status,
boolean inplace, boolean replaceLit, boolean updateStats, boolean forceEt, boolean pred, ExecType et, long tid )
- throws HopsException, LopsException, DMLRuntimeException
{
// prepare hops dag for recompile
if( !inplace ){
@@ -476,13 +465,10 @@ public class Recompiler
* and better performance for recompiling individual program blocks.
*
* @param pb program block
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
* @throws IOException if IOException occurs
*/
public static void recompileProgramBlockInstructions(ProgramBlock pb)
- throws HopsException, LopsException, DMLRuntimeException, IOException
+ throws IOException
{
if( pb instanceof WhileProgramBlock )
{
@@ -547,10 +533,8 @@ public class Recompiler
*
* @param hops list of high-level operators
* @return list of high-level operators
- * @throws HopsException if HopsException occurs
*/
public static ArrayList<Hop> deepCopyHopsDag( List<Hop> hops )
- throws HopsException
{
ArrayList<Hop> ret = new ArrayList<>(hops.size());
@@ -573,11 +557,8 @@ public class Recompiler
*
* @param hops high-level operator
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
- public static Hop deepCopyHopsDag( Hop hops )
- throws HopsException
- {
+ public static Hop deepCopyHopsDag( Hop hops ) {
Hop ret = null;
try {
@@ -646,7 +627,6 @@ public class Recompiler
private static void rRecompileProgramBlock( ProgramBlock pb, LocalVariableMap vars,
RecompileStatus status, long tid, ResetType resetRecompile )
- throws HopsException, DMLRuntimeException, LopsException, IOException
{
if (pb instanceof WhileProgramBlock)
{
@@ -968,7 +948,6 @@ public class Recompiler
//helper functions for predicate recompile
private static void recompileIfPredicate( IfProgramBlock ipb, IfStatementBlock isb, LocalVariableMap vars, RecompileStatus status, long tid, ResetType resetRecompile )
- throws DMLRuntimeException, HopsException, LopsException, IOException
{
if( isb == null )
return;
@@ -986,9 +965,7 @@ public class Recompiler
}
}
- private static void recompileWhilePredicate( WhileProgramBlock wpb, WhileStatementBlock wsb, LocalVariableMap vars, RecompileStatus status, long tid, ResetType resetRecompile )
- throws DMLRuntimeException, HopsException, LopsException, IOException
- {
+ private static void recompileWhilePredicate( WhileProgramBlock wpb, WhileStatementBlock wsb, LocalVariableMap vars, RecompileStatus status, long tid, ResetType resetRecompile ) {
if( wsb == null )
return;
@@ -1005,9 +982,7 @@ public class Recompiler
}
}
- private static void recompileForPredicates( ForProgramBlock fpb, ForStatementBlock fsb, LocalVariableMap vars, RecompileStatus status, long tid, ResetType resetRecompile )
- throws DMLRuntimeException, HopsException, LopsException, IOException
- {
+ private static void recompileForPredicates( ForProgramBlock fpb, ForStatementBlock fsb, LocalVariableMap vars, RecompileStatus status, long tid, ResetType resetRecompile ) {
if( fsb != null )
{
Hop fromHops = fsb.getFromHops();
@@ -1059,9 +1034,7 @@ public class Recompiler
}
}
- private static void rRecompileProgramBlock2Forced( ProgramBlock pb, long tid, HashSet<String> fnStack, ExecType et )
- throws HopsException, DMLRuntimeException, LopsException, IOException
- {
+ private static void rRecompileProgramBlock2Forced( ProgramBlock pb, long tid, HashSet<String> fnStack, ExecType et ) {
if (pb instanceof WhileProgramBlock)
{
WhileProgramBlock pbTmp = (WhileProgramBlock)pb;
@@ -1326,7 +1299,6 @@ public class Recompiler
}
public static void rUpdateStatistics( Hop hop, LocalVariableMap vars )
- throws DMLRuntimeException
{
if( hop.isVisited() )
return;
@@ -1463,10 +1435,8 @@ public class Recompiler
* @param vars local variable map
* @param scalarsOnly if true, replace only scalar variables but no matrix operations;
* if false, apply full literal replacement
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- public static void rReplaceLiterals( Hop hop, LocalVariableMap vars, boolean scalarsOnly )
- throws DMLRuntimeException
+ public static void rReplaceLiterals( Hop hop, LocalVariableMap vars, boolean scalarsOnly )
{
//public interface
LiteralReplacement.rReplaceLiterals(hop, vars, scalarsOnly);
@@ -1496,11 +1466,10 @@ public class Recompiler
* @param inputs the inputs
* @return return true if and only if all instructions are reblock instructions and all
* individual reblock oeprations fir in the current memory budget.
- * @throws DMLRuntimeException if DMLRuntimeException occurs
* @throws IOException if IOException occurs
*/
public static boolean checkCPReblock(MRJobInstruction inst, MatrixObject[] inputs)
- throws DMLRuntimeException, IOException
+ throws IOException
{
boolean ret = true;
@@ -1622,10 +1591,8 @@ public class Recompiler
* @param ec execution context
* @param varin variable
* @return true if CP reblock?
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
public static boolean checkCPReblock(ExecutionContext ec, String varin)
- throws DMLRuntimeException
{
CacheableData<?> obj = ec.getCacheableData(varin);
MatrixCharacteristics mc = ec.getMatrixCharacteristics(varin);
@@ -1682,7 +1649,6 @@ public class Recompiler
}
public static boolean checkCPDataGen( MRJobInstruction inst, String updatedRandInst )
- throws DMLRuntimeException
{
boolean ret = true;
@@ -1748,9 +1714,7 @@ public class Recompiler
return ret;
}
- public static void executeInMemoryMatrixReblock(ExecutionContext ec, String varin, String varout)
- throws DMLRuntimeException
- {
+ public static void executeInMemoryMatrixReblock(ExecutionContext ec, String varin, String varout) {
MatrixObject in = ec.getMatrixObject(varin);
MatrixObject out = ec.getMatrixObject(varout);
@@ -1761,11 +1725,10 @@ public class Recompiler
//set output (incl update matrix characteristics)
out.acquireModify( mb );
out.release();
- in.release();
+ in.release();
}
public static void executeInMemoryFrameReblock(ExecutionContext ec, String varin, String varout)
- throws DMLRuntimeException
{
FrameObject in = ec.getFrameObject(varin);
FrameObject out = ec.getFrameObject(varout);
@@ -1777,11 +1740,10 @@ public class Recompiler
//set output (incl update matrix characteristics)
out.acquireModify( fb );
out.release();
- in.release();
+ in.release();
}
private static void tryReadMetaDataFileMatrixCharacteristics( DataOp dop )
- throws DMLRuntimeException
{
try
{
@@ -1808,8 +1770,7 @@ public class Recompiler
}
}
}
- catch(Exception ex)
- {
+ catch(Exception ex) {
throw new DMLRuntimeException(ex);
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java b/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
index ce4648a..64c63aa 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/HopDagValidator.java
@@ -47,7 +47,6 @@ public class HopDagValidator {
private HopDagValidator() {}
public static void validateHopDag(ArrayList<Hop> roots, HopRewriteRule rule)
- throws HopsException
{
if( roots == null )
return;
@@ -67,7 +66,6 @@ public class HopDagValidator {
}
public static void validateHopDag(Hop root, HopRewriteRule rule)
- throws HopsException
{
if( root == null )
return;
@@ -89,7 +87,7 @@ public class HopDagValidator {
final Set<Long> seen = new HashSet<>();
}
- private static void rValidateHop(final Hop hop, final ValidatorState state) throws HopsException {
+ private static void rValidateHop(final Hop hop, final ValidatorState state) {
final long id = hop.getHopID();
//check visit status
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteRule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteRule.java b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteRule.java
index 04d6a79..0c739cf 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteRule.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteRule.java
@@ -25,7 +25,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
/**
* Base class for all hop rewrites in order to enable generic
@@ -34,8 +33,6 @@ import org.apache.sysml.hops.HopsException;
*/
public abstract class HopRewriteRule
{
-
-
protected static final Log LOG = LogFactory.getLog(HopRewriteRule.class.getName());
/**
@@ -44,10 +41,8 @@ public abstract class HopRewriteRule
* @param roots high-level operator roots
* @param state program rewrite status
* @return list of high-level operators
- * @throws HopsException if HopsException occurs
*/
- public abstract ArrayList<Hop> rewriteHopDAGs( ArrayList<Hop> roots, ProgramRewriteStatus state )
- throws HopsException;
+ public abstract ArrayList<Hop> rewriteHopDAGs( ArrayList<Hop> roots, ProgramRewriteStatus state );
/**
* Handle a predicate hop DAG with exactly one root.
@@ -55,8 +50,6 @@ public abstract class HopRewriteRule
* @param root high-level operator root
* @param state program rewrite status
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
- public abstract Hop rewriteHopDAG( Hop root, ProgramRewriteStatus state )
- throws HopsException;
+ public abstract Hop rewriteHopDAG( Hop root, ProgramRewriteStatus state );
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
index abb1c7d..c490bbf 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
@@ -85,9 +85,7 @@ public class HopRewriteUtils
//////////////////////////////////
// literal handling
- public static boolean getBooleanValue( LiteralOp op )
- throws HopsException
- {
+ public static boolean getBooleanValue( LiteralOp op ) {
switch( op.getValueType() )
{
case DOUBLE: return op.getDoubleValue() != 0;
@@ -118,37 +116,22 @@ public class HopRewriteUtils
return false;
}
- public static double getDoubleValue( LiteralOp op )
- throws HopsException
- {
- switch( op.getValueType() )
- {
+ public static double getDoubleValue( LiteralOp op ) {
+ switch( op.getValueType() ) {
case DOUBLE: return op.getDoubleValue();
case INT: return op.getLongValue();
case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
-
default: throw new HopsException("Invalid double value: "+op.getValueType());
}
}
- public static double getDoubleValueSafe( LiteralOp op )
- {
- try
- {
- switch( op.getValueType() )
- {
- case DOUBLE: return op.getDoubleValue();
- case INT: return op.getLongValue();
- case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
-
- default: throw new HopsException("Invalid double value: "+op.getValueType());
- }
- }
- catch(Exception ex){
- //silently ignore error
+ public static double getDoubleValueSafe( LiteralOp op ) {
+ switch( op.getValueType() ) {
+ case DOUBLE: return op.getDoubleValue();
+ case INT: return op.getLongValue();
+ case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
+ default: return Double.MAX_VALUE;
}
-
- return Double.MAX_VALUE;
}
/**
@@ -159,40 +142,24 @@ public class HopRewriteUtils
* Otherwise, a safer alternative is `getDoubleValue`.
*
* @param op literal operator
- * @return long value of literator op
- * @throws HopsException if HopsException occurs
+ * @return long value of literal op
*/
- public static long getIntValue( LiteralOp op )
- throws HopsException
- {
- switch( op.getValueType() )
- {
+ public static long getIntValue( LiteralOp op ) {
+ switch( op.getValueType() ) {
case DOUBLE: return UtilFunctions.toLong(op.getDoubleValue());
case INT: return op.getLongValue();
case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
-
default: throw new HopsException("Invalid int value: "+op.getValueType());
}
}
- public static long getIntValueSafe( LiteralOp op )
- {
- try
- {
- switch( op.getValueType() )
- {
- case DOUBLE: return UtilFunctions.toLong(op.getDoubleValue());
- case INT: return op.getLongValue();
- case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
- default:
- throw new RuntimeException("Invalid int value: "+op.getValueType());
- }
- }
- catch(Exception ex){
- //silently ignore error
+ public static long getIntValueSafe( LiteralOp op ) {
+ switch( op.getValueType() ) {
+ case DOUBLE: return UtilFunctions.toLong(op.getDoubleValue());
+ case INT: return op.getLongValue();
+ case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
+ default: return Long.MAX_VALUE;
}
-
- return Long.MAX_VALUE;
}
public static boolean isLiteralOfValue( Hop hop, double val ) {
@@ -320,8 +287,7 @@ public class HopRewriteUtils
}
public static Hop createDataGenOp( Hop input, double value )
- throws HopsException
- {
+ {
Hop rows = input.rowsKnown() ? new LiteralOp(input.getDim1()) :
new UnaryOp("tmprows", DataType.SCALAR, ValueType.INT, OpOp1.NROW, input);
Hop cols = input.colsKnown() ? new LiteralOp(input.getDim2()) :
@@ -356,11 +322,9 @@ public class HopRewriteUtils
* @param scale the scale
* @param shift the shift
* @return data gen op
- * @throws HopsException if HopsException occurs
*/
public static DataGenOp copyDataGenOp( DataGenOp inputGen, double scale, double shift )
- throws HopsException
- {
+ {
HashMap<String, Integer> params = inputGen.getParamIndexMap();
Hop rows = inputGen.getInput().get(params.get(DataExpression.RAND_ROWS));
Hop cols = inputGen.getInput().get(params.get(DataExpression.RAND_COLS));
@@ -406,8 +370,7 @@ public class HopRewriteUtils
}
public static Hop createDataGenOp( Hop rowInput, Hop colInput, double value )
- throws HopsException
- {
+ {
Hop rows = rowInput.rowsKnown() ? new LiteralOp(rowInput.getDim1()) :
new UnaryOp("tmprows", DataType.SCALAR, ValueType.INT, OpOp1.NROW, rowInput);
Hop cols = colInput.colsKnown() ? new LiteralOp(colInput.getDim2()) :
@@ -436,8 +399,7 @@ public class HopRewriteUtils
}
public static Hop createDataGenOp( Hop rowInput, boolean tRowInput, Hop colInput, boolean tColInput, double value )
- throws HopsException
- {
+ {
long nrow = tRowInput ? rowInput.getDim2() : rowInput.getDim1();
long ncol = tColInput ? colInput.getDim1() : rowInput.getDim2();
@@ -469,8 +431,7 @@ public class HopRewriteUtils
}
public static Hop createDataGenOpByVal( Hop rowInput, Hop colInput, double value )
- throws HopsException
- {
+ {
Hop val = new LiteralOp(value);
HashMap<String, Hop> params = new HashMap<>();
@@ -495,7 +456,6 @@ public class HopRewriteUtils
}
public static Hop createDataGenOpByVal( ArrayList<LiteralOp> values, long rows, long cols )
- throws HopsException
{
StringBuilder sb = new StringBuilder();
for(LiteralOp lit : values) {
@@ -663,7 +623,7 @@ public class HopRewriteUtils
return ix;
}
- public static NaryOp createNary(OpOpN op, Hop... inputs) throws HopsException {
+ public static NaryOp createNary(OpOpN op, Hop... inputs) {
Hop mainInput = inputs[0];
NaryOp nop = new NaryOp(mainInput.getName(), mainInput.getDataType(),
mainInput.getValueType(), op, inputs);
@@ -673,9 +633,7 @@ public class HopRewriteUtils
return nop;
}
- public static Hop createValueHop( Hop hop, boolean row )
- throws HopsException
- {
+ public static Hop createValueHop( Hop hop, boolean row ) {
Hop ret = null;
if( row ){
ret = hop.rowsKnown() ? new LiteralOp(hop.getDim1()) :
@@ -690,15 +648,11 @@ public class HopRewriteUtils
}
- public static DataGenOp createSeqDataGenOp( Hop input )
- throws HopsException
- {
+ public static DataGenOp createSeqDataGenOp( Hop input ) {
return createSeqDataGenOp(input, true);
}
- public static DataGenOp createSeqDataGenOp( Hop input, boolean asc )
- throws HopsException
- {
+ public static DataGenOp createSeqDataGenOp( Hop input, boolean asc ) {
Hop to = input.rowsKnown() ? new LiteralOp(input.getDim1()) :
new UnaryOp("tmprows", DataType.SCALAR, ValueType.INT, OpOp1.NROW, input);
@@ -858,7 +812,6 @@ public class HopRewriteUtils
}
public static boolean isEqualValue( LiteralOp hop1, LiteralOp hop2 )
- throws HopsException
{
//check for string (no defined double value)
if( hop1.getValueType()==ValueType.STRING
@@ -1187,15 +1140,12 @@ public class HopRewriteUtils
return ret;
}
- public static Hop getBasic1NSequenceMax(Hop hop)
- throws HopsException
- {
+ public static Hop getBasic1NSequenceMax(Hop hop) {
if( isDataGenOp(hop, DataGenMethod.SEQ) ) {
DataGenOp dgop = (DataGenOp) hop;
return dgop.getInput()
.get(dgop.getParamIndex(Statement.SEQ_TO));
}
-
throw new HopsException("Failed to retrieve 'to' argument from basic 1-N sequence.");
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/ProgramRewriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/ProgramRewriter.java b/src/main/java/org/apache/sysml/hops/rewrite/ProgramRewriter.java
index 65687e3..eb7d23c 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/ProgramRewriter.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/ProgramRewriter.java
@@ -27,7 +27,6 @@ import org.apache.log4j.Logger;
import org.apache.sysml.conf.CompilerConfig.ConfigType;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.parser.DMLProgram;
import org.apache.sysml.parser.ForStatement;
@@ -36,7 +35,6 @@ import org.apache.sysml.parser.FunctionStatement;
import org.apache.sysml.parser.FunctionStatementBlock;
import org.apache.sysml.parser.IfStatement;
import org.apache.sysml.parser.IfStatementBlock;
-import org.apache.sysml.parser.LanguageException;
import org.apache.sysml.parser.ParForStatementBlock;
import org.apache.sysml.parser.StatementBlock;
import org.apache.sysml.parser.WhileStatement;
@@ -189,13 +187,11 @@ public class ProgramRewriter
_sbRuleSet.removeIf(r -> r.getClass().equals(clazz));
}
- public ProgramRewriteStatus rewriteProgramHopDAGs(DMLProgram dmlp) throws LanguageException, HopsException {
+ public ProgramRewriteStatus rewriteProgramHopDAGs(DMLProgram dmlp) {
return rewriteProgramHopDAGs(dmlp, true);
}
- public ProgramRewriteStatus rewriteProgramHopDAGs(DMLProgram dmlp, boolean splitDags)
- throws LanguageException, HopsException
- {
+ public ProgramRewriteStatus rewriteProgramHopDAGs(DMLProgram dmlp, boolean splitDags) {
ProgramRewriteStatus state = new ProgramRewriteStatus();
// for each namespace, handle function statement blocks
@@ -219,9 +215,7 @@ public class ProgramRewriter
return state;
}
- public void rRewriteStatementBlockHopDAGs(StatementBlock current, ProgramRewriteStatus state)
- throws LanguageException, HopsException
- {
+ public void rRewriteStatementBlockHopDAGs(StatementBlock current, ProgramRewriteStatus state) {
//ensure robustness for calls from outside
if( state == null )
state = new ProgramRewriteStatus();
@@ -267,9 +261,7 @@ public class ProgramRewriter
}
}
- public ArrayList<Hop> rewriteHopDAG(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAG(ArrayList<Hop> roots, ProgramRewriteStatus state) {
for( HopRewriteRule r : _dagRuleSet ) {
Hop.resetVisitStatus( roots ); //reset for each rule
roots = r.rewriteHopDAGs(roots, state);
@@ -279,9 +271,7 @@ public class ProgramRewriter
return roots;
}
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return null;
@@ -294,9 +284,7 @@ public class ProgramRewriter
return root;
}
- public ArrayList<StatementBlock> rRewriteStatementBlocks(ArrayList<StatementBlock> sbs, ProgramRewriteStatus status, boolean splitDags)
- throws HopsException
- {
+ public ArrayList<StatementBlock> rRewriteStatementBlocks(ArrayList<StatementBlock> sbs, ProgramRewriteStatus status, boolean splitDags) {
//ensure robustness for calls from outside
if( status == null )
status = new ProgramRewriteStatus();
@@ -323,9 +311,7 @@ public class ProgramRewriter
return sbs;
}
- public ArrayList<StatementBlock> rRewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus status, boolean splitDags)
- throws HopsException
- {
+ public ArrayList<StatementBlock> rRewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus status, boolean splitDags) {
ArrayList<StatementBlock> ret = new ArrayList<>();
ret.add(sb);
[08/10] systemml git commit: [SYSTEMML-2191] Cleanup exception
hierarchy and handling, part 1
Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
index 89e2146..ae5bda3 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationDynamic.java
@@ -38,7 +38,6 @@ import org.apache.sysml.hops.Hop.OpOp3;
import org.apache.sysml.hops.Hop.OpOp4;
import org.apache.sysml.hops.Hop.ParamBuiltinOp;
import org.apache.sysml.hops.Hop.ReOrgOp;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.IndexingOp;
import org.apache.sysml.hops.LeftIndexingOp;
import org.apache.sysml.hops.LiteralOp;
@@ -87,9 +86,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
private static OpOp2[] LOOKUP_VALID_WUMM_BINARY = new OpOp2[]{OpOp2.MULT, OpOp2.POW};
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( roots == null )
return roots;
@@ -107,9 +104,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return root;
@@ -133,10 +128,8 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
*
* @param hop high-level operator
* @param descendFirst true if recursively process children first
- * @throws HopsException if HopsException occurs
*/
private void rule_AlgebraicSimplification(Hop hop, boolean descendFirst)
- throws HopsException
{
if(hop.isVisited())
return;
@@ -207,7 +200,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop removeEmptyRightIndexing(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi instanceof IndexingOp && hi.getDataType()==DataType.MATRIX ) //indexing op
{
@@ -245,7 +237,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop removeEmptyLeftIndexing(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi instanceof LeftIndexingOp && hi.getDataType() == DataType.MATRIX ) //left indexing op
{
@@ -449,7 +440,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
return hi;
}
- private static Hop removeUnnecessaryIfElseOperation(Hop parent, Hop hi, int pos) throws HopsException
+ private static Hop removeUnnecessaryIfElseOperation(Hop parent, Hop hi, int pos)
{
if( !HopRewriteUtils.isTernary(hi, OpOp3.IFELSE) )
return hi;
@@ -530,9 +521,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
@SuppressWarnings("unchecked")
- private static Hop simplifyColwiseAggregate( Hop parent, Hop hi, int pos )
- throws HopsException
- {
+ private static Hop simplifyColwiseAggregate( Hop parent, Hop hi, int pos ) {
if( hi instanceof AggUnaryOp )
{
AggUnaryOp uhi = (AggUnaryOp)hi;
@@ -594,9 +583,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
@SuppressWarnings("unchecked")
- private static Hop simplifyRowwiseAggregate( Hop parent, Hop hi, int pos )
- throws HopsException
- {
+ private static Hop simplifyRowwiseAggregate( Hop parent, Hop hi, int pos ) {
if( hi instanceof AggUnaryOp )
{
AggUnaryOp uhi = (AggUnaryOp)hi;
@@ -661,7 +648,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyColSumsMVMult( Hop parent, Hop hi, int pos )
- throws HopsException
{
//colSums(X*Y) -> t(Y) %*% X, if Y col vector; additional transpose later
//removed by other rewrite if unnecessary, i.e., if Y==t(Z)
@@ -697,7 +683,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyRowSumsMVMult( Hop parent, Hop hi, int pos )
- throws HopsException
{
//rowSums(X * Y) -> X %*% t(Y), if Y row vector; additional transpose later
//removed by other rewrite if unnecessary, i.e., if Y==t(Z)
@@ -733,7 +718,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyUnnecessaryAggregate(Hop parent, Hop hi, int pos)
- throws HopsException
{
//e.g., sum(X) -> as.scalar(X) if 1x1 (applies to sum, min, max, prod, trace)
if( hi instanceof AggUnaryOp && ((AggUnaryOp)hi).getDirection()==Direction.RowCol )
@@ -760,7 +744,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyEmptyAggregate(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi instanceof AggUnaryOp )
{
@@ -790,7 +773,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyEmptyUnaryOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi instanceof UnaryOp )
{
@@ -815,7 +797,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyEmptyReorgOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi instanceof ReorgOp )
{
@@ -857,7 +838,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyEmptySortOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
//order(X, indexreturn=FALSE) -> matrix(0,nrow(X),1)
//order(X, indexreturn=TRUE) -> seq(1,nrow(X),1)
@@ -895,9 +875,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
return hi;
}
- private static Hop simplifyEmptyMatrixMult(Hop parent, Hop hi, int pos)
- throws HopsException
- {
+ private static Hop simplifyEmptyMatrixMult(Hop parent, Hop hi, int pos) {
if( HopRewriteUtils.isMatrixMultiply(hi) ) //X%*%Y -> matrix(0, )
{
Hop left = hi.getInput().get(0);
@@ -919,7 +897,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyIdentityRepMatrixMult(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( HopRewriteUtils.isMatrixMultiply(hi) ) //X%*%Y -> X, if y is matrix(1,1,1)
{
@@ -942,7 +919,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyScalarMatrixMult(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( HopRewriteUtils.isMatrixMultiply(hi) ) //X%*%Y
{
@@ -981,7 +957,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyMatrixMultDiag(Hop parent, Hop hi, int pos)
- throws HopsException
{
Hop hnew = null;
@@ -1233,10 +1208,8 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
private static Hop simplifyWeightedSquaredLoss(Hop parent, Hop hi, int pos)
- throws HopsException
{
//NOTE: there might be also a general simplification without custom operator
//via (X-UVt)^2 -> X^2 - 2X*UVt + UVt^2
@@ -1424,7 +1397,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyWeightedSigmoidMMChains(Hop parent, Hop hi, int pos)
- throws HopsException
{
Hop hnew = null;
@@ -1559,9 +1531,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
return hi;
}
- private static Hop simplifyWeightedDivMM(Hop parent, Hop hi, int pos)
- throws HopsException
- {
+ private static Hop simplifyWeightedDivMM(Hop parent, Hop hi, int pos) {
Hop hnew = null;
boolean appliedPattern = false;
@@ -1875,7 +1845,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyWeightedCrossEntropy(Hop parent, Hop hi, int pos)
- throws HopsException
{
Hop hnew = null;
boolean appliedPattern = false;
@@ -1951,9 +1920,7 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
return hi;
}
- private static Hop simplifyWeightedUnaryMM(Hop parent, Hop hi, int pos)
- throws HopsException
- {
+ private static Hop simplifyWeightedUnaryMM(Hop parent, Hop hi, int pos) {
Hop hnew = null;
boolean appliedPattern = false;
@@ -2103,11 +2070,8 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
- private static Hop simplifyDotProductSum(Hop parent, Hop hi, int pos)
- throws HopsException
- {
+ private static Hop simplifyDotProductSum(Hop parent, Hop hi, int pos) {
//sum(v^2)/sum(v1*v2) --> as.scalar(t(v)%*%v) in order to exploit tsmm vector dotproduct
//w/o materialization of intermediates
if( hi instanceof AggUnaryOp && ((AggUnaryOp)hi).getOp()==AggOp.SUM //sum
@@ -2176,11 +2140,8 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
* @param pos Position of hi in parent's list of inputs.
*
* @return Either hi or the rewritten HOP replacing it.
- *
- * @throws HopsException if HopsException occurs
*/
- private static Hop fuseSumSquared(Hop parent, Hop hi, int pos)
- throws HopsException {
+ private static Hop fuseSumSquared(Hop parent, Hop hi, int pos) {
// if SUM
if (hi instanceof AggUnaryOp && ((AggUnaryOp) hi).getOp() == AggOp.SUM) {
Hop sumInput = hi.getInput().get(0);
@@ -2267,7 +2228,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyEmptyBinaryOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi instanceof BinaryOp ) //b(?) X Y
{
@@ -2347,11 +2307,9 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
@SuppressWarnings("unchecked")
private static Hop reorderMinusMatrixMult(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( HopRewriteUtils.isMatrixMultiply(hi) ) //X%*%Y
{
@@ -2486,7 +2444,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyScalarMVBinaryOperation(Hop hi)
- throws HopsException
{
if( hi instanceof BinaryOp && ((BinaryOp)hi).supportsMatrixScalarOperations() //e.g., X * s
&& hi.getInput().get(0).getDataType()==DataType.MATRIX
@@ -2509,7 +2466,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyNnzComputation(Hop parent, Hop hi, int pos)
- throws HopsException
{
//sum(ppred(X,0,"!=")) -> literal(nnz(X)), if nnz known
if( hi instanceof AggUnaryOp && ((AggUnaryOp)hi).getOp()==AggOp.SUM //sum
@@ -2544,7 +2500,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyNrowNcolComputation(Hop parent, Hop hi, int pos)
- throws HopsException
{
//nrow(X) -> literal(nrow(X)), ncol(X) -> literal(ncol(X)), if respective dims known
//(this rewrite aims to remove unnecessary data dependencies to X which trigger computation
@@ -2573,7 +2528,6 @@ public class RewriteAlgebraicSimplificationDynamic extends HopRewriteRule
}
private static Hop simplifyTableSeqExpand(Hop parent, Hop hi, int pos)
- throws HopsException
{
//pattern: table(seq(1,nrow(v)), v, nrow(v), m) -> rexpand(v, max=m, dir=row, ignore=false, cast=true)
//note: this rewrite supports both left/right sequence
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
index 3a3235d..a75167c 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java
@@ -41,7 +41,6 @@ import org.apache.sysml.hops.Hop.OpOp3;
import org.apache.sysml.hops.Hop.OpOpN;
import org.apache.sysml.hops.Hop.ParamBuiltinOp;
import org.apache.sysml.hops.Hop.ReOrgOp;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.NaryOp;
import org.apache.sysml.hops.OptimizerUtils;
@@ -82,7 +81,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
@Override
public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
{
if( roots == null )
return roots;
@@ -102,7 +100,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
@Override
public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
{
if( root == null )
return root;
@@ -127,10 +124,8 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
*
* @param hop high-level operator
* @param descendFirst if process children recursively first
- * @throws HopsException if HopsException occurs
*/
private void rule_AlgebraicSimplification(Hop hop, boolean descendFirst)
- throws HopsException
{
if(hop.isVisited())
return;
@@ -260,10 +255,8 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
private static Hop removeUnnecessaryBinaryOperation( Hop parent, Hop hi, int pos )
- throws HopsException
{
if( hi instanceof BinaryOp )
{
@@ -348,11 +341,9 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
*
* @param hi high-order operation
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
@SuppressWarnings("incomplete-switch")
private static Hop fuseDatagenAndBinaryOperation( Hop hi )
- throws HopsException
{
if( hi instanceof BinaryOp )
{
@@ -480,7 +471,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop fuseDatagenAndMinusOperation( Hop hi )
- throws HopsException
{
if( hi instanceof BinaryOp )
{
@@ -530,7 +520,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop foldMultipleAppendOperations(Hop hi)
- throws HopsException
{
if( hi.getDataType().isMatrix() //no string appends or frames
&& (HopRewriteUtils.isBinary(hi, OpOp2.CBIND, OpOp2.RBIND)
@@ -588,10 +577,8 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
private static Hop simplifyBinaryToUnaryOperation( Hop parent, Hop hi, int pos )
- throws HopsException
{
if( hi instanceof BinaryOp )
{
@@ -648,10 +635,8 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
*
* @param hi high-level operator
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
private static Hop canonicalizeMatrixMultScalarAdd( Hop hi )
- throws HopsException
{
//pattern: binary operation (+ or -) of matrix mult and scalar
if( hi instanceof BinaryOp )
@@ -684,7 +669,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop simplifyCTableWithConstMatrixInputs( Hop hi )
- throws HopsException
{
//pattern: table(X, matrix(1,...), matrix(7, ...)) -> table(X, 1, 7)
if( HopRewriteUtils.isTernary(hi, OpOp3.CTABLE) ) {
@@ -711,10 +695,8 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
private static Hop simplifyReverseOperation( Hop parent, Hop hi, int pos )
- throws HopsException
{
if( hi instanceof AggBinaryOp
&& hi.getInput().get(0) instanceof TernaryOp )
@@ -970,7 +952,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop simplifyBinaryMatrixScalarOperation( Hop parent, Hop hi, int pos )
- throws HopsException
{
// Note: This rewrite is not applicable for all binary operations because some of them
// are undefined over scalars. We explicitly exclude potential conflicting matrix-scalar binary
@@ -1083,7 +1064,7 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
return hi;
}
- private static Hop pushdownSumBinaryMult(Hop parent, Hop hi, int pos ) throws HopsException {
+ private static Hop pushdownSumBinaryMult(Hop parent, Hop hi, int pos ) {
//pattern: sum(lamda*X) -> lamda*sum(X)
if( hi instanceof AggUnaryOp && ((AggUnaryOp)hi).getDirection()==Direction.RowCol
&& ((AggUnaryOp)hi).getOp()==Hop.AggOp.SUM // only one parent which is the sum
@@ -1173,10 +1154,8 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
* @param parent parent high-level operator
* @param hi high-level operator
* @param pos position
- * @throws HopsException if HopsException occurs
*/
private static Hop fuseBinarySubDAGToUnaryOperation( Hop parent, Hop hi, int pos )
- throws HopsException
{
if( hi instanceof BinaryOp )
{
@@ -1361,7 +1340,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop simplifySlicedMatrixMult(Hop parent, Hop hi, int pos)
- throws HopsException
{
//e.g., (X%*%Y)[1,1] -> X[1,] %*% Y[,1]
if( hi instanceof IndexingOp
@@ -1402,7 +1380,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop simplifyConstantSort(Hop parent, Hop hi, int pos)
- throws HopsException
{
//order(matrix(7), indexreturn=FALSE) -> matrix(7)
//order(matrix(7), indexreturn=TRUE) -> seq(1,nrow(X),1)
@@ -1441,7 +1418,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop simplifyOrderedSort(Hop parent, Hop hi, int pos)
- throws HopsException
{
//order(seq(2,N+1,1), indexreturn=FALSE) -> matrix(7)
//order(seq(2,N+1,1), indexreturn=TRUE) -> seq(1,N,1)/seq(N,1,-1)
@@ -1486,7 +1462,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop fuseOrderOperationChain(Hop hi)
- throws HopsException
{
//order(order(X,2),1) -> order(X, (12)),
if( HopRewriteUtils.isReorg(hi, ReOrgOp.SORT)
@@ -1550,10 +1525,8 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
private static Hop simplifyTransposeAggBinBinaryChains(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( HopRewriteUtils.isTransposeOperation(hi)
&& hi.getInput().get(0) instanceof BinaryOp //basic binary
@@ -1588,7 +1561,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
// Patterns: X + (X==0) * s -> replace(X, 0, s)
private static Hop simplifyReplaceZeroOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( HopRewriteUtils.isBinary(hi, OpOp2.PLUS) && hi.getInput().get(0).isMatrix()
&& HopRewriteUtils.isBinary(hi.getInput().get(1), OpOp2.MULT)
@@ -1641,7 +1613,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop removeUnnecessaryMinus(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi.getDataType() == DataType.MATRIX && hi instanceof BinaryOp
&& ((BinaryOp)hi).getOp()==OpOp2.MINUS //first minus
@@ -1696,7 +1667,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop fuseMinusNzBinaryOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
//pattern X - (s * ppred(X,0,!=)) -> X -nz s
//note: this is done as a hop rewrite in order to significantly reduce the
@@ -1730,7 +1700,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop fuseLogNzUnaryOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
//pattern ppred(X,0,"!=")*log(X) -> log_nz(X)
//note: this is done as a hop rewrite in order to significantly reduce the
@@ -1762,7 +1731,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop fuseLogNzBinaryOperation(Hop parent, Hop hi, int pos)
- throws HopsException
{
//pattern ppred(X,0,"!=")*log(X,0.5) -> log_nz(X,0.5)
//note: this is done as a hop rewrite in order to significantly reduce the
@@ -1795,7 +1763,6 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
}
private static Hop simplifyOuterSeqExpand(Hop parent, Hop hi, int pos)
- throws HopsException
{
//pattern: outer(v, t(seq(1,m)), "==") -> rexpand(v, max=m, dir=row, ignore=true, cast=false)
//note: this rewrite supports both left/right sequence
@@ -1848,11 +1815,9 @@ public class RewriteAlgebraicSimplificationStatic extends HopRewriteRule
* @param hi high-level operator
* @param pos position
* @return high-level operator
- * @throws HopsException if HopsException occurs
*/
@SuppressWarnings("unused")
private static Hop removeUnecessaryPPred(Hop parent, Hop hi, int pos)
- throws HopsException
{
if( hi instanceof BinaryOp )
{
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
index 245a333..2c102cc 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteBlockSizeAndReblock.java
@@ -43,7 +43,6 @@ public class RewriteBlockSizeAndReblock extends HopRewriteRule
@Override
public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
{
if( roots == null )
return null;
@@ -61,7 +60,6 @@ public class RewriteBlockSizeAndReblock extends HopRewriteRule
@Override
public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
{
if( root == null )
return null;
@@ -77,7 +75,6 @@ public class RewriteBlockSizeAndReblock extends HopRewriteRule
}
private void rule_BlockSizeAndReblock(Hop hop, final int blocksize)
- throws HopsException
{
// Go to the source(s) of the DAG
for (Hop hi : hop.getInput()) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
index f8d812a..686c563 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCommonSubexpressionElimination.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
/**
@@ -51,7 +50,6 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
@Override
public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
{
if( roots == null )
return null;
@@ -63,7 +61,7 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
int cseMerged = 0;
if( _mergeLeafs ) {
cseMerged += rule_CommonSubexpressionElimination_MergeLeafs(h, dataops, literalops);
- h.resetVisitStatus();
+ h.resetVisitStatus();
}
cseMerged += rule_CommonSubexpressionElimination(h);
@@ -76,7 +74,6 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
@Override
public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
{
if( root == null )
return null;
@@ -97,7 +94,6 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
}
private int rule_CommonSubexpressionElimination_MergeLeafs( Hop hop, HashMap<String, Hop> dataops, HashMap<String, Hop> literalops )
- throws HopsException
{
int ret = 0;
if( hop.isVisited() )
@@ -159,7 +155,6 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
}
private int rule_CommonSubexpressionElimination( Hop hop )
- throws HopsException
{
int ret = 0;
if( hop.isVisited() )
@@ -219,5 +214,4 @@ public class RewriteCommonSubexpressionElimination extends HopRewriteRule
return ret;
}
-
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
index b24a178..ff310dd 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteCompressedReblock.java
@@ -29,7 +29,6 @@ import org.apache.sysml.conf.DMLConfig;
import org.apache.sysml.hops.AggBinaryOp;
import org.apache.sysml.hops.FunctionOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.hops.Hop.AggOp;
import org.apache.sysml.hops.Hop.DataOpTypes;
@@ -69,7 +68,6 @@ public class RewriteCompressedReblock extends StatementBlockRewriteRule
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus sate)
- throws HopsException
{
//check for inapplicable statement blocks
if( !HopRewriteUtils.isLastLevelStatementBlock(sb)
@@ -92,15 +90,11 @@ public class RewriteCompressedReblock extends StatementBlockRewriteRule
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate)
- throws HopsException
- {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
- private static void injectCompressionDirective(Hop hop, CompressConfig compress, DMLProgram prog)
- throws HopsException
- {
+ private static void injectCompressionDirective(Hop hop, CompressConfig compress, DMLProgram prog) {
if( hop.isVisited() || hop.requiresCompression() )
return;
@@ -122,9 +116,7 @@ public class RewriteCompressedReblock extends StatementBlockRewriteRule
&& hop.getDim1() > 1 && hop.getDim2() > 1; //multi-column matrix
}
- private static boolean satisfiesAutoCompressionCondition(Hop hop, DMLProgram prog)
- throws HopsException
- {
+ private static boolean satisfiesAutoCompressionCondition(Hop hop, DMLProgram prog) {
//check for basic compression condition
if( !(satisfiesCompressionCondition(hop)
&& OptimizerUtils.isSparkExecutionMode()) )
@@ -169,7 +161,6 @@ public class RewriteCompressedReblock extends StatementBlockRewriteRule
}
private static void rAnalyzeProgram(StatementBlock sb, ProbeStatus status)
- throws HopsException
{
if(sb instanceof FunctionStatementBlock) {
FunctionStatementBlock fsb = (FunctionStatementBlock) sb;
@@ -216,7 +207,6 @@ public class RewriteCompressedReblock extends StatementBlockRewriteRule
}
private static void rAnalyzeHopDag(Hop current, ProbeStatus status)
- throws HopsException
{
if( current.isVisited() )
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
index 7684c78..9a1e76d 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java
@@ -19,7 +19,6 @@
package org.apache.sysml.hops.rewrite;
-import java.io.IOException;
import java.util.ArrayList;
import org.apache.sysml.conf.ConfigurationManager;
@@ -34,10 +33,8 @@ import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.UnaryOp;
import org.apache.sysml.hops.recompile.Recompiler;
import org.apache.sysml.lops.Lop;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.compile.Dag;
import org.apache.sysml.parser.Expression.DataType;
-import org.apache.sysml.runtime.DMLRuntimeException;
import org.apache.sysml.runtime.controlprogram.Program;
import org.apache.sysml.runtime.controlprogram.ProgramBlock;
import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
@@ -62,39 +59,28 @@ public class RewriteConstantFolding extends HopRewriteRule
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( roots == null )
return null;
-
for( int i=0; i<roots.size(); i++ ) {
Hop h = roots.get(i);
roots.set(i, rule_ConstantFolding(h));
}
-
return roots;
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return null;
-
return rule_ConstantFolding(root);
}
- private Hop rule_ConstantFolding( Hop hop )
- throws HopsException
- {
+ private Hop rule_ConstantFolding( Hop hop ) {
return rConstantFoldingExpression(hop);
}
- private Hop rConstantFoldingExpression( Hop root )
- throws HopsException
- {
+ private Hop rConstantFoldingExpression( Hop root ) {
if( root.isVisited() )
return root;
@@ -175,13 +161,8 @@ public class RewriteConstantFolding extends HopRewriteRule
*
* @param bop high-level operator
* @return literal op
- * @throws LopsException if LopsException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
- * @throws IOException if IOException occurs
- * @throws HopsException if HopsException occurs
*/
private LiteralOp evalScalarOperation( Hop bop )
- throws LopsException, DMLRuntimeException, IOException, HopsException
{
//Timing time = new Timing( true );
@@ -228,16 +209,13 @@ public class RewriteConstantFolding extends HopRewriteRule
return literal;
}
- private ProgramBlock getProgramBlock()
- throws DMLRuntimeException
- {
+ private ProgramBlock getProgramBlock() {
if( _tmpPB == null )
_tmpPB = new ProgramBlock( new Program() );
return _tmpPB;
}
- private ExecutionContext getExecutionContext()
- {
+ private ExecutionContext getExecutionContext() {
if( _tmpEC == null )
_tmpEC = ExecutionContextFactory.createContext();
return _tmpEC;
@@ -266,14 +244,14 @@ public class RewriteConstantFolding extends HopRewriteRule
&& hop.getDataType() == DataType.SCALAR);
}
- private static boolean isApplicableFalseConjunctivePredicate( Hop hop ) throws HopsException {
+ private static boolean isApplicableFalseConjunctivePredicate( Hop hop ) {
ArrayList<Hop> in = hop.getInput();
return ( HopRewriteUtils.isBinary(hop, OpOp2.AND) && hop.getDataType().isScalar()
&& ( (in.get(0) instanceof LiteralOp && !((LiteralOp)in.get(0)).getBooleanValue())
||(in.get(1) instanceof LiteralOp && !((LiteralOp)in.get(1)).getBooleanValue())) );
}
- private static boolean isApplicableTrueDisjunctivePredicate( Hop hop ) throws HopsException {
+ private static boolean isApplicableTrueDisjunctivePredicate( Hop hop ) {
ArrayList<Hop> in = hop.getInput();
return ( HopRewriteUtils.isBinary(hop, OpOp2.OR) && hop.getDataType().isScalar()
&& ( (in.get(0) instanceof LiteralOp && ((LiteralOp)in.get(0)).getBooleanValue())
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteElementwiseMultChainOptimization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteElementwiseMultChainOptimization.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteElementwiseMultChainOptimization.java
index ca7ef2e..a5d8b06 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteElementwiseMultChainOptimization.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteElementwiseMultChainOptimization.java
@@ -31,7 +31,6 @@ import java.util.TreeSet;
import org.apache.sysml.hops.BinaryOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.parser.Expression;
@@ -56,7 +55,7 @@ import org.apache.sysml.parser.Expression;
*/
public class RewriteElementwiseMultChainOptimization extends HopRewriteRule {
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) throws HopsException {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( roots == null )
return null;
for( int i=0; i<roots.size(); i++ ) {
@@ -67,7 +66,7 @@ public class RewriteElementwiseMultChainOptimization extends HopRewriteRule {
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) throws HopsException {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return null;
return rule_RewriteEMult(root);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteForLoopVectorization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteForLoopVectorization.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteForLoopVectorization.java
index cade354..0064a6c 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteForLoopVectorization.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteForLoopVectorization.java
@@ -29,7 +29,6 @@ import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.AggOp;
import org.apache.sysml.hops.Hop.Direction;
import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.IndexingOp;
import org.apache.sysml.hops.LeftIndexingOp;
import org.apache.sysml.hops.LiteralOp;
@@ -60,7 +59,6 @@ public class RewriteForLoopVectorization extends StatementBlockRewriteRule
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state)
- throws HopsException
{
if( sb instanceof ForStatementBlock )
{
@@ -102,13 +100,11 @@ public class RewriteForLoopVectorization extends StatementBlockRewriteRule
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
- ProgramRewriteStatus sate) throws HopsException {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
private static StatementBlock vectorizeScalarAggregate( StatementBlock sb, StatementBlock csb, Hop from, Hop to, Hop increment, String itervar )
- throws HopsException
{
StatementBlock ret = sb;
@@ -210,7 +206,6 @@ public class RewriteForLoopVectorization extends StatementBlockRewriteRule
}
private static StatementBlock vectorizeElementwiseBinary( StatementBlock sb, StatementBlock csb, Hop from, Hop to, Hop increment, String itervar )
- throws HopsException
{
StatementBlock ret = sb;
@@ -294,7 +289,6 @@ public class RewriteForLoopVectorization extends StatementBlockRewriteRule
}
private static StatementBlock vectorizeElementwiseUnary( StatementBlock sb, StatementBlock csb, Hop from, Hop to, Hop increment, String itervar )
- throws HopsException
{
StatementBlock ret = sb;
@@ -354,7 +348,6 @@ public class RewriteForLoopVectorization extends StatementBlockRewriteRule
}
private static StatementBlock vectorizeIndexedCopy( StatementBlock sb, StatementBlock csb, Hop from, Hop to, Hop increment, String itervar )
- throws HopsException
{
StatementBlock ret = sb;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
index e2097e2..621daae 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteIndexingVectorization.java
@@ -26,7 +26,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.OpOp2;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.IndexingOp;
import org.apache.sysml.hops.LeftIndexingOp;
import org.apache.sysml.hops.LiteralOp;
@@ -47,33 +46,23 @@ public class RewriteIndexingVectorization extends HopRewriteRule
private static final Log LOG = LogFactory.getLog(RewriteIndexingVectorization.class.getName());
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( roots == null )
return roots;
-
for( Hop h : roots )
rule_IndexingVectorization( h );
-
return roots;
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return root;
-
rule_IndexingVectorization( root );
-
return root;
}
- private void rule_IndexingVectorization( Hop hop )
- throws HopsException
- {
+ private void rule_IndexingVectorization( Hop hop ) {
if(hop.isVisited())
return;
@@ -96,9 +85,7 @@ public class RewriteIndexingVectorization extends HopRewriteRule
hop.setVisited();
}
- private static Hop vectorizeRightLeftIndexingChains(Hop hi)
- throws HopsException
- {
+ private static Hop vectorizeRightLeftIndexingChains(Hop hi) {
//check for valid root operator
if( !(hi instanceof LeftIndexingOp
&& hi.getInput().get(1) instanceof IndexingOp
@@ -184,11 +171,9 @@ public class RewriteIndexingVectorization extends HopRewriteRule
* dynamic rewrites
*
* @param hop high-level operator
- * @throws HopsException if HopsException occurs
*/
@SuppressWarnings("unused")
private static void vectorizeRightIndexing( Hop hop )
- throws HopsException
{
if( hop instanceof IndexingOp ) //right indexing
{
@@ -276,7 +261,6 @@ public class RewriteIndexingVectorization extends HopRewriteRule
@SuppressWarnings("unchecked")
private static Hop vectorizeLeftIndexing( Hop hop )
- throws HopsException
{
Hop ret = hop;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkLoopCheckpointing.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkLoopCheckpointing.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkLoopCheckpointing.java
index 50a5579..6c3ad76 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkLoopCheckpointing.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkLoopCheckpointing.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.Hop.DataOpTypes;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.parser.DataIdentifier;
@@ -60,7 +59,6 @@ public class RewriteInjectSparkLoopCheckpointing extends StatementBlockRewriteRu
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus status)
- throws HopsException
{
if( !OptimizerUtils.isSparkExecutionMode() ) {
// nothing to do here, return original statement block
@@ -130,8 +128,7 @@ public class RewriteInjectSparkLoopCheckpointing extends StatementBlockRewriteRu
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
- ProgramRewriteStatus sate) throws HopsException {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
index 7ee3506..3f43431 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteInjectSparkPReadCheckpointing.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
/**
@@ -36,9 +35,7 @@ import org.apache.sysml.hops.OptimizerUtils;
public class RewriteInjectSparkPReadCheckpointing extends HopRewriteRule
{
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( !OptimizerUtils.isSparkExecutionMode() )
return roots;
@@ -53,15 +50,12 @@ public class RewriteInjectSparkPReadCheckpointing extends HopRewriteRule
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
//not applicable to predicates (we do not allow persistent reads there)
return root;
}
private void rInjectCheckpointAfterPRead( Hop hop )
- throws HopsException
{
if(hop.isVisited())
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
index 79683fb..c3dd512 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMarkLoopVariablesUpdateInPlace.java
@@ -28,7 +28,6 @@ import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LeftIndexingOp;
import org.apache.sysml.hops.UnaryOp;
import org.apache.sysml.parser.ForStatement;
@@ -55,7 +54,6 @@ public class RewriteMarkLoopVariablesUpdateInPlace extends StatementBlockRewrite
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus status)
- throws HopsException
{
if( DMLScript.rtplatform == RUNTIME_PLATFORM.HADOOP
|| DMLScript.rtplatform == RUNTIME_PLATFORM.SPARK )
@@ -95,7 +93,6 @@ public class RewriteMarkLoopVariablesUpdateInPlace extends StatementBlockRewrite
}
private boolean rIsApplicableForUpdateInPlace( ArrayList<StatementBlock> sbs, String varname )
- throws HopsException
{
//NOTE: no function statement blocks / predicates considered because function call would
//render variable as not applicable and predicates don't allow assignments; further reuse
@@ -157,8 +154,7 @@ public class RewriteMarkLoopVariablesUpdateInPlace extends StatementBlockRewrite
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
- ProgramRewriteStatus sate) throws HopsException {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
index e8510d4..91033c4 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMatrixMultChainOptimization.java
@@ -55,7 +55,6 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
@Override
public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
{
if( roots == null )
return null;
@@ -69,7 +68,6 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
@Override
public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
{
if( root == null )
return null;
@@ -85,10 +83,8 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
* to find chains that need to be optimized.
*
* @param hop high-level operator
- * @throws HopsException if HopsException occurs
*/
private void rule_OptimizeMMChains(Hop hop)
- throws HopsException
{
if( hop.isVisited() )
return;
@@ -116,9 +112,8 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
* mmChain.
*
* @param hop high-level operator
- * @throws HopsException if HopsException occurs
*/
- private void optimizeMMChain( Hop hop ) throws HopsException
+ private void optimizeMMChain( Hop hop )
{
if( LOG.isTraceEnabled() ) {
LOG.trace("MM Chain Optimization for HOP: (" + hop.getClass().getSimpleName()
@@ -326,7 +321,6 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
}
private static void clearLinksWithinChain( Hop hop, ArrayList<Hop> operators )
- throws HopsException
{
for( int i=0; i < operators.size(); i++ ) {
Hop op = operators.get(i);
@@ -352,10 +346,8 @@ public class RewriteMatrixMultChainOptimization extends HopRewriteRule
* @param chain list of high-level operators
* @param dimArray dimension array
* @return true if all dimensions known
- * @throws HopsException if HopsException occurs
*/
private static boolean getDimsArray( Hop hop, ArrayList<Hop> chain, double[] dimsArray )
- throws HopsException
{
boolean dimsKnown = true;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteMergeBlockSequence.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMergeBlockSequence.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMergeBlockSequence.java
index 9c2d715..0ddba21 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteMergeBlockSequence.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteMergeBlockSequence.java
@@ -28,7 +28,6 @@ import java.util.List;
import org.apache.sysml.hops.FunctionOp;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.ExternalFunctionStatement;
import org.apache.sysml.parser.FunctionStatementBlock;
import org.apache.sysml.parser.StatementBlock;
@@ -51,13 +50,13 @@ public class RewriteMergeBlockSequence extends StatementBlockRewriteRule
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb,
- ProgramRewriteStatus state) throws HopsException {
+ ProgramRewriteStatus state) {
return Arrays.asList(sb);
}
@Override
public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
- ProgramRewriteStatus sate) throws HopsException
+ ProgramRewriteStatus sate)
{
if( sbs == null || sbs.isEmpty() )
return sbs;
@@ -174,8 +173,7 @@ public class RewriteMergeBlockSequence extends StatementBlockRewriteRule
current.setVisited();
}
- private static boolean hasFunctionOpRoot(StatementBlock sb)
- throws HopsException {
+ private static boolean hasFunctionOpRoot(StatementBlock sb) {
if( sb == null || sb.getHops() == null )
return false;
boolean ret = false;
@@ -184,8 +182,7 @@ public class RewriteMergeBlockSequence extends StatementBlockRewriteRule
return ret;
}
- private static boolean hasExternalFunctionOpRootWithSideEffect(StatementBlock sb)
- throws HopsException {
+ private static boolean hasExternalFunctionOpRootWithSideEffect(StatementBlock sb) {
if( sb == null || sb.getHops() == null )
return false;
for( Hop root : sb.getHops() )
@@ -202,7 +199,6 @@ public class RewriteMergeBlockSequence extends StatementBlockRewriteRule
}
private static boolean hasFunctionIOConflict(StatementBlock sb1, StatementBlock sb2)
- throws HopsException
{
//semantics: a function op root in sb1 conflicts with sb2 if this function op writes
//to a variable that is read or written by sb2, where the write might be either
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveDanglingParentReferences.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveDanglingParentReferences.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveDanglingParentReferences.java
index 824c56b..926e53c 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveDanglingParentReferences.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveDanglingParentReferences.java
@@ -27,7 +27,6 @@ import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.DataOpTypes;
import org.apache.sysml.hops.Hop.OpOpN;
import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.NaryOp;
import org.apache.sysml.hops.UnaryOp;
@@ -41,9 +40,7 @@ import org.apache.sysml.hops.UnaryOp;
public class RewriteRemoveDanglingParentReferences extends HopRewriteRule
{
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( roots == null )
return null;
@@ -58,9 +55,7 @@ public class RewriteRemoveDanglingParentReferences extends HopRewriteRule
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return root;
@@ -74,9 +69,7 @@ public class RewriteRemoveDanglingParentReferences extends HopRewriteRule
return root;
}
- private int removeDanglingParentReferences( Hop hop, boolean pin )
- throws HopsException
- {
+ private int removeDanglingParentReferences( Hop hop, boolean pin ) {
//check mark processed
if( hop.isVisited() )
return 0;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveEmptyBasicBlocks.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveEmptyBasicBlocks.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveEmptyBasicBlocks.java
index b03763c..c4ba9f9 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveEmptyBasicBlocks.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveEmptyBasicBlocks.java
@@ -22,7 +22,6 @@ package org.apache.sysml.hops.rewrite;
import java.util.ArrayList;
import java.util.List;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.StatementBlock;
/**
@@ -38,9 +37,7 @@ public class RewriteRemoveEmptyBasicBlocks extends StatementBlockRewriteRule
}
@Override
- public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state)
- throws HopsException
- {
+ public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state) {
ArrayList<StatementBlock> ret = new ArrayList<>();
//prune last level blocks with empty hops
@@ -56,8 +53,7 @@ public class RewriteRemoveEmptyBasicBlocks extends StatementBlockRewriteRule
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate)
- throws HopsException {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
index ec5c6c0..79aca58 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemovePersistentReadWrite.java
@@ -28,7 +28,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.runtime.controlprogram.LocalVariableMap;
import org.apache.sysml.runtime.controlprogram.caching.CacheableData;
@@ -78,33 +77,23 @@ public class RewriteRemovePersistentReadWrite extends HopRewriteRule
}
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( roots == null )
return null;
-
for( Hop h : roots )
rule_RemovePersistentDataOp( h );
-
return roots;
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return root;
-
rule_RemovePersistentDataOp( root );
-
return root;
}
- private void rule_RemovePersistentDataOp( Hop hop )
- throws HopsException
- {
+ private void rule_RemovePersistentDataOp( Hop hop ) {
//check mark processed
if( hop.isVisited() )
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
index c53d59d..5963871 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveReadAfterWrite.java
@@ -26,7 +26,6 @@ import java.util.Map.Entry;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.parser.DataExpression;
@@ -44,7 +43,6 @@ public class RewriteRemoveReadAfterWrite extends HopRewriteRule
@Override
@SuppressWarnings("unchecked")
public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
{
if( roots == null )
return null;
@@ -78,17 +76,12 @@ public class RewriteRemoveReadAfterWrite extends HopRewriteRule
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
//do noting, read/write do not occur in predicates
-
return root;
}
- private void collectPersistentReadWriteOps(Hop hop, HashMap<String,Hop> pWrites, HashMap<String,Hop> pReads)
- throws HopsException
- {
+ private void collectPersistentReadWriteOps(Hop hop, HashMap<String,Hop> pWrites, HashMap<String,Hop> pReads) {
if( hop.isVisited() )
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryBranches.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryBranches.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryBranches.java
index 094adb0..619a084 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryBranches.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryBranches.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.parser.IfStatement;
import org.apache.sysml.parser.IfStatementBlock;
@@ -44,7 +43,6 @@ public class RewriteRemoveUnnecessaryBranches extends StatementBlockRewriteRule
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state)
- throws HopsException
{
ArrayList<StatementBlock> ret = new ArrayList<>();
@@ -88,8 +86,7 @@ public class RewriteRemoveUnnecessaryBranches extends StatementBlockRewriteRule
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
- ProgramRewriteStatus sate) throws HopsException {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
index e657f7f..224affe 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteRemoveUnnecessaryCasts.java
@@ -22,7 +22,6 @@ package org.apache.sysml.hops.rewrite;
import java.util.ArrayList;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.OpOp1;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.UnaryOp;
import org.apache.sysml.parser.Expression.ValueType;
@@ -43,29 +42,20 @@ import org.apache.sysml.parser.Expression.ValueType;
*/
public class RewriteRemoveUnnecessaryCasts extends HopRewriteRule
{
-
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
if( roots == null )
return null;
-
for( Hop h : roots )
rule_RemoveUnnecessaryCasts( h );
-
return roots;
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
if( root == null )
return root;
-
rule_RemoveUnnecessaryCasts( root );
-
return root;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
index b7ab7d1..a758ee0 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
@@ -79,7 +79,6 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state)
- throws HopsException
{
//DAG splits not required for forced single node
if( DMLScript.rtplatform == RUNTIME_PLATFORM.SINGLE_NODE
@@ -482,8 +481,7 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
- ProgramRewriteStatus sate) throws HopsException {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
index 3e423b8..30631d6 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
@@ -52,7 +52,6 @@ public class RewriteSplitDagUnknownCSVRead extends StatementBlockRewriteRule
@Override
public List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state)
- throws HopsException
{
//DAG splits not required for forced single node
if( DMLScript.rtplatform == RUNTIME_PLATFORM.SINGLE_NODE
@@ -145,15 +144,13 @@ public class RewriteSplitDagUnknownCSVRead extends StatementBlockRewriteRule
}
@Override
- public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
- ProgramRewriteStatus sate) throws HopsException {
+ public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate) {
return sbs;
}
private void collectCSVReadHopsUnknownSize( ArrayList<Hop> roots, ArrayList<Hop> cand ) {
if( roots == null )
return;
-
Hop.resetVisitStatus(roots);
for( Hop root : roots )
collectCSVReadHopsUnknownSize(root, cand);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/RewriteTransientWriteParentHandling.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteTransientWriteParentHandling.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteTransientWriteParentHandling.java
index 4e16084..994132b 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteTransientWriteParentHandling.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteTransientWriteParentHandling.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.Hop.DataOpTypes;
/**
@@ -35,27 +34,20 @@ import org.apache.sysml.hops.Hop.DataOpTypes;
*/
public class RewriteTransientWriteParentHandling extends HopRewriteRule
{
-
@Override
- public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
- throws HopsException
- {
+ public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) {
for (Hop h : roots)
rule_RehangTransientWriteParents(h, roots);
-
return roots;
}
@Override
- public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
- throws HopsException
- {
- // do nothing (does not apply to predicate hop DAGs)
+ public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state) {
+ // do nothing (does not apply to predicate hop DAGs)
return root;
}
private void rule_RehangTransientWriteParents(Hop hop, ArrayList<Hop> sbHops)
- throws HopsException
{
if (hop instanceof DataOp && ((DataOp) hop).getDataOpType() == DataOpTypes.TRANSIENTWRITE
&& !hop.getParent().isEmpty()) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/rewrite/StatementBlockRewriteRule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/StatementBlockRewriteRule.java b/src/main/java/org/apache/sysml/hops/rewrite/StatementBlockRewriteRule.java
index ff2d5bf..fe8d111 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/StatementBlockRewriteRule.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/StatementBlockRewriteRule.java
@@ -24,7 +24,6 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.StatementBlock;
/**
@@ -52,10 +51,8 @@ public abstract class StatementBlockRewriteRule
* @param sb statement block
* @param sate program rewrite status
* @return list of statement blocks
- * @throws HopsException if HopsException occurs
*/
- public abstract List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus sate)
- throws HopsException;
+ public abstract List<StatementBlock> rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus sate);
/**
* Handle a list of statement blocks. Specific type constraints have to be ensured
@@ -65,8 +62,6 @@ public abstract class StatementBlockRewriteRule
* @param sbs list of statement blocks
* @param sate program rewrite status
* @return list of statement blocks
- * @throws HopsException if HopsException occurs
*/
- public abstract List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate)
- throws HopsException;
+ public abstract List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Aggregate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Aggregate.java b/src/main/java/org/apache/sysml/lops/Aggregate.java
index f90e214..2631415 100644
--- a/src/main/java/org/apache/sysml/lops/Aggregate.java
+++ b/src/main/java/org/apache/sysml/lops/Aggregate.java
@@ -127,13 +127,12 @@ public class Aggregate extends Lop
}
@Override
- public String getInstructions(int input_index, int output_index) throws LopsException {
+ public String getInstructions(int input_index, int output_index) {
return getInstructions(String.valueOf(input_index), String.valueOf(output_index));
}
@Override
public String getInstructions(String input1, String output)
- throws LopsException
{
boolean isCorrectionApplicable = (getExecType() == ExecType.MR &&
(operation == OperationTypes.Mean || operation == OperationTypes.Var
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Append.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Append.java b/src/main/java/org/apache/sysml/lops/Append.java
index f2b9896..ac96d89 100644
--- a/src/main/java/org/apache/sysml/lops/Append.java
+++ b/src/main/java/org/apache/sysml/lops/Append.java
@@ -67,9 +67,7 @@ public class Append extends Lop
//called when append executes in CP
@Override
- public String getInstructions(String input1, String input2, String input3, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String input3, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( OPERAND_DELIMITOR );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/AppendG.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/AppendG.java b/src/main/java/org/apache/sysml/lops/AppendG.java
index b412563..5483121 100644
--- a/src/main/java/org/apache/sysml/lops/AppendG.java
+++ b/src/main/java/org/apache/sysml/lops/AppendG.java
@@ -87,9 +87,7 @@ public class AppendG extends Lop
//called when append executes in MR
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int output_index) {
return getInstructions(
String.valueOf(input_index1),
String.valueOf(input_index2),
@@ -100,9 +98,7 @@ public class AppendG extends Lop
//called when append executes in SP
@Override
- public String getInstructions(String input_index1, String input_index2, String input_index3, String input_index4, String output_index)
- throws LopsException
- {
+ public String getInstructions(String input_index1, String input_index2, String input_index3, String input_index4, String output_index) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/AppendGAlignedSP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/AppendGAlignedSP.java b/src/main/java/org/apache/sysml/lops/AppendGAlignedSP.java
index a591c3e..0e83ebb 100644
--- a/src/main/java/org/apache/sysml/lops/AppendGAlignedSP.java
+++ b/src/main/java/org/apache/sysml/lops/AppendGAlignedSP.java
@@ -66,7 +66,6 @@ public class AppendGAlignedSP extends Lop
//called when append executes in CP
@Override
public String getInstructions(String input_index1, String input_index2, String input_index3, String output_index)
- throws LopsException
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/AppendM.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/AppendM.java b/src/main/java/org/apache/sysml/lops/AppendM.java
index 0d71319..9ca8047 100644
--- a/src/main/java/org/apache/sysml/lops/AppendM.java
+++ b/src/main/java/org/apache/sysml/lops/AppendM.java
@@ -80,9 +80,7 @@ public class AppendM extends Lop
//called when append executes in MR
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index) {
return getInstructions(
String.valueOf(input_index1),
String.valueOf(input_index2),
@@ -93,9 +91,7 @@ public class AppendM extends Lop
//called when append executes in SP
@Override
- public String getInstructions(String input1, String input2, String input3, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String input3, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/AppendR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/AppendR.java b/src/main/java/org/apache/sysml/lops/AppendR.java
index e8d55b4..0fbec7e 100644
--- a/src/main/java/org/apache/sysml/lops/AppendR.java
+++ b/src/main/java/org/apache/sysml/lops/AppendR.java
@@ -71,9 +71,7 @@ public class AppendR extends Lop
//called when append executes in MR
@Override
- public String getInstructions(int input_index1, int input_index2, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index1, int input_index2, int output_index) {
return getInstructions(
String.valueOf(input_index1),
String.valueOf(input_index2),
@@ -82,9 +80,7 @@ public class AppendR extends Lop
//called when append executes in CP
@Override
- public String getInstructions(String input1, String input2, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Binary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Binary.java b/src/main/java/org/apache/sysml/lops/Binary.java
index d393ea2..26c9778 100644
--- a/src/main/java/org/apache/sysml/lops/Binary.java
+++ b/src/main/java/org/apache/sysml/lops/Binary.java
@@ -190,7 +190,7 @@ public class Binary extends Lop
@Override
- public String getInstructions(int input_index1, int input_index2, int output_index) throws LopsException {
+ public String getInstructions(int input_index1, int input_index2, int output_index) {
return getInstructions(
String.valueOf(input_index1),
String.valueOf(input_index2),
@@ -198,9 +198,7 @@ public class Binary extends Lop
}
@Override
- public String getInstructions(String input1, String input2, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( OPERAND_DELIMITOR );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/BinaryM.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/BinaryM.java b/src/main/java/org/apache/sysml/lops/BinaryM.java
index d3183e6..08ab70e 100644
--- a/src/main/java/org/apache/sysml/lops/BinaryM.java
+++ b/src/main/java/org/apache/sysml/lops/BinaryM.java
@@ -59,9 +59,8 @@ public class BinaryM extends Lop
* @param et exec type
* @param partitioned true if partitioned
* @param colVector true if colVector
- * @throws LopsException if LopsException occurs
*/
- public BinaryM(Lop input1, Lop input2, OperationTypes op, DataType dt, ValueType vt, ExecType et, boolean partitioned, boolean colVector ) throws LopsException {
+ public BinaryM(Lop input1, Lop input2, OperationTypes op, DataType dt, ValueType vt, ExecType et, boolean partitioned, boolean colVector ) {
super(Lop.Type.Binary, dt, vt);
_operation = op;
@@ -164,22 +163,21 @@ public class BinaryM extends Lop
}
}
- public static boolean isOpcode(String opcode)
- {
+ public static boolean isOpcode(String opcode) {
return opcode.equals("map+") || opcode.equals("map-") ||
- opcode.equals("map*") || opcode.equals("map/") ||
- opcode.equals("map%%") || opcode.equals("map%/%") ||
- opcode.equals("map<") || opcode.equals("map<=") ||
- opcode.equals("map>") || opcode.equals("map>=") ||
- opcode.equals("map==") || opcode.equals("map!=") ||
- opcode.equals("map&&") || opcode.equals("map||") ||
- opcode.equals("mapmin") || opcode.equals("mapmax") ||
+ opcode.equals("map*") || opcode.equals("map/") ||
+ opcode.equals("map%%") || opcode.equals("map%/%") ||
+ opcode.equals("map<") || opcode.equals("map<=") ||
+ opcode.equals("map>") || opcode.equals("map>=") ||
+ opcode.equals("map==") || opcode.equals("map!=") ||
+ opcode.equals("map&&") || opcode.equals("map||") ||
+ opcode.equals("mapmin") || opcode.equals("mapmax") ||
opcode.equals("map^") || opcode.equals("map1-*");
}
@Override
- public String getInstructions(int input_index1, int input_index2, int output_index) throws LopsException {
+ public String getInstructions(int input_index1, int input_index2, int output_index) {
return getInstructions(
String.valueOf(input_index1),
String.valueOf(input_index2),
@@ -188,7 +186,6 @@ public class BinaryM extends Lop
@Override
public String getInstructions(String input1, String input2, String output)
- throws LopsException
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/BinaryScalar.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/BinaryScalar.java b/src/main/java/org/apache/sysml/lops/BinaryScalar.java
index f581a9a..5b5fe02 100644
--- a/src/main/java/org/apache/sysml/lops/BinaryScalar.java
+++ b/src/main/java/org/apache/sysml/lops/BinaryScalar.java
@@ -77,8 +77,7 @@ public class BinaryScalar extends Lop
}
@Override
- public String getInstructions(String input1, String input2, String output) throws LopsException
- {
+ public String getInstructions(String input1, String input2, String output) {
StringBuilder sb = new StringBuilder();
sb.append(getExecType());
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/BinaryUAggChain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/BinaryUAggChain.java b/src/main/java/org/apache/sysml/lops/BinaryUAggChain.java
index e1b8968..388f4a4 100644
--- a/src/main/java/org/apache/sysml/lops/BinaryUAggChain.java
+++ b/src/main/java/org/apache/sysml/lops/BinaryUAggChain.java
@@ -49,12 +49,9 @@ public class BinaryUAggChain extends Lop
* @param dt data type
* @param vt value type
* @param et execution type
- * @throws LopsException if LopsException occurs
*/
- public BinaryUAggChain(Lop input1, Binary.OperationTypes bop, Aggregate.OperationTypes uaop, PartialAggregate.DirectionTypes uadir, DataType dt, ValueType vt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.BinUaggChain, dt, vt);
+ public BinaryUAggChain(Lop input1, Binary.OperationTypes bop, Aggregate.OperationTypes uaop, PartialAggregate.DirectionTypes uadir, DataType dt, ValueType vt, ExecType et) {
+ super(Lop.Type.BinUaggChain, dt, vt);
addInput(input1); //X
input1.addOutput(this);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CSVReBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CSVReBlock.java b/src/main/java/org/apache/sysml/lops/CSVReBlock.java
index 1217cd1..92694b0 100644
--- a/src/main/java/org/apache/sysml/lops/CSVReBlock.java
+++ b/src/main/java/org/apache/sysml/lops/CSVReBlock.java
@@ -37,7 +37,7 @@ public class CSVReBlock extends Lop
private int _rows_per_block;
private int _cols_per_block;
- public CSVReBlock(Lop input, int rows_per_block, int cols_per_block, DataType dt, ValueType vt, ExecType et) throws LopsException
+ public CSVReBlock(Lop input, int rows_per_block, int cols_per_block, DataType dt, ValueType vt, ExecType et)
{
super(Lop.Type.CSVReBlock, dt, vt);
addInput(input);
@@ -67,7 +67,7 @@ public class CSVReBlock extends Lop
return "CSVReblock - rows per block = " + _rows_per_block + " cols per block " + _cols_per_block ;
}
- private String prepCSVProperties() throws LopsException {
+ private String prepCSVProperties() {
StringBuilder sb = new StringBuilder();
Data dataInput = (Data)getInputs().get(0);
@@ -110,12 +110,12 @@ public class CSVReBlock extends Lop
}
@Override
- public String getInstructions(int input_index, int output_index) throws LopsException {
+ public String getInstructions(int input_index, int output_index) {
return getInstructions(String.valueOf(input_index), String.valueOf(output_index));
}
@Override
- public String getInstructions(String input1, String output) throws LopsException {
+ public String getInstructions(String input1, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( Lop.OPERAND_DELIMITOR );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Checkpoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Checkpoint.java b/src/main/java/org/apache/sysml/lops/Checkpoint.java
index 84e1825..d469d7e 100644
--- a/src/main/java/org/apache/sysml/lops/Checkpoint.java
+++ b/src/main/java/org/apache/sysml/lops/Checkpoint.java
@@ -57,12 +57,9 @@ public class Checkpoint extends Lop
* @param dt data type
* @param vt value type
* @param level storage level
- * @throws LopsException if LopsException occurs
*/
- public Checkpoint(Lop input, DataType dt, ValueType vt, String level)
- throws LopsException
- {
- super(Lop.Type.Checkpoint, dt, vt);
+ public Checkpoint(Lop input, DataType dt, ValueType vt, String level) {
+ super(Lop.Type.Checkpoint, dt, vt);
this.addInput(input);
input.addOutput(this);
@@ -92,9 +89,7 @@ public class Checkpoint extends Lop
}
@Override
- public String getInstructions(String input1, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String output) {
//valid execution type
if(getExecType() != ExecType.SPARK) {
throw new LopsException("Wrong execution type for Checkpoint.getInstructions (expected: SPARK, found: "+getExecType()+").");
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CoVariance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CoVariance.java b/src/main/java/org/apache/sysml/lops/CoVariance.java
index 8e84222..00a3bb6 100644
--- a/src/main/java/org/apache/sysml/lops/CoVariance.java
+++ b/src/main/java/org/apache/sysml/lops/CoVariance.java
@@ -32,23 +32,21 @@ import org.apache.sysml.parser.Expression.ValueType;
public class CoVariance extends Lop
{
- public CoVariance(Lop input1, DataType dt, ValueType vt, ExecType et) throws LopsException {
+ public CoVariance(Lop input1, DataType dt, ValueType vt, ExecType et) {
super(Lop.Type.CoVariance, dt, vt);
init(input1, null, null, et);
}
- public CoVariance(Lop input1, Lop input2, DataType dt, ValueType vt, ExecType et) throws LopsException {
+ public CoVariance(Lop input1, Lop input2, DataType dt, ValueType vt, ExecType et) {
this(input1, input2, null, dt, vt, et);
}
- public CoVariance(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, ExecType et) throws LopsException {
+ public CoVariance(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, ExecType et) {
super(Lop.Type.CoVariance, dt, vt);
init(input1, input2, input3, et);
}
- private void init(Lop input1, Lop input2, Lop input3, ExecType et)
- throws LopsException
- {
+ private void init(Lop input1, Lop input2, Lop input3, ExecType et) {
/*
* When et = MR: covariance lop will have a single input lop, which
* denote the combined input data -- output of combinebinary, if unweighed;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CombineBinary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CombineBinary.java b/src/main/java/org/apache/sysml/lops/CombineBinary.java
index 44ee47d..0836aca 100644
--- a/src/main/java/org/apache/sysml/lops/CombineBinary.java
+++ b/src/main/java/org/apache/sysml/lops/CombineBinary.java
@@ -72,9 +72,7 @@ public class CombineBinary extends Lop
}
@Override
- public String getInstructions(int input_index1, int input_index2, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index1, int input_index2, int output_index) {
// Determine whether or not the second input denotes weights vector.
// CombineBinary can be used to combine (data,weights) vectors or (data1,data2) vectors
boolean isSecondInputIsWeight = true;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CombineTernary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CombineTernary.java b/src/main/java/org/apache/sysml/lops/CombineTernary.java
index ac1a60f..2352935 100644
--- a/src/main/java/org/apache/sysml/lops/CombineTernary.java
+++ b/src/main/java/org/apache/sysml/lops/CombineTernary.java
@@ -69,8 +69,7 @@ public class CombineTernary extends Lop
@Override
public String getInstructions(int input_index1, int input_index2,
- int input_index3, int output_index)
- throws LopsException
+ int input_index3, int output_index)
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CombineUnary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CombineUnary.java b/src/main/java/org/apache/sysml/lops/CombineUnary.java
index a7f34f6..11fdc5b 100644
--- a/src/main/java/org/apache/sysml/lops/CombineUnary.java
+++ b/src/main/java/org/apache/sysml/lops/CombineUnary.java
@@ -60,9 +60,7 @@ public class CombineUnary extends Lop
}
@Override
- public String getInstructions(int input_index1, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index1, int output_index) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( Lop.OPERAND_DELIMITOR );
[04/10] systemml git commit: [SYSTEMML-2191] Cleanup exception
hierarchy and handling, part 1
Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java b/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
index 538103f..c0a50ec 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/gpu/context/GPUObject.java
@@ -30,7 +30,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sysml.api.DMLScript;
import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
import org.apache.sysml.runtime.instructions.cp.CPInstruction;
import org.apache.sysml.runtime.instructions.gpu.GPUInstruction;
@@ -619,24 +618,19 @@ public class GPUObject {
*
* @param instName name of the instruction
* @return true if a copy to host happened, false otherwise
- * @throws CacheException ?
*/
- public boolean acquireHostRead(String instName) throws CacheException {
+ public boolean acquireHostRead(String instName) throws DMLRuntimeException {
boolean copied = false;
- try {
+ if(LOG.isTraceEnabled()) {
+ LOG.trace("GPU : acquireDeviceModifySparse on " + this + ", GPUContext=" + getGPUContext());
+ }
+ if (isAllocated() && dirty) {
if(LOG.isTraceEnabled()) {
- LOG.trace("GPU : acquireDeviceModifySparse on " + this + ", GPUContext=" + getGPUContext());
+ LOG.trace("GPU : data is dirty on device, copying to host, on " + this + ", GPUContext="
+ + getGPUContext());
}
- if (isAllocated() && dirty) {
- if(LOG.isTraceEnabled()) {
- LOG.trace("GPU : data is dirty on device, copying to host, on " + this + ", GPUContext="
- + getGPUContext());
- }
- copyFromDeviceToHost(instName, false);
- copied = true;
- }
- } catch (DMLRuntimeException e) {
- throw new CacheException(e);
+ copyFromDeviceToHost(instName, false);
+ copied = true;
}
return copied;
}
@@ -699,7 +693,7 @@ public class GPUObject {
timestamp.set(-System.nanoTime());
break;
default:
- throw new CacheException("The eviction policy is not supported:" + evictionPolicy.name());
+ throw new DMLRuntimeException("The eviction policy is not supported:" + evictionPolicy.name());
}
}
@@ -712,7 +706,7 @@ public class GPUObject {
releaseReadLock();
updateReleaseLocks();
if (!isAllocated())
- throw new CacheException("Attempting to release an input before allocating it");
+ throw new DMLRuntimeException("Attempting to release an input before allocating it");
}
/**
@@ -728,7 +722,7 @@ public class GPUObject {
// Ideally, we would want to throw CacheException("Attempting to release an output that was not acquired via acquireDeviceModify") if !isDirty()
dirty = true;
if (!isAllocated())
- throw new CacheException("Attempting to release an output before allocating it");
+ throw new DMLRuntimeException("Attempting to release an output before allocating it");
}
void allocateDenseMatrixOnDevice() throws DMLRuntimeException {
@@ -764,7 +758,7 @@ public class GPUObject {
setSparseMatrixCudaPointer(tmp);
}
- void deallocateMemoryOnDevice(boolean eager) throws DMLRuntimeException {
+ void deallocateMemoryOnDevice(boolean eager) {
if(LOG.isTraceEnabled()) {
LOG.trace("GPU : deallocateMemoryOnDevice, on " + this + ", GPUContext=" + getGPUContext());
}
@@ -779,7 +773,7 @@ public class GPUObject {
resetReadWriteLock();
}
- protected long getSizeOnDevice() throws DMLRuntimeException {
+ protected long getSizeOnDevice() {
long GPUSize = 0;
long rlen = mat.getNumRows();
long clen = mat.getNumColumns();
@@ -793,7 +787,7 @@ public class GPUObject {
return GPUSize;
}
- void copyFromHostToDevice(String opcode) throws DMLRuntimeException {
+ void copyFromHostToDevice(String opcode) {
if(LOG.isTraceEnabled()) {
LOG.trace("GPU : copyFromHostToDevice, on " + this + ", GPUContext=" + getGPUContext());
}
@@ -910,14 +904,14 @@ public class GPUObject {
GPUStatistics.cudaToDevCount.add(1);
}
- public static int toIntExact(long l) throws DMLRuntimeException {
+ public static int toIntExact(long l) {
if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) {
throw new DMLRuntimeException("Cannot be cast to int:" + l);
}
return (int) l;
}
- protected void copyFromDeviceToHost(String instName, boolean isEviction) throws DMLRuntimeException {
+ protected void copyFromDeviceToHost(String instName, boolean isEviction) {
if(LOG.isTraceEnabled()) {
LOG.trace("GPU : copyFromDeviceToHost, on " + this + ", GPUContext=" + getGPUContext());
}
@@ -988,10 +982,8 @@ public class GPUObject {
/**
* lazily clears the data associated with this {@link GPUObject} instance
- *
- * @throws CacheException ?
*/
- public void clearData() throws DMLRuntimeException {
+ public void clearData() {
clearData(DMLScript.EAGER_CUDA_FREE);
}
@@ -999,9 +991,8 @@ public class GPUObject {
* Clears the data associated with this {@link GPUObject} instance
*
* @param eager whether to be done synchronously or asynchronously
- * @throws CacheException ?
*/
- public void clearData(boolean eager) throws DMLRuntimeException {
+ public void clearData(boolean eager) {
deallocateMemoryOnDevice(eager);
getGPUContext().getMemoryManager().removeGPUObject(this);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/udf/lib/CumSumProd.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/udf/lib/CumSumProd.java b/src/main/java/org/apache/sysml/udf/lib/CumSumProd.java
index e9edb0a..ba3795f 100644
--- a/src/main/java/org/apache/sysml/udf/lib/CumSumProd.java
+++ b/src/main/java/org/apache/sysml/udf/lib/CumSumProd.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.util.Iterator;
import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.matrix.data.IJV;
import org.apache.sysml.runtime.matrix.data.InputInfo;
import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -99,57 +98,53 @@ public class CumSumProd extends PackageFunction {
@Override
public void execute() {
- try {
- X = ((Matrix) getFunctionInput(0)).getMatrixObject().acquireRead();
- C = ((Matrix) getFunctionInput(1)).getMatrixObject().acquireRead();
- if(X.getNumRows() != C.getNumRows())
- throw new RuntimeException("Number of rows of X and C should match");
- if( X.getNumColumns() != C.getNumColumns() && C.getNumColumns() != 1 )
- throw new RuntimeException("Incorrect Number of columns of X and C (Expected C to be of same dimension or a vector)");
- start = Double.parseDouble(((Scalar)getFunctionInput(2)).getValue());
- isReverse = Boolean.parseBoolean(((Scalar)getFunctionInput(3)).getValue());
-
- numRetRows = X.getNumRows();
- numRetCols = X.getNumColumns();
- allocateOutput();
-
- // Copy X to Y
- denseBlock = retMB.getDenseBlockValues();
- if(X.isInSparseFormat()) {
- Iterator<IJV> iter = X.getSparseBlockIterator();
- while(iter.hasNext()) {
- IJV ijv = iter.next();
- denseBlock[ijv.getI()*numRetCols + ijv.getJ()] = ijv.getV();
- }
- }
- else {
- if(X.getDenseBlock() != null)
- System.arraycopy(X.getDenseBlockValues(), 0, denseBlock, 0, denseBlock.length);
+ X = ((Matrix) getFunctionInput(0)).getMatrixObject().acquireRead();
+ C = ((Matrix) getFunctionInput(1)).getMatrixObject().acquireRead();
+ if(X.getNumRows() != C.getNumRows())
+ throw new RuntimeException("Number of rows of X and C should match");
+ if( X.getNumColumns() != C.getNumColumns() && C.getNumColumns() != 1 )
+ throw new RuntimeException("Incorrect Number of columns of X and C (Expected C to be of same dimension or a vector)");
+ start = Double.parseDouble(((Scalar)getFunctionInput(2)).getValue());
+ isReverse = Boolean.parseBoolean(((Scalar)getFunctionInput(3)).getValue());
+
+ numRetRows = X.getNumRows();
+ numRetCols = X.getNumColumns();
+ allocateOutput();
+
+ // Copy X to Y
+ denseBlock = retMB.getDenseBlockValues();
+ if(X.isInSparseFormat()) {
+ Iterator<IJV> iter = X.getSparseBlockIterator();
+ while(iter.hasNext()) {
+ IJV ijv = iter.next();
+ denseBlock[ijv.getI()*numRetCols + ijv.getJ()] = ijv.getV();
}
-
- if(!isReverse) {
- // Y [1, ] = X [1, ] + C [1, ] * start;
- // Y [i+1, ] = X [i+1, ] + C [i+1, ] * Y [i, ]
- addCNConstant(0, start);
- for(int i = 1; i < numRetRows; i++) {
- addC(i, true);
- }
+ }
+ else {
+ if(X.getDenseBlock() != null)
+ System.arraycopy(X.getDenseBlockValues(), 0, denseBlock, 0, denseBlock.length);
+ }
+
+ if(!isReverse) {
+ // Y [1, ] = X [1, ] + C [1, ] * start;
+ // Y [i+1, ] = X [i+1, ] + C [i+1, ] * Y [i, ]
+ addCNConstant(0, start);
+ for(int i = 1; i < numRetRows; i++) {
+ addC(i, true);
}
- else {
- // Y [m, ] = X [m, ] + C [m, ] * start;
- // Y [i-1, ] = X [i-1, ] + C [i-1, ] * Y [i, ]
- addCNConstant(numRetRows-1, start);
- for(int i = numRetRows - 2; i >= 0; i--) {
- addC(i, false);
- }
+ }
+ else {
+ // Y [m, ] = X [m, ] + C [m, ] * start;
+ // Y [i-1, ] = X [i-1, ] + C [i-1, ] * Y [i, ]
+ addCNConstant(numRetRows-1, start);
+ for(int i = numRetRows - 2; i >= 0; i--) {
+ addC(i, false);
}
-
- ((Matrix) getFunctionInput(1)).getMatrixObject().release();
- ((Matrix) getFunctionInput(0)).getMatrixObject().release();
- } catch (CacheException e) {
- throw new RuntimeException("Error while executing CumSumProd", e);
}
+ ((Matrix) getFunctionInput(1)).getMatrixObject().release();
+ ((Matrix) getFunctionInput(0)).getMatrixObject().release();
+
retMB.recomputeNonZeros();
try {
retMB.examSparsity();
@@ -243,7 +238,4 @@ public class CumSumProd extends PackageFunction {
retMB = new MatrixBlock((int) numRetRows, (int) numRetCols, false);
retMB.allocateDenseBlock();
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/udf/lib/MultiInputCbind.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/udf/lib/MultiInputCbind.java b/src/main/java/org/apache/sysml/udf/lib/MultiInputCbind.java
index e56523c..e2b9f0e 100644
--- a/src/main/java/org/apache/sysml/udf/lib/MultiInputCbind.java
+++ b/src/main/java/org/apache/sysml/udf/lib/MultiInputCbind.java
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.util.Iterator;
import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.matrix.data.IJV;
import org.apache.sysml.runtime.matrix.data.InputInfo;
import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -72,89 +71,81 @@ public class MultiInputCbind extends PackageFunction {
spagetize = Boolean.parseBoolean(((Scalar)getFunctionInput(1)).getValue());
// Compute output dimensions
- try {
- numRetCols = 0;
- if(spagetize) {
- // Assumption the inputs are of same shape
- MatrixBlock in = ((Matrix) getFunctionInput(2)).getMatrixObject().acquireRead();
- numRetRows = in.getNumRows()*in.getNumColumns();
- numRetCols = numInputs;
- ((Matrix) getFunctionInput(2)).getMatrixObject().release();
- }
- else {
- for(int inputID = 2; inputID < numInputs + 2; inputID++) {
- MatrixBlock in = ((Matrix) getFunctionInput(inputID)).getMatrixObject().acquireRead();
- numRetRows = in.getNumRows();
- numRetCols += in.getNumColumns();
- ((Matrix) getFunctionInput(inputID)).getMatrixObject().release();
- }
+ numRetCols = 0;
+ if(spagetize) {
+ // Assumption the inputs are of same shape
+ MatrixBlock in = ((Matrix) getFunctionInput(2)).getMatrixObject().acquireRead();
+ numRetRows = in.getNumRows()*in.getNumColumns();
+ numRetCols = numInputs;
+ ((Matrix) getFunctionInput(2)).getMatrixObject().release();
+ }
+ else {
+ for(int inputID = 2; inputID < numInputs + 2; inputID++) {
+ MatrixBlock in = ((Matrix) getFunctionInput(inputID)).getMatrixObject().acquireRead();
+ numRetRows = in.getNumRows();
+ numRetCols += in.getNumColumns();
+ ((Matrix) getFunctionInput(inputID)).getMatrixObject().release();
}
- } catch (CacheException e) {
- throw new RuntimeException("Error while executing MultiInputCbind", e);
}
allocateOutput();
// Performs cbind (cbind (cbind ( X1, X2 ), X3 ), X4)
double [] retData = retMB.getDenseBlockValues();
- try {
- int startColumn = 0;
- for(int inputID = 2; inputID < numInputs + 2; inputID++) {
- MatrixBlock in = ((Matrix) getFunctionInput(inputID)).getMatrixObject().acquireRead();
- if(spagetize && in.getNumRows()*in.getNumColumns() != numRetRows) {
- throw new RuntimeException("Expected the inputs to be of same size when spagetization is turned on.");
- }
- int inputNumCols = in.getNumColumns();
- if(in.isInSparseFormat()) {
- Iterator<IJV> iter = in.getSparseBlockIterator();
- while(iter.hasNext()) {
- IJV ijv = iter.next();
- if(spagetize) {
- // Perform matrix(X1, rows=length(X1), cols=1) operation before cbind
- // Output Column ID = inputID-2 for all elements of inputs
- int outputRowIndex = ijv.getI()*inputNumCols + ijv.getJ();
- int outputColIndex = inputID-2;
- retData[(int) (outputRowIndex*retMB.getNumColumns() + outputColIndex)] = ijv.getV();
- }
- else {
- // Traditional cbind
- // Row ID remains the same as that of input
- int outputRowIndex = ijv.getI();
- int outputColIndex = ijv.getJ() + startColumn;
- retData[(int) (outputRowIndex*retMB.getNumColumns() + outputColIndex)] = ijv.getV();
- }
+ int startColumn = 0;
+ for(int inputID = 2; inputID < numInputs + 2; inputID++) {
+ MatrixBlock in = ((Matrix) getFunctionInput(inputID)).getMatrixObject().acquireRead();
+ if(spagetize && in.getNumRows()*in.getNumColumns() != numRetRows) {
+ throw new RuntimeException("Expected the inputs to be of same size when spagetization is turned on.");
+ }
+ int inputNumCols = in.getNumColumns();
+ if(in.isInSparseFormat()) {
+ Iterator<IJV> iter = in.getSparseBlockIterator();
+ while(iter.hasNext()) {
+ IJV ijv = iter.next();
+ if(spagetize) {
+ // Perform matrix(X1, rows=length(X1), cols=1) operation before cbind
+ // Output Column ID = inputID-2 for all elements of inputs
+ int outputRowIndex = ijv.getI()*inputNumCols + ijv.getJ();
+ int outputColIndex = inputID-2;
+ retData[(int) (outputRowIndex*retMB.getNumColumns() + outputColIndex)] = ijv.getV();
+ }
+ else {
+ // Traditional cbind
+ // Row ID remains the same as that of input
+ int outputRowIndex = ijv.getI();
+ int outputColIndex = ijv.getJ() + startColumn;
+ retData[(int) (outputRowIndex*retMB.getNumColumns() + outputColIndex)] = ijv.getV();
}
}
- else {
- double [] denseBlock = in.getDenseBlockValues();
- if(denseBlock != null) {
- if(spagetize) {
- // Perform matrix(X1, rows=length(X1), cols=1) operation before cbind
- // Output Column ID = inputID-2 for all elements of inputs
- int j = inputID-2;
- for(int i = 0; i < numRetRows; i++) {
- retData[(int) (i*numRetCols + j)] = denseBlock[i];
- }
+ }
+ else {
+ double [] denseBlock = in.getDenseBlockValues();
+ if(denseBlock != null) {
+ if(spagetize) {
+ // Perform matrix(X1, rows=length(X1), cols=1) operation before cbind
+ // Output Column ID = inputID-2 for all elements of inputs
+ int j = inputID-2;
+ for(int i = 0; i < numRetRows; i++) {
+ retData[(int) (i*numRetCols + j)] = denseBlock[i];
}
- else {
- // Traditional cbind
- // Row ID remains the same as that of input
- for(int i = 0; i < retMB.getNumRows(); i++) {
- for(int j = 0; j < inputNumCols; j++) {
- int outputColIndex = j + startColumn;
- retData[(int) (i*numRetCols + outputColIndex)] = denseBlock[i*inputNumCols + j];
- }
+ }
+ else {
+ // Traditional cbind
+ // Row ID remains the same as that of input
+ for(int i = 0; i < retMB.getNumRows(); i++) {
+ for(int j = 0; j < inputNumCols; j++) {
+ int outputColIndex = j + startColumn;
+ retData[(int) (i*numRetCols + outputColIndex)] = denseBlock[i*inputNumCols + j];
}
}
}
}
- ((Matrix) getFunctionInput(inputID)).getMatrixObject().release();
- startColumn += inputNumCols;
}
- } catch (CacheException e) {
- throw new RuntimeException("Error while executing MultiInputCbind", e);
+ ((Matrix) getFunctionInput(inputID)).getMatrixObject().release();
+ startColumn += inputNumCols;
}
-
+
retMB.recomputeNonZeros();
try {
retMB.examSparsity();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/udf/lib/SGDNesterovUpdate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/udf/lib/SGDNesterovUpdate.java b/src/main/java/org/apache/sysml/udf/lib/SGDNesterovUpdate.java
index a644969..7a7f48e 100644
--- a/src/main/java/org/apache/sysml/udf/lib/SGDNesterovUpdate.java
+++ b/src/main/java/org/apache/sysml/udf/lib/SGDNesterovUpdate.java
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.util.Iterator;
import java.util.Random;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.matrix.data.IJV;
import org.apache.sysml.runtime.matrix.data.InputInfo;
import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -142,8 +141,6 @@ public class SGDNesterovUpdate extends PackageFunction {
((Matrix) getFunctionInput(0)).getMatrixObject().release();
((Matrix) getFunctionInput(1)).getMatrixObject().release();
((Matrix) getFunctionInput(4)).getMatrixObject().release();
- } catch (CacheException e) {
- throw new RuntimeException("Exception while executing SGDNesterovUpdate", e);
} catch (IOException e) {
throw new RuntimeException("Exception while executing SGDNesterovUpdate", e);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/utils/Explain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/utils/Explain.java b/src/main/java/org/apache/sysml/utils/Explain.java
index e0a9c92..12f4d0f 100644
--- a/src/main/java/org/apache/sysml/utils/Explain.java
+++ b/src/main/java/org/apache/sysml/utils/Explain.java
@@ -31,7 +31,6 @@ import org.apache.sysml.hops.BinaryOp;
import org.apache.sysml.hops.DataOp;
import org.apache.sysml.hops.Hop;
import org.apache.sysml.hops.Hop.DataOpTypes;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.hops.ReorgOp;
@@ -49,7 +48,6 @@ import org.apache.sysml.parser.FunctionStatement;
import org.apache.sysml.parser.FunctionStatementBlock;
import org.apache.sysml.parser.IfStatement;
import org.apache.sysml.parser.IfStatementBlock;
-import org.apache.sysml.parser.LanguageException;
import org.apache.sysml.parser.ParForStatementBlock;
import org.apache.sysml.parser.StatementBlock;
import org.apache.sysml.parser.WhileStatement;
@@ -108,8 +106,7 @@ public class Explain
//////////////
// public explain interface
- public static String display(DMLProgram prog, Program rtprog, ExplainType type, ExplainCounts counts)
- throws HopsException, DMLRuntimeException, LanguageException {
+ public static String display(DMLProgram prog, Program rtprog, ExplainType type, ExplainCounts counts) {
if( counts == null )
counts = countDistributedOperations(rtprog);
@@ -198,16 +195,14 @@ public class Explain
sb.append( rk2 );
}
- return sb.toString();
+ return sb.toString();
}
- public static String explain(DMLProgram prog, Program rtprog, ExplainType type)
- throws HopsException, DMLRuntimeException, LanguageException {
+ public static String explain(DMLProgram prog, Program rtprog, ExplainType type) {
return explain(prog, rtprog, type, null);
- }
+ }
public static String explain(DMLProgram prog, Program rtprog, ExplainType type, ExplainCounts counts)
- throws HopsException, DMLRuntimeException, LanguageException
{
//dispatch to individual explain utils
switch( type ) {
@@ -227,7 +222,6 @@ public class Explain
}
public static String explain(DMLProgram prog)
- throws HopsException, DMLRuntimeException, LanguageException
{
StringBuilder sb = new StringBuilder();
@@ -270,8 +264,7 @@ public class Explain
return sb.toString();
}
- public static String getHopDAG(DMLProgram prog, ArrayList<Integer> lines, boolean withSubgraph)
- throws HopsException, DMLRuntimeException, LanguageException {
+ public static String getHopDAG(DMLProgram prog, ArrayList<Integer> lines, boolean withSubgraph) {
StringBuilder sb = new StringBuilder();
StringBuilder nodes = new StringBuilder();
@@ -314,12 +307,11 @@ public class Explain
return sb.toString();
}
- public static String explain( Program rtprog ) throws HopsException {
+ public static String explain( Program rtprog ) {
return explain(rtprog, null);
}
public static String explain( Program rtprog, ExplainCounts counts )
- throws HopsException
{
//counts number of instructions
boolean sparkExec = OptimizerUtils.isSparkExecutionMode();
@@ -328,7 +320,7 @@ public class Explain
countCompiledInstructions(rtprog, counts, !sparkExec, true, sparkExec);
}
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
//create header
sb.append("\nPROGRAM ( size CP/"+(sparkExec?"SP":"MR")+" = ");
@@ -393,34 +385,25 @@ public class Explain
return explainInstructions(inst, level);
}
- public static String explain( Instruction inst )
- {
+ public static String explain( Instruction inst ) {
return explainGenericInstruction(inst, 0);
}
- public static String explain( StatementBlock sb )
- throws HopsException, DMLRuntimeException
- {
+ public static String explain( StatementBlock sb ) {
return explainStatementBlock(sb, 0);
}
- public static String explainHops( ArrayList<Hop> hops )
- throws DMLRuntimeException
- {
+ public static String explainHops( ArrayList<Hop> hops ) {
return explainHops(hops, 0);
}
- public static String explainHops( ArrayList<Hop> hops, int level )
- throws DMLRuntimeException
- {
+ public static String explainHops( ArrayList<Hop> hops, int level ) {
StringBuilder sb = new StringBuilder();
-
Hop.resetVisitStatus(hops);
for( Hop hop : hops )
sb.append(explainHop(hop, level));
Hop.resetVisitStatus(hops);
-
- return sb.toString();
+ return sb.toString();
}
public static String explain( Hop hop )
@@ -515,7 +498,7 @@ public class Explain
}
private static StringBuilder getHopDAG(StatementBlock sb, StringBuilder nodes, ArrayList<Integer> lines,
- boolean withSubgraph) throws HopsException, DMLRuntimeException {
+ boolean withSubgraph) {
StringBuilder builder = new StringBuilder();
if (sb instanceof WhileStatementBlock) {
@@ -618,7 +601,6 @@ public class Explain
}
private static String explainStatementBlock(StatementBlock sb, int level)
- throws HopsException, DMLRuntimeException
{
StringBuilder builder = new StringBuilder();
String offset = createOffset(level);
@@ -1207,7 +1189,6 @@ public class Explain
}
private static String explainFunctionCallGraph(FunctionCallGraph fgraph, HashSet<String> fstack, String fkey, int level)
- throws HopsException
{
StringBuilder builder = new StringBuilder();
String offset = createOffset(level);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/utils/MLContextProxy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/utils/MLContextProxy.java b/src/main/java/org/apache/sysml/utils/MLContextProxy.java
index d67abac..bf769bb 100644
--- a/src/main/java/org/apache/sysml/utils/MLContextProxy.java
+++ b/src/main/java/org/apache/sysml/utils/MLContextProxy.java
@@ -22,7 +22,6 @@ package org.apache.sysml.utils;
import org.apache.sysml.api.mlcontext.MLContext;
import org.apache.sysml.api.mlcontext.MLContextException;
import org.apache.sysml.parser.Expression;
-import org.apache.sysml.parser.LanguageException;
/**
* The purpose of this proxy is to shield systemml internals from direct access to MLContext
@@ -44,9 +43,7 @@ public class MLContextProxy
return _active;
}
- public static void setAppropriateVarsForRead(Expression source, String targetname)
- throws LanguageException
- {
+ public static void setAppropriateVarsForRead(Expression source, String targetname) {
MLContext.getActiveMLContext().getInternalProxy().setAppropriateVarsForRead(source, targetname);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/yarn/DMLYarnClient.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/DMLYarnClient.java b/src/main/java/org/apache/sysml/yarn/DMLYarnClient.java
index 837ad32..4f49cd9 100644
--- a/src/main/java/org/apache/sysml/yarn/DMLYarnClient.java
+++ b/src/main/java/org/apache/sysml/yarn/DMLYarnClient.java
@@ -53,7 +53,6 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.hadoop.yarn.util.Records;
import org.apache.sysml.conf.DMLConfig;
-import org.apache.sysml.parser.ParseException;
import org.apache.sysml.runtime.DMLRuntimeException;
import org.apache.sysml.runtime.DMLScriptException;
import org.apache.sysml.runtime.controlprogram.parfor.stat.Timing;
@@ -263,7 +262,7 @@ public class DMLYarnClient
@SuppressWarnings("deprecation")
private void copyResourcesToHdfsWorkingDir( YarnConfiguration yconf, String hdfsWD )
- throws ParseException, IOException, DMLRuntimeException, InterruptedException
+ throws IOException, InterruptedException
{
Path confPath = new Path(hdfsWD, DML_CONFIG_NAME);
FileSystem fs = IOUtilFunctions.getFileSystem(confPath, yconf);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java b/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
index 934967e..a295218 100644
--- a/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
+++ b/src/main/java/org/apache/sysml/yarn/ropt/GridEnumerationMemory.java
@@ -96,16 +96,12 @@ public class GridEnumerationMemory extends GridEnumeration
return val;
}
- private void getMemoryEstimates( ArrayList<ProgramBlock> pbs, ArrayList<Long> mem )
- throws HopsException
- {
+ private void getMemoryEstimates( ArrayList<ProgramBlock> pbs, ArrayList<Long> mem ) {
for( ProgramBlock pb : pbs )
getMemoryEstimates(pb, mem);
}
- private void getMemoryEstimates( ProgramBlock pb, ArrayList<Long> mem )
- throws HopsException
- {
+ private void getMemoryEstimates( ProgramBlock pb, ArrayList<Long> mem ) {
if (pb instanceof FunctionProgramBlock)
{
FunctionProgramBlock fpb = (FunctionProgramBlock)pb;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/yarn/ropt/ResourceConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/ropt/ResourceConfig.java b/src/main/java/org/apache/sysml/yarn/ropt/ResourceConfig.java
index b2d20d1..610fe79 100644
--- a/src/main/java/org/apache/sysml/yarn/ropt/ResourceConfig.java
+++ b/src/main/java/org/apache/sysml/yarn/ropt/ResourceConfig.java
@@ -22,7 +22,6 @@ package org.apache.sysml.yarn.ropt;
import java.util.ArrayList;
import java.util.Collections;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.parser.ForStatementBlock;
import org.apache.sysml.parser.IfStatementBlock;
import org.apache.sysml.parser.WhileStatementBlock;
@@ -45,9 +44,7 @@ public class ResourceConfig
_mrres = mr;
}
- public ResourceConfig( ArrayList<ProgramBlock> prog, long init )
- throws HopsException
- {
+ public ResourceConfig( ArrayList<ProgramBlock> prog, long init ) {
//init cp memory
_cpres = init;
@@ -56,35 +53,28 @@ public class ResourceConfig
addProgramBlocks(prog, init);
}
- public long getCPResource()
- {
+ public long getCPResource() {
return (long)_cpres;
}
- public void setCPResource( long res )
- {
+ public void setCPResource( long res ) {
_cpres = res;
}
- public long getMRResources( int i )
- throws DMLRuntimeException
- {
+ public long getMRResources( int i ) {
if( _mrres.size() <= i )
throw new DMLRuntimeException("Memo table out-of-bounds: "+_mrres.size()+" vs "+i);
-
return _mrres.get(i);
}
- public double[][] getMRResourcesMemo()
- {
+ public double[][] getMRResourcesMemo() {
int len = _mrres.size();
double[][] ret = new double[len][2];
for( int i=0; i< len; i++ ){
ret[i][0] = _mrres.get(i);
ret[i][1] = -1;
}
-
return ret;
}
@@ -142,15 +132,12 @@ public class ResourceConfig
return new ResourceConfig(cp, mr);
}
- private void addProgramBlocks( ArrayList<ProgramBlock> pbs, long init )
- throws HopsException
- {
+ private void addProgramBlocks( ArrayList<ProgramBlock> pbs, long init ) {
for( ProgramBlock pb : pbs )
addProgramBlock(pb, init);
}
private void addProgramBlock( ProgramBlock pb, long init )
- throws HopsException
{
if (pb instanceof FunctionProgramBlock)
{
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
index 43030da..18b9156 100644
--- a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
+++ b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizer.java
@@ -448,7 +448,6 @@ public class ResourceOptimizer
}
private static ArrayList<ProgramBlock> pruneProgramBlocks( ArrayList<ProgramBlock> B )
- throws HopsException
{
//prune all program blocks w/o mr instructions (mr budget does not matter)
if( PRUNING_SMALL ){
@@ -468,11 +467,10 @@ public class ResourceOptimizer
B = Bp;
}
- return B;
+ return B;
}
private static boolean pruneHasOnlyUnknownMR( ProgramBlock pb )
- throws HopsException
{
if (pb instanceof WhileProgramBlock)
{
@@ -503,18 +501,14 @@ public class ResourceOptimizer
}
}
- private static boolean pruneHasOnlyUnknownMR( ArrayList<Hop> hops )
- throws HopsException
- {
+ private static boolean pruneHasOnlyUnknownMR( ArrayList<Hop> hops ) {
boolean ret = false;
-
if( hops!=null ){
ret = true;
Hop.resetVisitStatus(hops);
for( Hop hop : hops )
ret &= pruneHasOnlyUnknownMR(hop);
}
-
return ret;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizerCPMigration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizerCPMigration.java b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizerCPMigration.java
index 2b7886f..b9d6b51 100644
--- a/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizerCPMigration.java
+++ b/src/main/java/org/apache/sysml/yarn/ropt/ResourceOptimizerCPMigration.java
@@ -24,248 +24,6 @@ package org.apache.sysml.yarn.ropt;
* Experimental feature not used in production.
*
*/
-public class ResourceOptimizerCPMigration
-{
-
- /*// FIXME MB
- private static final Log LOG = LogFactory.getLog(CPMigrationOptimizer.class.getName());
-
- public static void initResumeInfoFromFile(String file, ExecutionContext ec) throws IOException, DMLRuntimeException {
- DMLScript.resumeSbIdRStack.clear();
- DMLScript.resumeFuncVarRStack.clear();
- DMLScript.resumeLoopAndFuncEntryVarRStack.clear();
- if (file == null)
- return;
-
- FileSystem fs = FileSystem.get(new YarnConfiguration());
- Path path = new Path(file);
- if (!fs.exists(path))
- throw new IOException("File " + file + " does not exist");
-
- //BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(path)));
- FSDataInputStream reader = fs.open(path);
- DMLScript.predecessorAppIdStr = reader.readUTF().trim();
- DMLScript.resumeSbIdRStack = DMLScript.deserializeToReverseStack(reader.readUTF().trim());
-
- // Read and invert the function symbol table stack
- Stack<LocalVariableMap> tmpStack = new Stack<LocalVariableMap>();
- int n = Integer.parseInt(reader.readUTF().trim());
- for (int i = 0; i < n; i++)
- tmpStack.push(LocalVariableMap.deserialize(reader.readUTF().trim()));
- for (int i = 0; i < n; i++)
- DMLScript.resumeFuncVarRStack.push(tmpStack.pop());
-
- // Read and invert the loop and func entry symbol table stack
- tmpStack.clear();
- n = Integer.parseInt(reader.readUTF().trim());
- for (int i = 0; i < n; i++)
- tmpStack.push(LocalVariableMap.deserialize(reader.readUTF().trim()));
- for (int i = 0; i < n; i++)
- DMLScript.resumeLoopAndFuncEntryVarRStack.push(tmpStack.pop());
-
- reader.close();
-
- // Append this CP's AppId to the predecessor's resume file
- FSDataOutputStream fout = fs.append(path);
- fout.writeUTF(MyApplicationMaster.appId + "\n");
- fout.close();
-
- // Log the resume info
- StringBuilder sb = new StringBuilder();
- sb.append("Predecessor is " + DMLScript.predecessorAppIdStr + "\n");
- sb.append("Inverse sbID stack: ");
- for (Long l : DMLScript.resumeSbIdRStack)
- sb.append(l + ", ");
- sb.append("\n" + DMLScript.resumeFuncVarRStack.size() + " inverse function symbol table stack:\n");
- for (LocalVariableMap symbolTable : DMLScript.resumeFuncVarRStack)
- sb.append("\t" + symbolTable.serialize() + "\n");
- sb.append(DMLScript.resumeLoopAndFuncEntryVarRStack.size() + " inverse loop and func entry symbol table stack:\n");
- for (LocalVariableMap symbolTable : DMLScript.resumeLoopAndFuncEntryVarRStack)
- sb.append("\t" + symbolTable.serialize() + "\n");
- LOG.info(sb.toString());
-
- // Recover the most outer layer of symbol table before execution starts
- LocalVariableMap varMap = DMLScript.resumeFuncVarRStack.pop();
- DMLScript.lastPopedFuncVarStr = varMap.serialize(); // For later correctness check
- ec.setVariables(varMap);
- }
-
- // Try to migrate to a new CP, return false if failed
- public static boolean migrateCP(LocalVariableMap currentSymbolTable) throws DMLRuntimeException {
- DMLScript.execFuncVarStack.push(currentSymbolTable);
-
- long start = System.currentTimeMillis();
- for (LocalVariableMap symbolTable : DMLScript.execFuncVarStack) {
- for (String var : symbolTable.keySet()) {
- Data data = symbolTable.get(var);
- if ( data.getDataType() == DataType.MATRIX ) {
- long time = System.currentTimeMillis();
- MatrixObject matrix = (MatrixObject) data;
- matrix.exportData();
- time = System.currentTimeMillis() - time;
- LOG.info("Exporting " + var + " took " + time + "ms");
- }
- }
- }
- start = System.currentTimeMillis() - start;
- LOG.info("Exporting data to hdfs took " + start + "ms");
-
- DMLConfig config = ConfigurationManager.getConfig();
- String hdfsWorkingDir = MyYarnClient.getHDFSWorkingDir(config, MyApplicationMaster.appId);
-
- try {
- FileSystem fs = FileSystem.get(MyApplicationMaster.conf);
- Path resume_file = new Path(hdfsWorkingDir, DMLScript.CP_RESUME_HDFS_FILE);
- if (fs.exists(resume_file))
- throw new IOException("File " + resume_file + " already exists?");
-
- FSDataOutputStream fout = fs.create(resume_file);
- fout.writeUTF(MyApplicationMaster.appId + "\n");
-
- String tmp = DMLScript.serializeExecSbIdStack(DMLScript.execSbIdStack);
- fout.writeUTF(tmp + "\n");
- LOG.info("SbId Stack: " + tmp);
-
- fout.writeUTF(DMLScript.execFuncVarStack.size() + "\n");
- LOG.info(DMLScript.execFuncVarStack.size() + " func symbol tables");
- for (LocalVariableMap symbolTable : DMLScript.execFuncVarStack) {
- tmp = symbolTable.serialize();
- fout.writeUTF(symbolTable.serialize() + "\n");
- LOG.info("\t" + tmp);
- }
-
- fout.writeUTF(DMLScript.execLoopAndFuncEntryVarStack.size() + "\n");
- LOG.info(DMLScript.execLoopAndFuncEntryVarStack.size() + " loop and func entry symbol tables");
- for (LocalVariableMap symbolTable : DMLScript.execLoopAndFuncEntryVarStack) {
- tmp = symbolTable.serialize();
- fout.writeUTF(symbolTable.serialize() + "\n");
- LOG.info("\t" + tmp);
- }
- fout.close();
-
- // If specified, run the new CP within this old CP automatically
- if (DMLScript.newCpBudgetByte != -1) {
- YarnApplicationState state;
- MyYarnClient client = new MyYarnClient();
- state = client.runResumeCP(MyApplicationMaster.fullArgs, DMLScript.newCpBudgetByte, hdfsWorkingDir);
- if (state != YarnApplicationState.FINISHED)
- throw new DMLRuntimeException("Resuming CP " + state);
- }
- } catch (Exception e) {
- throw new DMLRuntimeException(e);
- }
-
- // Make this CP stop gracefully
- DMLScript.migratedAndStop = true;
-
- LOG.info("CP migration done, exiting gracefully");
- return true;
- }
-
-
-
-
-
- // A complete full copy of the runtime plan for recompile and costing
- public ArrayList<ProgramBlock> copiedProgramBlocks;
- Program prog;
-
- public HashMap<Long, ProgramBlock> sbIdMap; // Pointer to all reachable program blocks
-
- public CPMigrationOptimizer(Program rtprog) throws DMLRuntimeException, HopsException {
- prog = rtprog;
- copiedProgramBlocks = ProgramConverter.rcreateDeepCopyProgramBlocks(prog._programBlocks, 1, -1, new HashSet<String>(), false);
-
- // Temporarily disable dynamic recompile to clear all flags
- boolean flag = OptimizerUtils.ALLOW_DYN_RECOMPILATION;
- OptimizerUtils.ALLOW_DYN_RECOMPILATION = false;
-
- sbIdMap = new HashMap<Long, ProgramBlock> ();
- for (ProgramBlock pb : copiedProgramBlocks)
- initTraverse(pb);
- OptimizerUtils.ALLOW_DYN_RECOMPILATION = flag;
-
-
- }
-
- public void recompile() throws HopsException {
- resetAllFlags();
- }
-
- public boolean shouldMigrate(Stack<Long> execSbIdStack, Stack<LocalVariableMap> execLoopAndFuncEntryVarStack)
- throws HopsException {
-
- int i = 0, j = 0;
- int base = -1; // Index of base function, -1 for main
- LocalVariableMap baseVar = new LocalVariableMap();
- int loop = -1; // Index of the outer most loop
- HashMap<Long, LocalVariableMap> loopEntryVarMap = new HashMap<Long, LocalVariableMap>();
-
- for (Long sbId : execSbIdStack) {
- ProgramBlock pb = sbIdMap.get(sbId);
- if (pb instanceof FunctionProgramBlock) {
- base = i;
- baseVar = execLoopAndFuncEntryVarStack.get(j);
- loop = -1;
- loopEntryVarMap.clear();
- j++;
- } else if (pb instanceof WhileProgramBlock || pb instanceof ForProgramBlock) {
- if (loop == -1)
- loop = i;
- loopEntryVarMap.put(sbId, execLoopAndFuncEntryVarStack.get(j));
- j++;
- }
- i++;
- }
-
- // To be continued !!!!!
-
- return false;
- }
-
- public void resetAllFlags() throws HopsException {
- boolean flag = OptimizerUtils.ALLOW_DYN_RECOMPILATION;
- OptimizerUtils.ALLOW_DYN_RECOMPILATION = false;
- for (Map.Entry<Long, ProgramBlock> entry : sbIdMap.entrySet())
- entry.getValue().getStatementBlock().updateRecompilationFlag();
- OptimizerUtils.ALLOW_DYN_RECOMPILATION = flag;
- }
-
- public void initTraverse(ProgramBlock pb) throws HopsException, DMLRuntimeException {
- long sbId = pb.getStatementBlock().getID();
- if (sbIdMap.containsKey(sbId))
- return;
-
- sbIdMap.put(sbId, pb);
- if (pb instanceof WhileProgramBlock) {
- WhileProgramBlock tmp = (WhileProgramBlock)pb;
- for (ProgramBlock pb2 : tmp.getChildBlocks())
- initTraverse(pb2);
- } else if (pb instanceof IfProgramBlock) {
- IfProgramBlock tmp = (IfProgramBlock)pb;
- for (ProgramBlock pb2 : tmp.getChildBlocksIfBody())
- initTraverse(pb2);
- for (ProgramBlock pb2 : tmp.getChildBlocksElseBody())
- initTraverse(pb2);
- } else if (pb instanceof ForProgramBlock) {
- ForProgramBlock tmp = (ForProgramBlock)pb;
- for (ProgramBlock pb2 : tmp.getChildBlocks())
- initTraverse(pb2);
- } else if (pb instanceof FunctionProgramBlock && !(pb instanceof ExternalFunctionProgramBlock)) {
- FunctionProgramBlock tmp = (FunctionProgramBlock) pb;
- for (ProgramBlock pb2 : tmp.getChildBlocks())
- initTraverse(pb2);
- } else {
- // Clear the flag on leaf blocks
- pb.getStatementBlock().updateRecompilationFlag();
- for (Instruction inst : pb.getInstructions()) {
- if (inst instanceof FunctionCallCPInstruction) {
- FunctionCallCPInstruction finst = (FunctionCallCPInstruction)inst;
- initTraverse(prog.getFunctionProgramBlock(finst.getNamespace(), finst.getFunctionName()));
- }
- }
- }
- }
-
- */
+public class ResourceOptimizerCPMigration {
+ // FIXME MB
}
[03/10] systemml git commit: [SYSTEMML-2190] Change parser/hops block
sizes from long to int
Posted by mb...@apache.org.
[SYSTEMML-2190] Change parser/hops block sizes from long to int
This patch refactors the parser and hop data structures to use int
instead of long block sizes for consistency the runtime and avoid
unnecessarily bloated compiler data structures.
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/2b74a794
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/2b74a794
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/2b74a794
Branch: refs/heads/master
Commit: 2b74a794480f6ee830443c393bbf164fc13676df
Parents: b3419b0
Author: Matthias Boehm <mb...@gmail.com>
Authored: Fri Mar 23 19:00:07 2018 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Fri Mar 23 22:18:26 2018 -0700
----------------------------------------------------------------------
src/main/java/org/apache/sysml/hops/DataOp.java | 6 +--
src/main/java/org/apache/sysml/hops/Hop.java | 14 +++----
.../org/apache/sysml/hops/LeftIndexingOp.java | 9 ++--
.../sysml/hops/ParameterizedBuiltinOp.java | 14 +++----
.../apache/sysml/hops/cost/CostEstimator.java | 20 ++++-----
.../hops/cost/CostEstimatorStaticRuntime.java | 12 +++---
.../org/apache/sysml/hops/cost/VarStats.java | 20 ++++-----
.../sysml/hops/rewrite/HopRewriteUtils.java | 8 ++--
.../RewriteSplitDagDataDependentOperators.java | 4 +-
.../rewrite/RewriteSplitDagUnknownCSVRead.java | 4 +-
.../java/org/apache/sysml/lops/CSVReBlock.java | 31 ++++++--------
.../java/org/apache/sysml/lops/ReBlock.java | 9 ++--
.../sysml/parser/BuiltinFunctionExpression.java | 28 ++++++-------
.../org/apache/sysml/parser/DataExpression.java | 7 ++--
.../org/apache/sysml/parser/DataIdentifier.java | 17 +++-----
.../org/apache/sysml/parser/Expression.java | 43 +++++++-------------
.../org/apache/sysml/parser/Identifier.java | 20 ++++-----
.../sysml/parser/RelationalExpression.java | 8 ++--
.../context/ExecutionContext.java | 14 +++----
.../runtime/matrix/MatrixCharacteristics.java | 12 ++++--
.../functions/codegen/CPlanComparisonTest.java | 4 +-
21 files changed, 134 insertions(+), 170 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/DataOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/DataOp.java b/src/main/java/org/apache/sysml/hops/DataOp.java
index 01e4878..2495997 100644
--- a/src/main/java/org/apache/sysml/hops/DataOp.java
+++ b/src/main/java/org/apache/sysml/hops/DataOp.java
@@ -80,7 +80,7 @@ public class DataOp extends Hop
* @param colsPerBlock cols per block
*/
public DataOp(String l, DataType dt, ValueType vt, DataOpTypes dop,
- String fname, long dim1, long dim2, long nnz, long rowsPerBlock, long colsPerBlock) {
+ String fname, long dim1, long dim2, long nnz, int rowsPerBlock, int colsPerBlock) {
super(l, dt, vt);
_dataop = dop;
@@ -96,7 +96,7 @@ public class DataOp extends Hop
}
public DataOp(String l, DataType dt, ValueType vt, DataOpTypes dop,
- String fname, long dim1, long dim2, long nnz, UpdateType update, long rowsPerBlock, long colsPerBlock) {
+ String fname, long dim1, long dim2, long nnz, UpdateType update, int rowsPerBlock, int colsPerBlock) {
this(l, dt, vt, dop, fname, dim1, dim2, nnz, rowsPerBlock, colsPerBlock);
setUpdateType(update);
}
@@ -218,7 +218,7 @@ public class DataOp extends Hop
_dataop = type;
}
- public void setOutputParams(long dim1, long dim2, long nnz, UpdateType update, long rowsPerBlock, long colsPerBlock) {
+ public void setOutputParams(long dim1, long dim2, long nnz, UpdateType update, int rowsPerBlock, int colsPerBlock) {
setDim1(dim1);
setDim2(dim2);
setNnz(nnz);
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/Hop.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/Hop.java b/src/main/java/org/apache/sysml/hops/Hop.java
index 31ccd33..0ced336 100644
--- a/src/main/java/org/apache/sysml/hops/Hop.java
+++ b/src/main/java/org/apache/sysml/hops/Hop.java
@@ -80,8 +80,8 @@ public abstract class Hop implements ParseInfo
protected boolean _visited = false;
protected long _dim1 = -1;
protected long _dim2 = -1;
- protected long _rows_in_block = -1;
- protected long _cols_in_block = -1;
+ protected int _rows_in_block = -1;
+ protected int _cols_in_block = -1;
protected long _nnz = -1;
protected UpdateType _updateType = UpdateType.COPY;
@@ -253,7 +253,7 @@ public abstract class Hop implements ParseInfo
return false;
}
- public void setOutputBlocksizes( long brlen, long bclen ) {
+ public void setOutputBlocksizes(int brlen, int bclen) {
setRowsInBlock( brlen );
setColsInBlock( bclen );
}
@@ -787,19 +787,19 @@ public abstract class Hop implements ParseInfo
h._parent.add(this);
}
- public long getRowsInBlock() {
+ public int getRowsInBlock() {
return _rows_in_block;
}
- public void setRowsInBlock(long rowsInBlock) {
+ public void setRowsInBlock(int rowsInBlock) {
_rows_in_block = rowsInBlock;
}
- public long getColsInBlock() {
+ public int getColsInBlock() {
return _cols_in_block;
}
- public void setColsInBlock(long colsInBlock) {
+ public void setColsInBlock(int colsInBlock) {
_cols_in_block = colsInBlock;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java b/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
index a660d24..2ca90ab 100644
--- a/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
+++ b/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
@@ -133,12 +133,9 @@ public class LeftIndexingOp extends Hop
if (isRightHandSideScalar()) {
//insert cast to matrix if necessary (for reuse MR runtime)
rightInput = new UnaryCP(getInput().get(1).constructLops(),
- OperationTypes.CAST_AS_MATRIX,
- DataType.MATRIX, ValueType.DOUBLE);
- rightInput.getOutputParameters().setDimensions( (long)1, (long)1,
- (long)ConfigurationManager.getBlocksize(),
- (long)ConfigurationManager.getBlocksize(),
- (long)-1);
+ OperationTypes.CAST_AS_MATRIX, DataType.MATRIX, ValueType.DOUBLE);
+ rightInput.getOutputParameters().setDimensions(1L, 1L,
+ ConfigurationManager.getBlocksize(), ConfigurationManager.getBlocksize(), -1L);
}
else
rightInput = getInput().get(1).constructLops();
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java b/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
index 302fb7a..a1cea17 100644
--- a/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
+++ b/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
@@ -480,8 +480,8 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
{
//get input vector (without materializing diag())
Hop input = targetHop.getInput().get(0);
- long brlen = input.getRowsInBlock();
- long bclen = input.getColsInBlock();
+ int brlen = input.getRowsInBlock();
+ int bclen = input.getColsInBlock();
MemoTable memo = new MemoTable();
boolean isPPredInput = (input instanceof BinaryOp && ((BinaryOp)input).isPPredOperation());
@@ -545,8 +545,8 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
Hop input = targetHop;
long rlen = input.getDim1();
long clen = input.getDim2();
- long brlen = input.getRowsInBlock();
- long bclen = input.getColsInBlock();
+ int brlen = input.getRowsInBlock();
+ int bclen = input.getColsInBlock();
long nnz = input.getNnz();
boolean rmRows = ((LiteralOp)marginHop).getStringValue().equals("rows");
@@ -576,7 +576,7 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
Hop cumsumInput = emptyInd;
if( !rmRows ){
cumsumInput = HopRewriteUtils.createTranspose(emptyInd);
- HopRewriteUtils.updateHopCharacteristics(cumsumInput, brlen, bclen, this);
+ HopRewriteUtils.updateHopCharacteristics(cumsumInput, brlen, bclen, this);
}
UnaryOp cumsum = HopRewriteUtils.createUnary(cumsumInput, OpOp1.CUMSUM);
@@ -673,8 +673,8 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
Hop input = targetHop;
long rlen = input.getDim1();
long clen = input.getDim2();
- long brlen = input.getRowsInBlock();
- long bclen = input.getColsInBlock();
+ int brlen = input.getRowsInBlock();
+ int bclen = input.getColsInBlock();
boolean rmRows = ((LiteralOp)marginHop).getStringValue().equals("rows");
//construct lops via new partial hop dag and subsequent lops construction
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java b/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
index 341c320..f09de20 100644
--- a/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
+++ b/src/main/java/org/apache/sysml/hops/cost/CostEstimator.java
@@ -229,8 +229,8 @@ public abstract class CostEstimator
MatrixCharacteristics mc = mo.getMatrixCharacteristics();
long rlen = mc.getRows();
long clen = mc.getCols();
- long brlen = mc.getRowsPerBlock();
- long bclen = mc.getColsPerBlock();
+ int brlen = mc.getRowsPerBlock();
+ int bclen = mc.getColsPerBlock();
long nnz = mc.getNonZeros();
boolean inmem = mo.getStatusAsString().equals("CACHED");
vs = new VarStats(rlen, clen, brlen, bclen, nnz, inmem);
@@ -257,8 +257,8 @@ public abstract class CostEstimator
String varname = parts[1];
long rlen = Long.parseLong(parts[6]);
long clen = Long.parseLong(parts[7]);
- long brlen = Long.parseLong(parts[8]);
- long bclen = Long.parseLong(parts[9]);
+ int brlen = Integer.parseInt(parts[8]);
+ int bclen = Integer.parseInt(parts[9]);
long nnz = Long.parseLong(parts[10]);
VarStats vs = new VarStats(rlen, clen, brlen, bclen, nnz, false);
stats.put(varname, vs);
@@ -285,8 +285,8 @@ public abstract class CostEstimator
String varname = randInst.output.getName();
long rlen = randInst.getRows();
long clen = randInst.getCols();
- long brlen = randInst.getRowsInBlock();
- long bclen = randInst.getColsInBlock();
+ int brlen = randInst.getRowsInBlock();
+ int bclen = randInst.getColsInBlock();
long nnz = (long) (randInst.getSparsity() * rlen * clen);
VarStats vs = new VarStats(rlen, clen, brlen, bclen, nnz, true);
stats.put(varname, vs);
@@ -335,11 +335,11 @@ public abstract class CostEstimator
byte outIndex = Byte.parseByte(parts[2]);
long rlen = parts[3].contains(Lop.VARIABLE_NAME_PLACEHOLDER)?-1:UtilFunctions.parseToLong(parts[3]);
long clen = parts[4].contains(Lop.VARIABLE_NAME_PLACEHOLDER)?-1:UtilFunctions.parseToLong(parts[4]);
- long brlen = Long.parseLong(parts[5]);
- long bclen = Long.parseLong(parts[6]);
+ int brlen = Integer.parseInt(parts[5]);
+ int bclen = Integer.parseInt(parts[6]);
long nnz = (long) (Double.parseDouble(parts[9]) * rlen * clen);
VarStats vs = new VarStats(rlen, clen, brlen, bclen, nnz, false);
- stats.put(String.valueOf(outIndex), vs);
+ stats.put(String.valueOf(outIndex), vs);
}
}
@@ -354,7 +354,7 @@ public abstract class CostEstimator
VarStats vs = e.getValue();
if( vs !=null )
{
- MatrixCharacteristics mc = new MatrixCharacteristics(vs._rlen, vs._clen, (int)vs._brlen, (int)vs._bclen, (long)vs._nnz);
+ MatrixCharacteristics mc = new MatrixCharacteristics(vs._rlen, vs._clen, vs._brlen, vs._bclen, (long)vs._nnz);
dims.put(ix, mc);
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java b/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
index 1d4074d..8329493 100644
--- a/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
+++ b/src/main/java/org/apache/sysml/hops/cost/CostEstimatorStaticRuntime.java
@@ -659,8 +659,8 @@ public class CostEstimatorStaticRuntime extends CostEstimator
{
boolean sparse = MatrixBlock.evalSparseFormatOnDisk(dm, dn, (long)(ds*dm*dn));
- double bytes = (double)MatrixBlock.estimateSizeOnDisk((long)dm, (long)dn, (long)(ds*dm*dn));
- double mbytes = bytes / (1024*1024);
+ double bytes = (double)MatrixBlock.estimateSizeOnDisk(dm, dn, (long)(ds*dm*dn));
+ double mbytes = bytes / (1024*1024);
double ret = -1;
if( sparse )
@@ -679,8 +679,8 @@ public class CostEstimatorStaticRuntime extends CostEstimator
{
boolean sparse = MatrixBlock.evalSparseFormatOnDisk(dm, dn, (long)(ds*dm*dn));
- double bytes = (double)MatrixBlock.estimateSizeOnDisk((long)dm, (long)dn, (long)(ds*dm*dn));
- double mbytes = bytes / (1024*1024);
+ double bytes = (double)MatrixBlock.estimateSizeOnDisk(dm, dn, (long)(ds*dm*dn));
+ double mbytes = bytes / (1024*1024);
double ret = -1;
@@ -719,7 +719,7 @@ public class CostEstimatorStaticRuntime extends CostEstimator
{
boolean sparse = MatrixBlock.evalSparseFormatOnDisk(dm, dn, (long)(ds*dm*dn));
- double ret = ((double)MatrixBlock.estimateSizeOnDisk((long)dm, (long)dn, (long)(ds*dm*dn))) / (1024*1024);
+ double ret = ((double)MatrixBlock.estimateSizeOnDisk(dm, dn, (long)(ds*dm*dn))) / (1024*1024);
if( sparse )
ret /= DEFAULT_MBS_FSREAD_BINARYBLOCK_SPARSE;
else //dense
@@ -732,7 +732,7 @@ public class CostEstimatorStaticRuntime extends CostEstimator
{
boolean sparse = MatrixBlock.evalSparseFormatOnDisk(dm, dn, (long)(ds*dm*dn));
- double ret = ((double)MatrixBlock.estimateSizeOnDisk((long)dm, (long)dn, (long)(ds*dm*dn))) / (1024*1024);
+ double ret = ((double)MatrixBlock.estimateSizeOnDisk(dm, dn, (long)(ds*dm*dn))) / (1024*1024);
if( sparse )
ret /= DEFAULT_MBS_FSWRITE_BINARYBLOCK_SPARSE;
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/cost/VarStats.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/cost/VarStats.java b/src/main/java/org/apache/sysml/hops/cost/VarStats.java
index 8709a50..3fc2c03 100644
--- a/src/main/java/org/apache/sysml/hops/cost/VarStats.java
+++ b/src/main/java/org/apache/sysml/hops/cost/VarStats.java
@@ -19,19 +19,18 @@
package org.apache.sysml.hops.cost;
-public class VarStats
-{
+import org.apache.sysml.hops.OptimizerUtils;
-
+public class VarStats
+{
long _rlen = -1;
long _clen = -1;
- long _brlen = -1;
- long _bclen = -1;
- double _nnz = -1;
+ int _brlen = -1;
+ int _bclen = -1;
+ long _nnz = -1;
boolean _inmem = false;
- public VarStats( long rlen, long clen, long brlen, long bclen, long nnz, boolean inmem )
- {
+ public VarStats( long rlen, long clen, int brlen, int bclen, long nnz, boolean inmem ) {
_rlen = rlen;
_clen = clen;
_brlen = brlen;
@@ -40,9 +39,8 @@ public class VarStats
_inmem = inmem;
}
- public double getSparsity()
- {
- return (_nnz<0) ? 1.0 : (double)_nnz/_rlen/_clen;
+ public double getSparsity() {
+ return OptimizerUtils.getSparsity(_rlen, _clen, _nnz);
}
@Override
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
index 74711e3..abb1c7d 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/HopRewriteUtils.java
@@ -738,7 +738,7 @@ public class HopRewriteUtils
return dop;
}
- public static void setOutputParameters( Hop hop, long rlen, long clen, long brlen, long bclen, long nnz ) {
+ public static void setOutputParameters( Hop hop, long rlen, long clen, int brlen, int bclen, long nnz ) {
hop.setDim1( rlen );
hop.setDim2( clen );
hop.setOutputBlocksizes(brlen, bclen );
@@ -764,13 +764,11 @@ public class HopRewriteUtils
dest.setParseInfo(src);
}
- public static void updateHopCharacteristics( Hop hop, long brlen, long bclen, Hop src )
- {
+ public static void updateHopCharacteristics( Hop hop, int brlen, int bclen, Hop src ) {
updateHopCharacteristics(hop, brlen, bclen, new MemoTable(), src);
}
- public static void updateHopCharacteristics( Hop hop, long brlen, long bclen, MemoTable memo, Hop src )
- {
+ public static void updateHopCharacteristics( Hop hop, int brlen, int bclen, MemoTable memo, Hop src ) {
//update block sizes and dimensions
hop.setOutputBlocksizes(brlen, bclen);
hop.refreshSizeInformation();
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
index 13f4a50..b7ab7d1 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagDataDependentOperators.java
@@ -126,8 +126,8 @@ public class RewriteSplitDagDataDependentOperators extends StatementBlockRewrite
long clen = c.getDim2();
long nnz = c.getNnz();
UpdateType update = c.getUpdateType();
- long brlen = c.getRowsInBlock();
- long bclen = c.getColsInBlock();
+ int brlen = c.getRowsInBlock();
+ int bclen = c.getColsInBlock();
if( hasTWrites && moveTWrite) //reuse existing transient_write
{
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
index 5351c0d..3e423b8 100644
--- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
+++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteSplitDagUnknownCSVRead.java
@@ -86,8 +86,8 @@ public class RewriteSplitDagUnknownCSVRead extends StatementBlockRewriteRule
long clen = reblock.getDim2();
long nnz = reblock.getNnz();
UpdateType update = reblock.getUpdateType();
- long brlen = reblock.getRowsInBlock();
- long bclen = reblock.getColsInBlock();
+ int brlen = reblock.getRowsInBlock();
+ int bclen = reblock.getColsInBlock();
//replace reblock inputs to avoid dangling references across dags
//(otherwise, for instance, literal ops are shared across dags)
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/lops/CSVReBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CSVReBlock.java b/src/main/java/org/apache/sysml/lops/CSVReBlock.java
index 55571f7..1217cd1 100644
--- a/src/main/java/org/apache/sysml/lops/CSVReBlock.java
+++ b/src/main/java/org/apache/sysml/lops/CSVReBlock.java
@@ -32,34 +32,30 @@ import org.apache.sysml.parser.Expression.ValueType;
*/
public class CSVReBlock extends Lop
{
-
public static final String OPCODE = "csvrblk";
- Long rows_per_block;
- Long cols_per_block;
+ private int _rows_per_block;
+ private int _cols_per_block;
- public CSVReBlock(Lop input, Long rows_per_block, Long cols_per_block, DataType dt, ValueType vt, ExecType et) throws LopsException
+ public CSVReBlock(Lop input, int rows_per_block, int cols_per_block, DataType dt, ValueType vt, ExecType et) throws LopsException
{
- super(Lop.Type.CSVReBlock, dt, vt);
- this.addInput(input);
+ super(Lop.Type.CSVReBlock, dt, vt);
+ addInput(input);
input.addOutput(this);
- this.rows_per_block = rows_per_block;
- this.cols_per_block = cols_per_block;
+ _rows_per_block = rows_per_block;
+ _cols_per_block = cols_per_block;
- /*
- * This lop can be executed only in CSVREBLOCK job.
- */
boolean breaksAlignment = false;
boolean aligner = false;
boolean definesMRJob = true;
lps.addCompatibility(JobType.CSV_REBLOCK);
if(et == ExecType.MR) {
- this.lps.setProperties( inputs, ExecType.MR, ExecLocation.MapAndReduce, breaksAlignment, aligner, definesMRJob );
+ lps.setProperties( inputs, ExecType.MR, ExecLocation.MapAndReduce, breaksAlignment, aligner, definesMRJob );
}
else if(et == ExecType.SPARK) {
- this.lps.setProperties( inputs, ExecType.SPARK, ExecLocation.ControlProgram, breaksAlignment, aligner, definesMRJob );
+ lps.setProperties( inputs, ExecType.SPARK, ExecLocation.ControlProgram, breaksAlignment, aligner, definesMRJob );
}
else {
throw new LopsException("Incorrect execution type for CSVReblock:" + et);
@@ -67,9 +63,8 @@ public class CSVReBlock extends Lop
}
@Override
- public String toString() {
-
- return "CSVReblock - rows per block = " + rows_per_block + " cols per block " + cols_per_block ;
+ public String toString() {
+ return "CSVReblock - rows per block = " + _rows_per_block + " cols per block " + _cols_per_block ;
}
private String prepCSVProperties() throws LopsException {
@@ -130,9 +125,9 @@ public class CSVReBlock extends Lop
sb.append( OPERAND_DELIMITOR );
sb.append( prepOutputOperand(output));
sb.append( OPERAND_DELIMITOR );
- sb.append( rows_per_block );
+ sb.append( _rows_per_block );
sb.append( OPERAND_DELIMITOR );
- sb.append( cols_per_block );
+ sb.append( _cols_per_block );
sb.append( OPERAND_DELIMITOR );
sb.append( prepCSVProperties() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/lops/ReBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/ReBlock.java b/src/main/java/org/apache/sysml/lops/ReBlock.java
index b8d4e14..15a2bf6 100644
--- a/src/main/java/org/apache/sysml/lops/ReBlock.java
+++ b/src/main/java/org/apache/sysml/lops/ReBlock.java
@@ -36,12 +36,12 @@ public class ReBlock extends Lop
private boolean _outputEmptyBlocks = true;
- private Long _rows_per_block;
- private Long _cols_per_block;
+ private int _rows_per_block;
+ private int _cols_per_block;
- public ReBlock(Lop input, Long rows_per_block, Long cols_per_block, DataType dt, ValueType vt, boolean outputEmptyBlocks, ExecType et) throws LopsException
+ public ReBlock(Lop input, int rows_per_block, int cols_per_block, DataType dt, ValueType vt, boolean outputEmptyBlocks, ExecType et) throws LopsException
{
- super(Lop.Type.ReBlock, dt, vt);
+ super(Lop.Type.ReBlock, dt, vt);
this.addInput(input);
input.addOutput(this);
@@ -66,7 +66,6 @@ public class ReBlock extends Lop
@Override
public String toString() {
-
return "Reblock - rows per block = " + _rows_per_block + " cols per block " + _cols_per_block ;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
index 880b698..2da1f23 100644
--- a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
+++ b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
@@ -26,6 +26,7 @@ import java.util.HashSet;
import org.antlr.v4.runtime.ParserRuleContext;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.parser.LanguageException.LanguageErrorCodes;
+import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
import org.apache.sysml.runtime.util.ConvolutionUtils;
import org.apache.sysml.runtime.util.UtilFunctions;
@@ -1288,26 +1289,22 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
}
- private void setBinaryOutputProperties(DataIdentifier output)
- throws LanguageException
- {
+ private void setBinaryOutputProperties(DataIdentifier output) throws LanguageException {
DataType dt1 = getFirstExpr().getOutput().getDataType();
DataType dt2 = getSecondExpr().getOutput().getDataType();
- DataType dtOut = (dt1==DataType.MATRIX || dt2==DataType.MATRIX) ?
+ DataType dtOut = (dt1==DataType.MATRIX || dt2==DataType.MATRIX) ?
DataType.MATRIX : DataType.SCALAR;
if( dt1==DataType.MATRIX && dt2==DataType.MATRIX )
checkMatchingDimensions(getFirstExpr(), getSecondExpr(), true);
- long[] dims = getBinaryMatrixCharacteristics(getFirstExpr(), getSecondExpr());
+ MatrixCharacteristics dims = getBinaryMatrixCharacteristics(getFirstExpr(), getSecondExpr());
output.setDataType(dtOut);
- output.setValueType(dtOut==DataType.MATRIX ? ValueType.DOUBLE :
+ output.setValueType(dtOut==DataType.MATRIX ? ValueType.DOUBLE :
computeValueType(getFirstExpr(), getSecondExpr(), true));
- output.setDimensions(dims[0], dims[1]);
- output.setBlockDimensions (dims[2], dims[3]);
+ output.setDimensions(dims.getRows(), dims.getCols());
+ output.setBlockDimensions (dims.getRowsPerBlock(), dims.getColsPerBlock());
}
- private void setTernaryOutputProperties(DataIdentifier output, boolean conditional)
- throws LanguageException
- {
+ private void setTernaryOutputProperties(DataIdentifier output, boolean conditional) throws LanguageException {
DataType dt1 = getFirstExpr().getOutput().getDataType();
DataType dt2 = getSecondExpr().getOutput().getDataType();
DataType dt3 = getThirdExpr().getOutput().getDataType();
@@ -1319,13 +1316,14 @@ public class BuiltinFunctionExpression extends DataIdentifier
checkMatchingDimensions(getFirstExpr(), getThirdExpr(), false, conditional);
if( dt2==DataType.MATRIX && dt3==DataType.MATRIX )
checkMatchingDimensions(getSecondExpr(), getThirdExpr(), false, conditional);
- long[] dims1 = getBinaryMatrixCharacteristics(getFirstExpr(), getSecondExpr());
- long[] dims2 = getBinaryMatrixCharacteristics(getSecondExpr(), getThirdExpr());
+ MatrixCharacteristics dims1 = getBinaryMatrixCharacteristics(getFirstExpr(), getSecondExpr());
+ MatrixCharacteristics dims2 = getBinaryMatrixCharacteristics(getSecondExpr(), getThirdExpr());
output.setDataType(dtOut);
output.setValueType(dtOut==DataType.MATRIX ? ValueType.DOUBLE :
computeValueType(getSecondExpr(), getThirdExpr(), true));
- output.setDimensions(Math.max(dims1[0], dims2[0]), Math.max(dims1[1], dims2[1]));
- output.setBlockDimensions (Math.max(dims1[2], dims2[2]), Math.max(dims1[3], dims2[3]));
+ output.setDimensions(Math.max(dims1.getRows(), dims2.getRows()), Math.max(dims1.getCols(), dims2.getCols()));
+ output.setBlockDimensions(Math.max(dims1.getRowsPerBlock(), dims2.getRowsPerBlock()),
+ Math.max(dims1.getColsPerBlock(), dims2.getColsPerBlock()));
}
private void expandArguments() {
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/parser/DataExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DataExpression.java b/src/main/java/org/apache/sysml/parser/DataExpression.java
index 9764dfc..fa762f5 100644
--- a/src/main/java/org/apache/sysml/parser/DataExpression.java
+++ b/src/main/java/org/apache/sysml/parser/DataExpression.java
@@ -905,9 +905,10 @@ public class DataExpression extends DataIdentifier
if (getVarParam(ROWBLOCKCOUNTPARAM) instanceof ConstIdentifier && getVarParam(COLUMNBLOCKCOUNTPARAM) instanceof ConstIdentifier) {
- Long rowBlockCount = (getVarParam(ROWBLOCKCOUNTPARAM) == null) ? null : Long.valueOf(getVarParam(ROWBLOCKCOUNTPARAM).toString());
- Long columnBlockCount = (getVarParam(COLUMNBLOCKCOUNTPARAM) == null) ? null : Long.valueOf(getVarParam(COLUMNBLOCKCOUNTPARAM).toString());
-
+ Integer rowBlockCount = (getVarParam(ROWBLOCKCOUNTPARAM) == null) ?
+ null : Integer.valueOf(getVarParam(ROWBLOCKCOUNTPARAM).toString());
+ Integer columnBlockCount = (getVarParam(COLUMNBLOCKCOUNTPARAM) == null) ?
+ null : Integer.valueOf(getVarParam(COLUMNBLOCKCOUNTPARAM).toString());
if ((rowBlockCount != null) && (columnBlockCount != null)) {
getOutput().setBlockDimensions(rowBlockCount, columnBlockCount);
} else if ((rowBlockCount != null) || (columnBlockCount != null)) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/parser/DataIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DataIdentifier.java b/src/main/java/org/apache/sysml/parser/DataIdentifier.java
index 1873549..34caf4e 100644
--- a/src/main/java/org/apache/sysml/parser/DataIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/DataIdentifier.java
@@ -20,15 +20,15 @@
package org.apache.sysml.parser;
-public class DataIdentifier extends Identifier
+public class DataIdentifier extends Identifier
{
protected String _name;
- protected String _valueTypeString;
+ protected String _valueTypeString;
public DataIdentifier(DataIdentifier passed){
setProperties(passed);
_name = passed.getName();
- _valueTypeString = passed.getValueType().toString();
+ _valueTypeString = passed.getValueType().toString();
// set location information
setParseInfo(passed);
@@ -39,7 +39,6 @@ public class DataIdentifier extends Identifier
DataIdentifier newId = new DataIdentifier(this);
String newIdName = prefix + _name;
newId.setName(newIdName);
-
return newId;
}
@@ -55,6 +54,7 @@ public class DataIdentifier extends Identifier
public String getName(){
return _name;
}
+
public void setName(String name){
_name = name;
}
@@ -88,11 +88,9 @@ public class DataIdentifier extends Identifier
}
@Override
- public boolean equals(Object that)
- {
+ public boolean equals(Object that) {
if( !(that instanceof DataIdentifier) )
return false;
-
DataIdentifier target = (DataIdentifier)that;
if(getName()!=null && !getName().equals(target.getName()))
return false;
@@ -106,14 +104,11 @@ public class DataIdentifier extends Identifier
return false;
if(!(this.getDim2() == target.getDim2()))
return false;
-
return true;
-
}
@Override
- public int hashCode()
- {
+ public int hashCode() {
return super.hashCode();
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/parser/Expression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/Expression.java b/src/main/java/org/apache/sysml/parser/Expression.java
index ac30657..2a6503d 100644
--- a/src/main/java/org/apache/sysml/parser/Expression.java
+++ b/src/main/java/org/apache/sysml/parser/Expression.java
@@ -29,6 +29,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.sysml.hops.Hop.FileFormatTypes;
import org.apache.sysml.runtime.controlprogram.parfor.util.IDSequence;
+import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
public abstract class Expression implements ParseInfo
@@ -551,51 +552,35 @@ public abstract class Expression implements ParseInfo
* Returns the matrix characteristics for scalar-scalar, scalar-matrix, matrix-scalar, matrix-matrix
* operations. This method is aware of potentially unknowns and matrix-vector (col/row) operations.
*
- *
* @param expression1 The first expression
* @param expression2 The second expression
- * @return long array of 4 values, where [0] is the number of rows (rlen),
+ * @return matrix characteristics
* [1] is the number of columns (clen), [2] is the number of rows in a block (brlen),
* and [3] is the number of columns in a block (bclen). Default (unknown) values are
* -1. Scalar values are all 0.
*/
- public static long[] getBinaryMatrixCharacteristics(Expression expression1, Expression expression2)
- {
- long[] ret = new long[]{ -1, -1, -1, -1 };
-
+ public static MatrixCharacteristics getBinaryMatrixCharacteristics(Expression expression1, Expression expression2) {
Identifier idleft = expression1.getOutput();
Identifier idright = expression2.getOutput();
-
if( idleft.getDataType()==DataType.SCALAR && idright.getDataType()==DataType.SCALAR ) {
- ret[0] = 0;
- ret[1] = 0;
- ret[2] = 0;
- ret[3] = 0;
+ return new MatrixCharacteristics(0, 0, 0, 0);
}
else if( idleft.getDataType()==DataType.SCALAR && idright.getDataType()==DataType.MATRIX ) {
- ret[0] = idright.getDim1();
- ret[1] = idright.getDim2();
- ret[2] = idright.getRowsInBlock();
- ret[3] = idright.getColumnsInBlock();
+ return new MatrixCharacteristics(idright.getDim1(), idright.getDim2(), idright.getRowsInBlock(), idright.getColumnsInBlock());
}
else if( idleft.getDataType()==DataType.MATRIX && idright.getDataType()==DataType.SCALAR ) {
- ret[0] = idleft.getDim1();
- ret[1] = idleft.getDim2();
- ret[2] = idleft.getRowsInBlock();
- ret[3] = idleft.getColumnsInBlock();
+ return new MatrixCharacteristics(idleft.getDim1(), idleft.getDim2(), idleft.getRowsInBlock(), idleft.getColumnsInBlock());
}
else if( idleft.getDataType()==DataType.MATRIX && idright.getDataType()==DataType.MATRIX ) {
- ret[0] = idleft.getDim1();
- ret[1] = idleft.getDim2();
- ret[2] = idleft.getRowsInBlock();
- ret[3] = idleft.getColumnsInBlock();
- if( ret[0] < 0 && idright.getDim1() > 1 ) //robustness for row vectors
- ret[0] = idright.getDim1();
- if( ret[1] < 0 && idright.getDim2() > 1 ) //robustness for row vectors
- ret[1] = idright.getDim2();
+ MatrixCharacteristics mc = new MatrixCharacteristics(
+ idleft.getDim1(), idleft.getDim2(), idleft.getRowsInBlock(), idleft.getColumnsInBlock());
+ if( mc.getRows() < 0 && idright.getDim1() > 1 ) //robustness for row vectors
+ mc.setRows(idright.getDim1());
+ if( mc.getCols() < 0 && idright.getDim2() > 1 ) //robustness for row vectors
+ mc.setCols(idright.getDim2());
+ return mc;
}
-
- return ret;
+ return new MatrixCharacteristics(-1, -1, -1, -1);
}
///////////////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/parser/Identifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/Identifier.java b/src/main/java/org/apache/sysml/parser/Identifier.java
index 47a8034..3c44452 100644
--- a/src/main/java/org/apache/sysml/parser/Identifier.java
+++ b/src/main/java/org/apache/sysml/parser/Identifier.java
@@ -29,13 +29,12 @@ public abstract class Identifier extends Expression
protected ValueType _valueType;
protected long _dim1;
protected long _dim2;
- protected long _rows_in_block;
- protected long _columns_in_block;
+ protected int _rows_in_block;
+ protected int _columns_in_block;
protected long _nnz;
protected FormatType _formatType;
- public Identifier()
- {
+ public Identifier() {
_dim1 = -1;
_dim2 = -1;
_dataType = DataType.UNKNOWN;
@@ -47,11 +46,9 @@ public abstract class Identifier extends Expression
_formatType = null;
}
- public void setProperties(Identifier i)
- {
+ public void setProperties(Identifier i) {
if (i == null)
return;
-
_dataType = i.getDataType();
_valueType = i.getValueType();
if (i instanceof IndexedIdentifier) {
@@ -68,8 +65,7 @@ public abstract class Identifier extends Expression
_formatType = i.getFormatType();
}
- public void setDimensionValueProperties(Identifier i)
- {
+ public void setDimensionValueProperties(Identifier i) {
if (i instanceof IndexedIdentifier) {
IndexedIdentifier ixi = (IndexedIdentifier)i;
_dim1 = ixi.getOrigDim1();
@@ -101,7 +97,7 @@ public abstract class Identifier extends Expression
_dim2 = dim2;
}
- public void setBlockDimensions(long dim1, long dim2){
+ public void setBlockDimensions(int dim1, int dim2){
_rows_in_block = dim1;
_columns_in_block = dim2;
}
@@ -130,11 +126,11 @@ public abstract class Identifier extends Expression
return _formatType;
}
- public long getRowsInBlock(){
+ public int getRowsInBlock(){
return _rows_in_block;
}
- public long getColumnsInBlock(){
+ public int getColumnsInBlock(){
return _columns_in_block;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/parser/RelationalExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/RelationalExpression.java b/src/main/java/org/apache/sysml/parser/RelationalExpression.java
index 91e9da3..af6424e 100644
--- a/src/main/java/org/apache/sysml/parser/RelationalExpression.java
+++ b/src/main/java/org/apache/sysml/parser/RelationalExpression.java
@@ -22,6 +22,7 @@ package org.apache.sysml.parser;
import java.util.HashMap;
import org.apache.sysml.parser.LanguageException.LanguageErrorCodes;
+import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
public class RelationalExpression extends Expression
{
@@ -142,11 +143,10 @@ public class RelationalExpression extends Expression
if(isLeftMatrix && isRightMatrix) {
checkMatchingDimensions(_left, _right, true);
}
-
- long[] dims = getBinaryMatrixCharacteristics(_left, _right);
+ MatrixCharacteristics dims = getBinaryMatrixCharacteristics(_left, _right);
output.setDataType(DataType.MATRIX);
- output.setDimensions(dims[0], dims[1]);
- output.setBlockDimensions(dims[2], dims[3]);
+ output.setDimensions(dims.getRows(), dims.getCols());
+ output.setBlockDimensions(dims.getRowsPerBlock(), dims.getColsPerBlock());
//since SystemML only supports double matrices, the value type is forced to
//double; once we support boolean matrices this needs to change
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/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 af8c8b9..5416d5d 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
@@ -274,22 +274,18 @@ public class ExecutionContext {
return mo.acquireRead();
}
- public void setMetaData(String varName, long nrows, long ncols)
- throws DMLRuntimeException
- {
+ public void setMetaData(String varName, long nrows, long ncols) throws DMLRuntimeException {
MatrixObject mo = getMatrixObject(varName);
if(mo.getNumRows() == nrows && mo.getNumColumns() == ncols)
return;
-
MetaData oldMetaData = mo.getMetaData();
if( oldMetaData == null || !(oldMetaData instanceof MetaDataFormat) )
throw new DMLRuntimeException("Metadata not available");
-
- MatrixCharacteristics mc = new MatrixCharacteristics((long)nrows, (long)ncols,
- (int) mo.getNumRowsPerBlock(), (int)mo.getNumColumnsPerBlock());
+ MatrixCharacteristics mc = new MatrixCharacteristics(nrows, ncols,
+ (int) mo.getNumRowsPerBlock(), (int)mo.getNumColumnsPerBlock());
mo.setMetaData(new MetaDataFormat(mc,
- ((MetaDataFormat)oldMetaData).getOutputInfo(),
- ((MetaDataFormat)oldMetaData).getInputInfo()));
+ ((MetaDataFormat)oldMetaData).getOutputInfo(),
+ ((MetaDataFormat)oldMetaData).getInputInfo()));
}
/**
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/main/java/org/apache/sysml/runtime/matrix/MatrixCharacteristics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/MatrixCharacteristics.java b/src/main/java/org/apache/sysml/runtime/matrix/MatrixCharacteristics.java
index e9554f9..0fd9f22 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/MatrixCharacteristics.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/MatrixCharacteristics.java
@@ -78,9 +78,7 @@ public class MatrixCharacteristics implements Serializable
private long nonZero = -1;
private boolean ubNnz = false;
- public MatrixCharacteristics() {
-
- }
+ public MatrixCharacteristics() {}
public MatrixCharacteristics(long nr, long nc, int bnr, int bnc) {
set(nr, nc, bnr, bnc);
@@ -122,11 +120,19 @@ public class MatrixCharacteristics implements Serializable
public long getRows(){
return numRows;
}
+
+ public void setRows(long rlen) {
+ numRows = rlen;
+ }
public long getCols(){
return numColumns;
}
+ public void setCols(long clen) {
+ numColumns = clen;
+ }
+
public long getLength() {
return numRows * numColumns;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/2b74a794/src/test/java/org/apache/sysml/test/integration/functions/codegen/CPlanComparisonTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/codegen/CPlanComparisonTest.java b/src/test/java/org/apache/sysml/test/integration/functions/codegen/CPlanComparisonTest.java
index bc68e68..0b85fae 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/codegen/CPlanComparisonTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/codegen/CPlanComparisonTest.java
@@ -240,11 +240,11 @@ public class CPlanComparisonTest extends AutomatedTestBase
private Hop createDataOp(DataType dt) {
return new DataOp("tmp"+_seq.getNextID(), dt, ValueType.DOUBLE,
- DataOpTypes.TRANSIENTREAD, "tmp", 77L, 7L, -1L, 1000L, 1000L);
+ DataOpTypes.TRANSIENTREAD, "tmp", 77L, 7L, -1L, 1000, 1000);
}
private static Hop createDataOp(String name, DataType dt) {
return new DataOp(name, dt, ValueType.DOUBLE,
- DataOpTypes.TRANSIENTREAD, "tmp", 77L, 7L, -1L, 1000L, 1000L);
+ DataOpTypes.TRANSIENTREAD, "tmp", 77L, 7L, -1L, 1000, 1000);
}
}
[05/10] systemml git commit: [SYSTEMML-2191] Cleanup exception
hierarchy and handling, part 1
Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/IfStatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IfStatementBlock.java b/src/main/java/org/apache/sysml/parser/IfStatementBlock.java
index 00295d1..aa9c7b5 100644
--- a/src/main/java/org/apache/sysml/parser/IfStatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/IfStatementBlock.java
@@ -19,14 +19,12 @@
package org.apache.sysml.parser;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.recompile.Recompiler;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.parser.Expression.DataType;
@@ -40,8 +38,7 @@ public class IfStatementBlock extends StatementBlock
@Override
public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional)
- throws LanguageException, ParseException, IOException
- {
+ {
if (_statements.size() > 1){
raiseValidateError("IfStatementBlock should only have 1 statement (IfStatement)", conditional);
}
@@ -287,8 +284,7 @@ public class IfStatementBlock extends StatementBlock
@Override
public VariableSet initializeforwardLV(VariableSet activeInPassed)
- throws LanguageException
- {
+ {
IfStatement ifstmt = (IfStatement)_statements.get(0);
if (_statements.size() > 1){
LOG.error(ifstmt.printErrorLocation() + "IfStatementBlock should have only 1 statement (if statement)");
@@ -421,8 +417,7 @@ public class IfStatementBlock extends StatementBlock
@Override
public VariableSet initializebackwardLV(VariableSet loPassed)
- throws LanguageException
- {
+ {
IfStatement ifstmt = (IfStatement)_statements.get(0);
if (_statements.size() > 1){
LOG.error(ifstmt.printErrorLocation() + "IfStatementBlock should have only 1 statement (if statement)");
@@ -468,7 +463,7 @@ public class IfStatementBlock extends StatementBlock
}
@Override
- public VariableSet analyze(VariableSet loPassed) throws LanguageException{
+ public VariableSet analyze(VariableSet loPassed) {
VariableSet predVars = ((IfStatement)_statements.get(0)).getConditionalPredicate().variablesRead();
predVars.addVariables(((IfStatement)_statements.get(0)).getConditionalPredicate().variablesUpdated());
@@ -515,7 +510,7 @@ public class IfStatementBlock extends StatementBlock
// materialized hops recompilation flags
////
- public boolean updatePredicateRecompilationFlag() throws HopsException {
+ public boolean updatePredicateRecompilationFlag() {
return (_requiresPredicateRecompile =
ConfigurationManager.isDynamicRecompilation()
&& Recompiler.requiresRecompilation(getPredicateHops()));
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ImportStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ImportStatement.java b/src/main/java/org/apache/sysml/parser/ImportStatement.java
index 6b892d1..4f2c475 100644
--- a/src/main/java/org/apache/sysml/parser/ImportStatement.java
+++ b/src/main/java/org/apache/sysml/parser/ImportStatement.java
@@ -75,7 +75,7 @@ public class ImportStatement extends Statement
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
+ public Statement rewriteStatement(String prefix) {
LOG.error(this.printErrorLocation() + "rewriting for inlining not supported for ImportStatement");
throw new LanguageException(this.printErrorLocation() + "rewriting for inlining not supported for ImportStatement");
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java b/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
index 09dafc2..97e94c5 100644
--- a/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
@@ -72,8 +72,7 @@ public class IndexedIdentifier extends DataIdentifier
}
public IndexPair calculateIndexedDimensions(HashMap<String,DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional)
- throws LanguageException
- {
+ {
// stores the updated row / col dimension info
long updatedRowDim = -1, updatedColDim = -1;
@@ -528,7 +527,7 @@ public class IndexedIdentifier extends DataIdentifier
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
IndexedIdentifier newIndexedIdentifier = new IndexedIdentifier(this.getName(), this._rowLowerEqualsUpper, this._colLowerEqualsUpper);
newIndexedIdentifier.setParseInfo(this);
@@ -549,7 +548,7 @@ public class IndexedIdentifier extends DataIdentifier
return newIndexedIdentifier;
}
- public void setIndices(ArrayList<ArrayList<Expression>> passed) throws LanguageException {
+ public void setIndices(ArrayList<ArrayList<Expression>> passed) {
if (passed.size() != 2)
raiseValidateError("matrix indices must be specified for 2 dimensions");
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/IntIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IntIdentifier.java b/src/main/java/org/apache/sysml/parser/IntIdentifier.java
index 1e384bc..3833ce0 100644
--- a/src/main/java/org/apache/sysml/parser/IntIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/IntIdentifier.java
@@ -26,7 +26,7 @@ public class IntIdentifier extends ConstIdentifier
private long _val;
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException{
+ public Expression rewriteExpression(String prefix) {
return this;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/IterablePredicate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IterablePredicate.java b/src/main/java/org/apache/sysml/parser/IterablePredicate.java
index ea49073..cf859c3 100644
--- a/src/main/java/org/apache/sysml/parser/IterablePredicate.java
+++ b/src/main/java/org/apache/sysml/parser/IterablePredicate.java
@@ -61,7 +61,7 @@ public class IterablePredicate extends Expression
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
//DataIdentifier newIterVar = (DataIdentifier)_iterVar.rewriteExpression(prefix);
//return new IterablePredicate(newIterVar, _from, _to, _increment);
LOG.error(this.printErrorLocation() + "rewriteExpression not supported for IterablePredicate");
@@ -70,7 +70,6 @@ public class IterablePredicate extends Expression
@Override
public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException
{
//recursive validate
if (_iterVar instanceof FunctionCallIdentifier
@@ -185,9 +184,7 @@ public class IterablePredicate extends Expression
return sb.toString();
}
- private void checkNumericScalarOutput( Expression expr )
- throws LanguageException
- {
+ private void checkNumericScalarOutput( Expression expr ) {
if( expr == null || expr.getOutput() == null )
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/LiveVariableAnalysis.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/LiveVariableAnalysis.java b/src/main/java/org/apache/sysml/parser/LiveVariableAnalysis.java
index 0417edb..e851907 100644
--- a/src/main/java/org/apache/sysml/parser/LiveVariableAnalysis.java
+++ b/src/main/java/org/apache/sysml/parser/LiveVariableAnalysis.java
@@ -85,9 +85,9 @@ public abstract class LiveVariableAnalysis
_read = vars;
}
- public abstract VariableSet initializeforwardLV(VariableSet activeIn) throws LanguageException;
- public abstract VariableSet initializebackwardLV(VariableSet loPassed) throws LanguageException;
- public abstract VariableSet analyze(VariableSet loPassed) throws LanguageException;
+ public abstract VariableSet initializeforwardLV(VariableSet activeIn);
+ public abstract VariableSet initializebackwardLV(VariableSet loPassed);
+ public abstract VariableSet analyze(VariableSet loPassed);
public void updateLiveVariablesOut(VariableSet liveOut){
updateLiveVariables(_liveOut,liveOut);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java b/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
index 4010a65..b01dd2e 100644
--- a/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
+++ b/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
@@ -33,8 +33,7 @@ public class MultiAssignmentStatement extends Statement
// rewrites statement to support function inlining (creates deep copy)
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
-
+ public Statement rewriteStatement(String prefix) {
ArrayList<DataIdentifier> newTargetList = new ArrayList<>();
// rewrite targetList (deep copy)
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/OutputStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/OutputStatement.java b/src/main/java/org/apache/sysml/parser/OutputStatement.java
index af02f8f..43b1edd 100644
--- a/src/main/java/org/apache/sysml/parser/OutputStatement.java
+++ b/src/main/java/org/apache/sysml/parser/OutputStatement.java
@@ -70,27 +70,20 @@ public class OutputStatement extends Statement
return false;
}
- public void addExprParam(String name, Expression value, boolean fromMTDFile)
- throws LanguageException
- {
+ public void addExprParam(String name, Expression value, boolean fromMTDFile) {
if( _paramsExpr.getVarParam(name) != null )
raiseValidateError("attempted to add IOStatement parameter " + name + " more than once", false);
-
if( !OutputStatement.isValidParamName(name) )
raiseValidateError("attempted to add invalid write statement parameter: " + name, false);
-
_paramsExpr.addVarParam(name, value);
}
// rewrites statement to support function inlining (create deep copy)
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
-
+ public Statement rewriteStatement(String prefix) {
OutputStatement newStatement = new OutputStatement(null, Expression.DataOp.WRITE, this);
-
// rewrite outputStatement variable name (creates deep copy)
newStatement._id = (DataIdentifier)this._id.rewriteExpression(prefix);
-
// rewrite parameter expressions (creates deep copy)
DataOp op = _paramsExpr.getOpCode();
HashMap<String,Expression> newExprParams = new HashMap<>();
@@ -102,10 +95,11 @@ public class OutputStatement extends Statement
newStatement.setExprParams(newParamerizedExpr);
return newStatement;
}
-
+
public void setExprParams(DataExpression newParamerizedExpr) {
_paramsExpr = newParamerizedExpr;
}
+
public Expression getExprParam(String key){
return _paramsExpr.getVarParam(key);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ParForStatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ParForStatementBlock.java b/src/main/java/org/apache/sysml/parser/ParForStatementBlock.java
index d209c36..dee1384 100644
--- a/src/main/java/org/apache/sysml/parser/ParForStatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/ParForStatementBlock.java
@@ -19,7 +19,6 @@
package org.apache.sysml.parser;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -175,8 +174,7 @@ public class ParForStatementBlock extends ForStatementBlock
@Override
public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional)
- throws LanguageException, ParseException, IOException
- {
+ {
LOG.trace("PARFOR("+_ID+"): validating ParForStatementBlock.");
//create parent variable set via cloning
@@ -419,10 +417,8 @@ public class ParForStatementBlock extends ForStatementBlock
* @param asb list of statement blocks
* @param C set of candidates
* @param sCount statement count
- * @throws LanguageException if LanguageException occurs
*/
private void rDetermineCandidates(ArrayList<StatementBlock> asb, HashSet<Candidate> C, Integer sCount)
- throws LanguageException
{
for(StatementBlock sb : asb ) // foreach statementblock in parforbody
for( Statement s : sb._statements ) // foreach statement in statement block
@@ -476,10 +472,8 @@ public class ParForStatementBlock extends ForStatementBlock
* @param var variables
* @param asb list of statement blocks
* @param C list of partition formats
- * @throws LanguageException if LanguageException occurs
*/
private void rDeterminePartitioningCandidates(String var, ArrayList<StatementBlock> asb, List<PartitionFormat> C)
- throws LanguageException
{
for(StatementBlock sb : asb ) // foreach statementblock in parforbody
for( Statement s : sb._statements ) // foreach statement in statement block
@@ -600,7 +594,6 @@ public class ParForStatementBlock extends ForStatementBlock
}
private void rConsolidateResultVars(ArrayList<StatementBlock> asb, ArrayList<ResultVar> vars)
- throws LanguageException
{
for(StatementBlock sb : asb ) // foreach statementblock in parforbody
{
@@ -633,12 +626,10 @@ public class ParForStatementBlock extends ForStatementBlock
* @param asb list of statement blocks
* @param sCount statement count
* @param dep array of boolean potential output dependencies
- * @throws LanguageException if LanguageException occurs
*/
private void rCheckCandidates(Candidate c, DataType cdt,
ArrayList<StatementBlock> asb, Integer sCount, boolean[] dep)
- throws LanguageException
- {
+ {
// check candidate only (output dependency if scalar or constant matrix subscript)
if( cdt == DataType.SCALAR
|| cdt == DataType.OBJECT ) //dat2 checked for other candidate
@@ -865,7 +856,7 @@ public class ParForStatementBlock extends ForStatementBlock
return ret;
}
- private void rDetermineBounds( ArrayList<StatementBlock> sbs, boolean flag ) throws LanguageException {
+ private void rDetermineBounds( ArrayList<StatementBlock> sbs, boolean flag ) {
for( StatementBlock sb : sbs )
rDetermineBounds(sb, flag);
}
@@ -875,10 +866,8 @@ public class ParForStatementBlock extends ForStatementBlock
*
* @param sb statement block
* @param flag indicates that method is already in subtree of THIS.
- * @throws LanguageException if LanguageException occurs
*/
private void rDetermineBounds( StatementBlock sb, boolean flag )
- throws LanguageException
{
// catch all known for/ parfor bounds
// (all unknown bounds are assumed to be +-infinity)
@@ -1000,10 +989,8 @@ public class ParForStatementBlock extends ForStatementBlock
* @param dat1 data identifier 1
* @param dat2 data identifier 2
* @return true if "anti or data dependency"
- * @throws LanguageException if LanguageException occurs
*/
private boolean runBanerjeeGCDTest(DataIdentifier dat1, DataIdentifier dat2)
- throws LanguageException
{
/* The GCD (greatest common denominator) and the Banerjee test are two commonly used tests
* for determining loop-carried dependencies. Both rely on (1) linear index expressions of the
@@ -1151,10 +1138,8 @@ public class ParForStatementBlock extends ForStatementBlock
*
* @param dat1 data identifier
* @return true if dependency
- * @throws LanguageException if LanguageException occurs
*/
private boolean runConstantCheck(DataIdentifier dat1)
- throws LanguageException
{
LOG.trace("PARFOR: runConstantCheck.");
@@ -1201,10 +1186,8 @@ public class ParForStatementBlock extends ForStatementBlock
* @param dat1 data identifier 1
* @param dat2 data identifier 2
* @return true if equal data identifiers
- * @throws LanguageException if LanguageException occurs
*/
private boolean runEqualsCheck(DataIdentifier dat1, DataIdentifier dat2)
- throws LanguageException
{
LOG.trace("PARFOR: runEqualsCheck.");
@@ -1272,10 +1255,8 @@ public class ParForStatementBlock extends ForStatementBlock
*
* @param dat data identifier
* @return linear function
- * @throws LanguageException if LanguageException occurs
*/
private LinearFunction getLinearFunction(DataIdentifier dat)
- throws LanguageException
{
/* Notes:
* - Currently, this function supports 2dim matrix subscripts with arbitrary linear functions
@@ -1463,7 +1444,6 @@ public class ParForStatementBlock extends ForStatementBlock
}
private LinearFunction getRowLinearFunction(DataIdentifier dat)
- throws LanguageException
{
//NOTE: would require separate function cache, not realized due to inexpensive operations
@@ -1501,7 +1481,6 @@ public class ParForStatementBlock extends ForStatementBlock
}
private LinearFunction getColLinearFunction(DataIdentifier dat)
- throws LanguageException
{
//NOTE: would require separate function cache, not realized due to inexpensive operations
@@ -1538,8 +1517,7 @@ public class ParForStatementBlock extends ForStatementBlock
return out;
}
- private LinearFunction getLinearFunction(Expression expr, boolean ignoreMinWithConstant)
- throws LanguageException {
+ private LinearFunction getLinearFunction(Expression expr, boolean ignoreMinWithConstant) {
if( expr instanceof IntIdentifier )
return new LinearFunction(((IntIdentifier)expr).getValue(), 0, null);
else if( expr instanceof BinaryExpression )
@@ -1611,10 +1589,8 @@ public class ParForStatementBlock extends ForStatementBlock
* robustness purposes.
*
* @param f1 linear function
- * @throws LanguageException if LanguageException occurs
*/
private void verifyFunction(LinearFunction f1)
- throws LanguageException
{
//check for required form of linear functions
if( f1 == null || f1._b.length != f1._vars.length ) {
@@ -1687,10 +1663,8 @@ public class ParForStatementBlock extends ForStatementBlock
*
* @param be binary expression
* @return linear function
- * @throws LanguageException if LanguageException occurs
*/
private LinearFunction rParseBinaryExpression(BinaryExpression be)
- throws LanguageException
{
LinearFunction ret = null;
Expression l = be.getLeft();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java b/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
index dbb2a1e..e80b46f 100644
--- a/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
+++ b/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
@@ -144,7 +144,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
HashMap<String,Expression> newVarParams = new HashMap<>();
for (String key : _varParams.keySet()){
Expression newExpr = _varParams.get(key).rewriteExpression(prefix);
@@ -181,8 +181,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
*/
@Override
public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException
- {
+ {
// validate all input parameters
for ( String s : getVarParams().keySet() ) {
Expression paramExpr = getVarParam(s);
@@ -264,7 +263,6 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
@Override
public void validateExpression(MultiAssignmentStatement stmt, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException
{
// validate all input parameters
for ( String s : getVarParams().keySet() ) {
@@ -296,7 +294,6 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
// example: A = transformapply(target=X, meta=M, spec=s)
private void validateTransformApply(DataIdentifier output, boolean conditional)
- throws LanguageException
{
//validate data / metadata (recode maps)
checkDataType("transformapply", TF_FN_PARAM_DATA, DataType.FRAME, conditional);
@@ -313,7 +310,6 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
private void validateTransformDecode(DataIdentifier output, boolean conditional)
- throws LanguageException
{
//validate data / metadata (recode maps)
checkDataType("transformdecode", TF_FN_PARAM_DATA, DataType.MATRIX, conditional);
@@ -330,7 +326,6 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
private void validateTransformColmap(DataIdentifier output, boolean conditional)
- throws LanguageException
{
//validate data / metadata (recode maps)
Expression exprTarget = getVarParam(Statement.GAGG_TARGET);
@@ -347,7 +342,6 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
private void validateTransformMeta(DataIdentifier output, boolean conditional)
- throws LanguageException
{
//validate specification
checkDataValueType("transformmeta", TF_FN_PARAM_SPEC, DataType.SCALAR, ValueType.STRING, conditional);
@@ -363,7 +357,6 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
private void validateTransformEncode(DataIdentifier output1, DataIdentifier output2, boolean conditional)
- throws LanguageException
{
//validate data / metadata (recode maps)
checkDataType("transformencode", TF_FN_PARAM_DATA, DataType.FRAME, conditional);
@@ -381,7 +374,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
output2.setDimensions(-1, -1);
}
- private void validateTransformSpec(String pname, boolean conditional) throws LanguageException {
+ private void validateTransformSpec(String pname, boolean conditional) {
Expression data = getVarParam(pname);
if( data instanceof StringIdentifier ) {
try {
@@ -395,7 +388,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
}
- private void validateReplace(DataIdentifier output, boolean conditional) throws LanguageException {
+ private void validateReplace(DataIdentifier output, boolean conditional) {
//check existence and correctness of arguments
Expression target = getVarParam("target");
if( target==null ) {
@@ -427,7 +420,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
output.setDimensions(target.getOutput().getDim1(), target.getOutput().getDim2());
}
- private void validateOrder(DataIdentifier output, boolean conditional) throws LanguageException {
+ private void validateOrder(DataIdentifier output, boolean conditional) {
//check existence and correctness of arguments
Expression target = getVarParam("target"); //[MANDATORY] TARGET
if( target==null ) {
@@ -478,7 +471,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
- private void validateRemoveEmpty(DataIdentifier output, boolean conditional) throws LanguageException {
+ private void validateRemoveEmpty(DataIdentifier output, boolean conditional) {
//check for invalid parameters
Set<String> valid = UtilFunctions.asSet("target", "margin", "select", "empty.return");
@@ -525,7 +518,6 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
}
private void validateGroupedAgg(DataIdentifier output, boolean conditional)
- throws LanguageException
{
//check existing target and groups
if (getVarParam(Statement.GAGG_TARGET) == null || getVarParam(Statement.GAGG_GROUPS) == null){
@@ -630,7 +622,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
output.setDimensions(outputDim1, outputDim2);
}
- private void validateDistributionFunctions(DataIdentifier output, boolean conditional) throws LanguageException {
+ private void validateDistributionFunctions(DataIdentifier output, boolean conditional) {
// CDF and INVCDF expects one unnamed parameter, it must be renamed as "quantile"
// (i.e., we must compute P(X <= x) where x is called as "quantile" )
@@ -712,9 +704,7 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
output.setDimensions(0, 0);
}
- private void validateCastAsString(DataIdentifier output, boolean conditional)
- throws LanguageException
- {
+ private void validateCastAsString(DataIdentifier output, boolean conditional) {
HashMap<String, Expression> varParams = getVarParams();
// replace parameter name for matrix argument
@@ -737,21 +727,18 @@ public class ParameterizedBuiltinFunctionExpression extends DataIdentifier
output.setDimensions(0, 0);
}
- private void checkDataType( String fname, String pname, DataType dt, boolean conditional )
- throws LanguageException
- {
+ private void checkDataType( String fname, String pname, DataType dt, boolean conditional ) {
Expression data = getVarParam(pname);
- if( data==null )
+ if( data==null )
raiseValidateError("Named parameter '" + pname + "' missing. Please specify the input.", conditional, LanguageErrorCodes.INVALID_PARAMETERS);
else if( data.getOutput().getDataType() != dt )
raiseValidateError("Input to "+fname+"::"+pname+" must be of type '"+dt.toString()+"'. It is of type '"+data.getOutput().getDataType()+"'.", conditional, LanguageErrorCodes.INVALID_PARAMETERS);
}
private void checkDataValueType( String fname, String pname, DataType dt, ValueType vt, boolean conditional )
- throws LanguageException
{
Expression data = getVarParam(pname);
- if( data==null )
+ if( data==null )
raiseValidateError("Named parameter '" + pname + "' missing. Please specify the input.", conditional, LanguageErrorCodes.INVALID_PARAMETERS);
else if( data.getOutput().getDataType() != dt || data.getOutput().getValueType() != vt )
raiseValidateError("Input to "+fname+"::"+pname+" must be of type '"+dt.toString()+"', '"+vt.toString()+"'. "
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ParserWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ParserWrapper.java b/src/main/java/org/apache/sysml/parser/ParserWrapper.java
index 71e405b..0f43971 100644
--- a/src/main/java/org/apache/sysml/parser/ParserWrapper.java
+++ b/src/main/java/org/apache/sysml/parser/ParserWrapper.java
@@ -45,8 +45,7 @@ public abstract class ParserWrapper {
protected boolean atLeastOneWarning = false;
protected List<ParseIssue> parseIssues;
- public abstract DMLProgram parse(String fileName, String dmlScript, Map<String, String> argVals)
- throws ParseException;
+ public abstract DMLProgram parse(String fileName, String dmlScript, Map<String, String> argVals);
/**
* Custom wrapper to convert statement into statement blocks. Called by doParse and in DmlSyntacticValidator for for, parfor, while, ...
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/PathStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/PathStatement.java b/src/main/java/org/apache/sysml/parser/PathStatement.java
index 6fe61af..9bb2666 100644
--- a/src/main/java/org/apache/sysml/parser/PathStatement.java
+++ b/src/main/java/org/apache/sysml/parser/PathStatement.java
@@ -35,7 +35,7 @@ public class PathStatement extends Statement
}
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
+ public Statement rewriteStatement(String prefix) {
return this;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/PrintStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/PrintStatement.java b/src/main/java/org/apache/sysml/parser/PrintStatement.java
index 4740586..62ebf4a 100644
--- a/src/main/java/org/apache/sysml/parser/PrintStatement.java
+++ b/src/main/java/org/apache/sysml/parser/PrintStatement.java
@@ -42,7 +42,7 @@ public class PrintStatement extends Statement
protected PRINTTYPE _type; // print, printf, or stop
protected List<Expression> expressions;
- private static PRINTTYPE getPrintType(String type, List<Expression> expressions) throws LanguageException {
+ private static PRINTTYPE getPrintType(String type, List<Expression> expressions) {
if(type.equalsIgnoreCase("print")) {
if ((expressions == null) || (expressions.size() == 1)) {
return PRINTTYPE.PRINT;
@@ -60,22 +60,19 @@ public class PrintStatement extends Statement
throw new LanguageException("Unknown statement type: " + type);
}
- public PrintStatement(ParserRuleContext ctx, String type, String filename)
- throws LanguageException {
+ public PrintStatement(ParserRuleContext ctx, String type, String filename) {
this(getPrintType(type, null), null);
setCtxValues(ctx);
setFilename(filename);
}
- public PrintStatement(ParserRuleContext ctx, String type, List<Expression> expressions, String filename)
- throws LanguageException {
+ public PrintStatement(ParserRuleContext ctx, String type, List<Expression> expressions, String filename) {
this(getPrintType(type, expressions), expressions);
setCtxValues(ctx);
setFilename(filename);
}
- public PrintStatement(PRINTTYPE type, List<Expression> expressions)
- throws LanguageException {
+ public PrintStatement(PRINTTYPE type, List<Expression> expressions) {
_type = type;
if (expressions == null) {
this.expressions = new ArrayList<>();
@@ -85,7 +82,7 @@ public class PrintStatement extends Statement
}
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
+ public Statement rewriteStatement(String prefix) {
List<Expression> newExpressions = new ArrayList<>();
for (Expression oldExpression : expressions) {
Expression newExpression = oldExpression.rewriteExpression(prefix);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/RelationalExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/RelationalExpression.java b/src/main/java/org/apache/sysml/parser/RelationalExpression.java
index af6424e..ca074cf 100644
--- a/src/main/java/org/apache/sysml/parser/RelationalExpression.java
+++ b/src/main/java/org/apache/sysml/parser/RelationalExpression.java
@@ -47,7 +47,7 @@ public class RelationalExpression extends Expression
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
RelationalExpression newExpr = new RelationalExpression(this._opcode, this);
newExpr.setLeft(_left.rewriteExpression(prefix));
newExpr.setRight(_right.rewriteExpression(prefix));
@@ -90,16 +90,15 @@ public class RelationalExpression extends Expression
*/
@Override
public void validateExpression(HashMap<String,DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException
- {
+ {
//check for functions calls in expression
if (_left instanceof FunctionCallIdentifier){
raiseValidateError("user-defined function calls not supported in relational expressions",
- false, LanguageException.LanguageErrorCodes.UNSUPPORTED_EXPRESSION);
- }
+ false, LanguageException.LanguageErrorCodes.UNSUPPORTED_EXPRESSION);
+ }
if (_right instanceof FunctionCallIdentifier){
raiseValidateError("user-defined function calls not supported in relational expressions",
- false, LanguageException.LanguageErrorCodes.UNSUPPORTED_EXPRESSION);
+ false, LanguageException.LanguageErrorCodes.UNSUPPORTED_EXPRESSION);
}
// handle <NUMERIC> == <BOOLEAN> --> convert <BOOLEAN> to numeric value
@@ -165,10 +164,8 @@ public class RelationalExpression extends Expression
* @param expr1 expression 1
* @param expr2 expression 2
* @param allowsMV ?
- * @throws LanguageException
*/
private void checkMatchingDimensions(Expression expr1, Expression expr2, boolean allowsMV)
- throws LanguageException
{
if (expr1 != null && expr2 != null) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/Statement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/Statement.java b/src/main/java/org/apache/sysml/parser/Statement.java
index 0b3aac2..4a54df4 100644
--- a/src/main/java/org/apache/sysml/parser/Statement.java
+++ b/src/main/java/org/apache/sysml/parser/Statement.java
@@ -67,10 +67,10 @@ public abstract class Statement implements ParseInfo
public abstract VariableSet variablesRead();
public abstract VariableSet variablesUpdated();
- public abstract void initializeforwardLV(VariableSet activeIn) throws LanguageException;
- public abstract VariableSet initializebackwardLV(VariableSet lo) throws LanguageException;
+ public abstract void initializeforwardLV(VariableSet activeIn);
+ public abstract VariableSet initializebackwardLV(VariableSet lo);
- public abstract Statement rewriteStatement(String prefix) throws LanguageException;
+ public abstract Statement rewriteStatement(String prefix);
// Used only insider python parser to allow for ignoring newline logic
private boolean isEmptyNewLineStatement = false;
@@ -176,11 +176,11 @@ public abstract class Statement implements ParseInfo
}
}
- public void raiseValidateError(String msg, boolean conditional) throws LanguageException {
+ public void raiseValidateError(String msg, boolean conditional) {
raiseValidateError(msg, conditional, null);
}
- public void raiseValidateError(String msg, boolean conditional, String errorCode) throws LanguageException {
+ public void raiseValidateError(String msg, boolean conditional, String errorCode) {
if (conditional) {// warning if conditional
String fullMsg = this.printWarningLocation() + msg;
LOG.warn(fullMsg);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/StatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/StatementBlock.java b/src/main/java/org/apache/sysml/parser/StatementBlock.java
index 04e4a34..1f0e81c 100644
--- a/src/main/java/org/apache/sysml/parser/StatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/StatementBlock.java
@@ -19,7 +19,6 @@
package org.apache.sysml.parser;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -30,7 +29,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.sysml.api.DMLScript;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.recompile.Recompiler;
import org.apache.sysml.hops.rewrite.RewriteSplitDagDataDependentOperators;
import org.apache.sysml.lops.Lop;
@@ -167,7 +165,7 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
return ( stmt instanceof PrintStatement && (((PrintStatement)stmt).getType() == PRINTTYPE.STOP || ((PrintStatement)stmt).getType() == PRINTTYPE.ASSERT) );
}
- public boolean isMergeableFunctionCallBlock(DMLProgram dmlProg) throws LanguageException{
+ public boolean isMergeableFunctionCallBlock(DMLProgram dmlProg) {
// if (DMLScript.ENABLE_DEBUG_MODE && !DMLScript.ENABLE_DEBUG_OPTIMIZER)
if (DMLScript.ENABLE_DEBUG_MODE)
@@ -221,7 +219,7 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
return true;
}
- public boolean isRewritableFunctionCall(Statement stmt, DMLProgram dmlProg) throws LanguageException{
+ public boolean isRewritableFunctionCall(Statement stmt, DMLProgram dmlProg) {
// for regular stmt, check if this is a function call stmt block
if (stmt instanceof AssignmentStatement || stmt instanceof MultiAssignmentStatement){
@@ -303,7 +301,7 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
return ret;
}
- public static ArrayList<StatementBlock> mergeFunctionCalls(ArrayList<StatementBlock> body, DMLProgram dmlProg) throws LanguageException
+ public static ArrayList<StatementBlock> mergeFunctionCalls(ArrayList<StatementBlock> body, DMLProgram dmlProg)
{
for(int i = 0; i <body.size(); i++){
@@ -573,7 +571,7 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
return ret;
}
- public ArrayList<Statement> rewriteFunctionCallStatements (DMLProgram dmlProg, ArrayList<Statement> statements) throws LanguageException {
+ public ArrayList<Statement> rewriteFunctionCallStatements (DMLProgram dmlProg, ArrayList<Statement> statements) {
ArrayList<Statement> newStatements = new ArrayList<>();
for (Statement current : statements){
@@ -713,7 +711,6 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
}
public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException, ParseException, IOException
{
_constVarsIn.putAll(constVars);
_statements = rewriteFunctionCallStatements(dmlProg, _statements);
@@ -782,7 +779,6 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
private void validateAssignmentStatement(Statement current, DMLProgram dmlProg,
VariableSet ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional)
- throws LanguageException, IOException, ParseException
{
AssignmentStatement as = (AssignmentStatement)current;
DataIdentifier target = as.getTarget();
@@ -899,7 +895,6 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
private void validateMultiAssignmentStatement(Statement current, DMLProgram dmlProg,
VariableSet ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional)
- throws LanguageException, IOException
{
MultiAssignmentStatement mas = (MultiAssignmentStatement) current;
ArrayList<DataIdentifier> targetList = mas.getTargetList();
@@ -956,7 +951,6 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
}
public void setStatementFormatType(OutputStatement s, boolean conditionalValidate)
- throws LanguageException, ParseException
{
//case of specified format parameter
if (s.getExprParam(DataExpression.FORMAT_TYPE)!= null )
@@ -988,7 +982,6 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
}
public void setStatementFormatType(AssignmentStatement s, boolean conditionalValidate)
- throws LanguageException, ParseException
{
if (!(s.getSource() instanceof DataExpression))
@@ -1034,7 +1027,7 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
*
*/
@Override
- public VariableSet initializeforwardLV(VariableSet activeIn) throws LanguageException {
+ public VariableSet initializeforwardLV(VariableSet activeIn) {
for (Statement s : _statements){
s.initializeforwardLV(activeIn);
@@ -1081,15 +1074,11 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
}
@Override
- public VariableSet initializebackwardLV(VariableSet loPassed)
- throws LanguageException
- {
+ public VariableSet initializebackwardLV(VariableSet loPassed) {
int numStatements = _statements.size();
VariableSet lo = new VariableSet(loPassed);
- for (int i = numStatements-1; i>=0; i--){
+ for (int i = numStatements-1; i>=0; i--)
lo = _statements.get(i).initializebackwardLV(lo);
- }
-
return new VariableSet(lo);
}
@@ -1102,8 +1091,7 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
}
@Override
- public VariableSet analyze(VariableSet loPassed)
- throws LanguageException {
+ public VariableSet analyze(VariableSet loPassed) {
VariableSet candidateLO = new VariableSet();
candidateLO.addVariables(loPassed);
//candidateLO.addVariables(_gen);
@@ -1133,14 +1121,11 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
///////////////////////////////////////////////////////////////
// validate error handling (consistent for all expressions)
- public void raiseValidateError( String msg, boolean conditional )
- throws LanguageException
- {
+ public void raiseValidateError( String msg, boolean conditional ) {
raiseValidateError(msg, conditional, null);
}
public void raiseValidateError( String msg, boolean conditional, String errorCode )
- throws LanguageException
{
if( conditional ) //warning if conditional
{
@@ -1218,7 +1203,7 @@ public class StatementBlock extends LiveVariableAnalysis implements ParseInfo
// materialized hops recompilation / updateinplace flags
////
- public boolean updateRecompilationFlag() throws HopsException {
+ public boolean updateRecompilationFlag() {
return (_requiresRecompile =
ConfigurationManager.isDynamicRecompilation()
&& Recompiler.requiresRecompilation(getHops()));
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/StringIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/StringIdentifier.java b/src/main/java/org/apache/sysml/parser/StringIdentifier.java
index aaaade27..f4aaeed 100644
--- a/src/main/java/org/apache/sysml/parser/StringIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/StringIdentifier.java
@@ -26,7 +26,7 @@ public class StringIdentifier extends ConstIdentifier
private String _val;
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
return this;
}
@@ -69,9 +69,7 @@ public class StringIdentifier extends ConstIdentifier
}
@Override
- public long getLongValue()
- throws LanguageException
- {
+ public long getLongValue() {
throw new LanguageException("Unsupported string-to-long conversion.");
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/WhileStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/WhileStatement.java b/src/main/java/org/apache/sysml/parser/WhileStatement.java
index d70b1ab..f10dce4 100644
--- a/src/main/java/org/apache/sysml/parser/WhileStatement.java
+++ b/src/main/java/org/apache/sysml/parser/WhileStatement.java
@@ -29,7 +29,7 @@ public class WhileStatement extends Statement
private ArrayList<StatementBlock> _body;
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
+ public Statement rewriteStatement(String prefix) {
LOG.error(this.printErrorLocation() + "should not call rewriteStatement for WhileStatement");
throw new LanguageException(this.printErrorLocation() + "should not call rewriteStatement for WhileStatement");
}
@@ -82,14 +82,12 @@ public class WhileStatement extends Statement
}
@Override
- public void initializeforwardLV(VariableSet activeIn) throws LanguageException{
- LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for WhileStatement");
+ public void initializeforwardLV(VariableSet activeIn) {
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for WhileStatement");
}
@Override
- public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{
- LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for WhileStatement");
+ public VariableSet initializebackwardLV(VariableSet lo) {
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for WhileStatement");
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/WhileStatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/WhileStatementBlock.java b/src/main/java/org/apache/sysml/parser/WhileStatementBlock.java
index d34353a..58f1c9f 100644
--- a/src/main/java/org/apache/sysml/parser/WhileStatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/WhileStatementBlock.java
@@ -19,13 +19,11 @@
package org.apache.sysml.parser;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.recompile.Recompiler;
import org.apache.sysml.lops.Lop;
@@ -39,8 +37,7 @@ public class WhileStatementBlock extends StatementBlock
@Override
public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional)
- throws LanguageException, ParseException, IOException
- {
+ {
if (_statements.size() > 1){
raiseValidateError("WhileStatementBlock should have only 1 statement (while statement)", conditional);
}
@@ -165,7 +162,7 @@ public class WhileStatementBlock extends StatementBlock
}
@Override
- public VariableSet initializeforwardLV(VariableSet activeInPassed) throws LanguageException {
+ public VariableSet initializeforwardLV(VariableSet activeInPassed) {
WhileStatement wstmt = (WhileStatement)_statements.get(0);
if (_statements.size() > 1){
@@ -224,7 +221,7 @@ public class WhileStatementBlock extends StatementBlock
}
@Override
- public VariableSet initializebackwardLV(VariableSet loPassed) throws LanguageException{
+ public VariableSet initializebackwardLV(VariableSet loPassed) {
WhileStatement wstmt = (WhileStatement)_statements.get(0);
@@ -260,7 +257,7 @@ public class WhileStatementBlock extends StatementBlock
}
@Override
- public VariableSet analyze(VariableSet loPassed) throws LanguageException{
+ public VariableSet analyze(VariableSet loPassed) {
VariableSet predVars = new VariableSet();
predVars.addVariables(((WhileStatement)_statements.get(0)).getConditionalPredicate().variablesRead());
predVars.addVariables(((WhileStatement)_statements.get(0)).getConditionalPredicate().variablesUpdated());
@@ -313,7 +310,7 @@ public class WhileStatementBlock extends StatementBlock
// materialized hops recompilation flags
////
- public boolean updatePredicateRecompilationFlag() throws HopsException {
+ public boolean updatePredicateRecompilationFlag() {
return (_requiresPredicateRecompile =
ConfigurationManager.isDynamicRecompilation()
&& Recompiler.requiresRecompilation(getPredicateHops()));
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/dml/DMLParserWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/dml/DMLParserWrapper.java b/src/main/java/org/apache/sysml/parser/dml/DMLParserWrapper.java
index 8714968..b44d448 100644
--- a/src/main/java/org/apache/sysml/parser/dml/DMLParserWrapper.java
+++ b/src/main/java/org/apache/sysml/parser/dml/DMLParserWrapper.java
@@ -81,10 +81,9 @@ public class DMLParserWrapper extends ParserWrapper
* @param dmlScript script file contents
* @param argVals script arguments
* @return dml program, or null if error
- * @throws ParseException if ParseException occurs
*/
@Override
- public DMLProgram parse(String fileName, String dmlScript, Map<String,String> argVals) throws ParseException {
+ public DMLProgram parse(String fileName, String dmlScript, Map<String,String> argVals) {
DMLProgram prog = doParse(fileName, dmlScript, null, argVals);
return prog;
@@ -97,9 +96,8 @@ public class DMLParserWrapper extends ParserWrapper
* @param sourceNamespace namespace from source statement
* @param argVals script arguments
* @return dml program, or null if at least one error
- * @throws ParseException if ParseException occurs
*/
- public DMLProgram doParse(String fileName, String dmlScript, String sourceNamespace, Map<String,String> argVals) throws ParseException {
+ public DMLProgram doParse(String fileName, String dmlScript, String sourceNamespace, Map<String,String> argVals) {
DMLProgram dmlPgm = null;
ANTLRInputStream in;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/pydml/PyDMLParserWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/pydml/PyDMLParserWrapper.java b/src/main/java/org/apache/sysml/parser/pydml/PyDMLParserWrapper.java
index 8a81b46..7d96577 100644
--- a/src/main/java/org/apache/sysml/parser/pydml/PyDMLParserWrapper.java
+++ b/src/main/java/org/apache/sysml/parser/pydml/PyDMLParserWrapper.java
@@ -64,10 +64,9 @@ public class PyDMLParserWrapper extends ParserWrapper
* @param dmlScript script file contents
* @param argVals script arguments
* @return dml program, or null if error
- * @throws ParseException if ParseException occurs
*/
@Override
- public DMLProgram parse(String fileName, String dmlScript, Map<String,String> argVals) throws ParseException {
+ public DMLProgram parse(String fileName, String dmlScript, Map<String,String> argVals) {
DMLProgram prog = doParse(fileName, dmlScript, null, argVals);
return prog;
@@ -80,9 +79,8 @@ public class PyDMLParserWrapper extends ParserWrapper
* @param sourceNamespace namespace from source statement
* @param argVals script arguments
* @return dml program, or null if at least one error
- * @throws ParseException if ParseException occurs
*/
- public DMLProgram doParse(String fileName, String dmlScript, String sourceNamespace, Map<String,String> argVals) throws ParseException {
+ public DMLProgram doParse(String fileName, String dmlScript, String sourceNamespace, Map<String,String> argVals) {
DMLProgram dmlPgm = null;
ANTLRInputStream in;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/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 7348266..fdc4732 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/ParForProgramBlock.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/ParForProgramBlock.java
@@ -54,7 +54,6 @@ import org.apache.sysml.parser.ParForStatementBlock.ResultVar;
import org.apache.sysml.parser.StatementBlock;
import org.apache.sysml.parser.VariableSet;
import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
import org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext;
@@ -1301,7 +1300,6 @@ public class ParForProgramBlock extends ForProgramBlock
}
private void exportMatricesToHDFS(ExecutionContext ec, String... blacklistNames)
- throws CacheException
{
ParForStatementBlock sb = (ParForStatementBlock)getStatementBlock();
Set<String> blacklist = UtilFunctions.asSet(blacklistNames);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheException.java b/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheException.java
deleted file mode 100644
index 64a3925..0000000
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheException.java
+++ /dev/null
@@ -1,50 +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.controlprogram.caching;
-
-import org.apache.sysml.runtime.DMLRuntimeException;
-
-public class CacheException extends DMLRuntimeException
-{
-
-
- private static final long serialVersionUID = 1L;
-
- public CacheException ()
- {
- super ("Cache Exception");
- }
-
- public CacheException (String message)
- {
- super (message);
- }
-
- public CacheException (Exception cause)
- {
- super (cause);
- }
-
- public CacheException (String message, Exception cause)
- {
- super (message, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/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 cdc0f03..b3791e1 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
@@ -308,7 +308,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
}
public abstract void refreshMetaData()
- throws CacheException;
+ throws DMLRuntimeException;
public RDDObject getRDDHandle() {
return _rddHandle;
@@ -369,17 +369,16 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* Out-Status: READ(+1).
*
* @return cacheable data
- * @throws CacheException if CacheException occurs
+ * @throws DMLRuntimeException if CacheException occurs
*/
public synchronized T acquireRead()
- throws CacheException
{
if( LOG.isTraceEnabled() )
LOG.trace("Acquire read "+hashCode());
long t0 = DMLScript.STATISTICS ? System.nanoTime() : 0;
if ( !isAvailableToRead() )
- throw new CacheException ("MatrixObject not available to read.");
+ throw new DMLRuntimeException("MatrixObject not available to read.");
//get object from cache
if( _data == null )
@@ -391,7 +390,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
GPUObject gObj = kv.getValue();
if (gObj != null && copiedFromGPU && gObj.isDirty()) {
LOG.error("Inconsistent internal state - A copy of this CacheableData was dirty on more than 1 GPU");
- throw new CacheException("Internal Error : Inconsistent internal state, A copy of this CacheableData was dirty on more than 1 GPU");
+ throw new DMLRuntimeException("Internal Error : Inconsistent internal state, A copy of this CacheableData was dirty on more than 1 GPU");
} else if (gObj != null){
copiedFromGPU = gObj.acquireHostRead(null);
if( _data == null )
@@ -412,7 +411,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
{
//check filename
if( _hdfsFileName == null )
- throw new CacheException("Cannot read matrix for empty filename.");
+ throw new DMLRuntimeException("Cannot read matrix for empty filename.");
//read cacheable data from hdfs
_data = readBlobFromHDFS( _hdfsFileName );
@@ -434,7 +433,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
setDirty(false);
}
catch (IOException e) {
- throw new CacheException("Reading of " + _hdfsFileName + " ("+hashCode()+") failed.", e);
+ throw new DMLRuntimeException("Reading of " + _hdfsFileName + " ("+hashCode()+") failed.", e);
}
_isAcquireFromEmpty = true;
@@ -446,7 +445,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
}
//cache status maintenance
- acquire( false, _data==null );
+ acquire( false, _data==null );
updateStatusPinned(true);
if( DMLScript.STATISTICS ){
@@ -466,17 +465,16 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* Out-Status: MODIFY.
*
* @return cacheable data
- * @throws CacheException if CacheException occurs
+ * @throws DMLRuntimeException if CacheException occurs
*/
public synchronized T acquireModify()
- throws CacheException
{
if( LOG.isTraceEnabled() )
LOG.trace("Acquire modify "+hashCode());
long t0 = DMLScript.STATISTICS ? System.nanoTime() : 0;
if ( !isAvailableToModify() )
- throw new CacheException("MatrixObject not available to modify.");
+ throw new DMLRuntimeException("MatrixObject not available to modify.");
//get object from cache
if( _data == null )
@@ -487,16 +485,14 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
{
//check filename
if( _hdfsFileName == null )
- throw new CacheException("Cannot read matrix for empty filename.");
+ throw new DMLRuntimeException("Cannot read matrix for empty filename.");
//load data
- try
- {
+ try {
_data = readBlobFromHDFS( _hdfsFileName );
}
- catch (IOException e)
- {
- throw new CacheException("Reading of " + _hdfsFileName + " ("+hashCode()+") failed.", e);
+ catch (IOException e) {
+ throw new DMLRuntimeException("Reading of " + _hdfsFileName + " ("+hashCode()+") failed.", e);
}
}
@@ -514,7 +510,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
return _data;
}
- public T acquireModify(T newData) throws DMLRuntimeException {
+ public T acquireModify(T newData) {
return acquireModify(newData, null);
}
@@ -532,14 +528,13 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* @throws DMLRuntimeException if error occurs
*/
public synchronized T acquireModify(T newData, String opcode)
- throws DMLRuntimeException
{
if( LOG.isTraceEnabled() )
LOG.trace("Acquire modify newdata "+hashCode());
long t0 = DMLScript.STATISTICS ? System.nanoTime() : 0;
if (! isAvailableToModify ())
- throw new CacheException ("CacheableData not available to modify.");
+ throw new DMLRuntimeException("CacheableData not available to modify.");
//clear old data
clearData();
@@ -552,7 +547,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
//set references to new data
if (newData == null)
- throw new CacheException("acquireModify with empty cache block.");
+ throw new DMLRuntimeException("acquireModify with empty cache block.");
_data = newData;
updateStatusPinned(true);
@@ -573,7 +568,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
return _data;
}
- public void release() throws CacheException {
+ public void release() throws DMLRuntimeException {
release(null);
}
@@ -587,10 +582,9 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* In-Status: READ, MODIFY;
* Out-Status: READ(-1), EVICTABLE, EMPTY.
*
- * @throws CacheException if CacheException occurs
+ * @throws DMLRuntimeException if CacheException occurs
*/
public synchronized void release(String opcode)
- throws CacheException
{
if( LOG.isTraceEnabled() )
LOG.trace("Release "+hashCode());
@@ -633,14 +627,14 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
}
}
catch (Exception e) {
- throw new CacheException("Eviction to local path " + filePath + " ("+hashCode()+") failed.", e);
+ throw new DMLRuntimeException("Eviction to local path " + filePath + " ("+hashCode()+") failed.", e);
}
_requiresLocalWrite = false;
}
//create cache
createCache();
- _data = null;
+ _data = null;
}
else if( LOG.isTraceEnabled() ){
LOG.trace("Var "+hashCode()+" not subject to caching, state="+getStatusAsString());
@@ -663,7 +657,6 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* @throws DMLRuntimeException if error occurs
*/
public synchronized void clearData()
- throws DMLRuntimeException
{
if( LOG.isTraceEnabled() )
LOG.trace("Clear data "+hashCode());
@@ -672,7 +665,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
if( !isCleanupEnabled() )
return; // do nothing
if( !isAvailableToModify() )
- throw new CacheException ("CacheableData (" + getDebugName() + ") not available to "
+ throw new DMLRuntimeException("CacheableData (" + getDebugName() + ") not available to "
+ "modify. Status = " + getStatusAsString() + ".");
// clear existing WB / FS representation (but prevent unnecessary probes)
@@ -699,7 +692,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
setEmpty();
}
- public synchronized void exportData() throws CacheException {
+ public synchronized void exportData() {
exportData( -1 );
}
@@ -710,30 +703,22 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* Out-Status: EMPTY, EVICTABLE, EVICTED, READ.
*
* @param replication ?
- * @throws CacheException if CacheException occurs
+ * @throws DMLRuntimeException if CacheException occurs
*/
- public synchronized void exportData( int replication )
- throws CacheException
- {
+ public synchronized void exportData( int replication ) {
exportData(_hdfsFileName, null, replication, null);
_hdfsFileExists = true;
}
- public synchronized void exportData(String fName, String outputFormat)
- throws CacheException
- {
+ public synchronized void exportData(String fName, String outputFormat) {
exportData(fName, outputFormat, -1, null);
}
- public synchronized void exportData(String fName, String outputFormat, FileFormatProperties formatProperties)
- throws CacheException
- {
+ public synchronized void exportData(String fName, String outputFormat, FileFormatProperties formatProperties) {
exportData(fName, outputFormat, -1, formatProperties);
}
- public synchronized void exportData (String fName, String outputFormat, int replication, FileFormatProperties formatProperties)
- throws CacheException
- {
+ public synchronized void exportData (String fName, String outputFormat, int replication, FileFormatProperties formatProperties) {
exportData(fName, outputFormat, replication, formatProperties, null);
}
@@ -753,36 +738,33 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* @param replication ?
* @param formatProperties file format properties
* @param opcode instruction opcode if available
- * @throws CacheException if CacheException occurs
+ * @throws DMLRuntimeException if CacheException occurs
*/
- public synchronized void exportData (String fName, String outputFormat, int replication, FileFormatProperties formatProperties, String opcode)
- throws CacheException
- {
+ public synchronized void exportData (String fName, String outputFormat, int replication, FileFormatProperties formatProperties, String opcode) {
if( LOG.isTraceEnabled() )
LOG.trace("Export data "+hashCode()+" "+fName);
long t0 = DMLScript.STATISTICS ? System.nanoTime() : 0;
//prevent concurrent modifications
if ( !isAvailableToRead() )
- throw new CacheException ("MatrixObject not available to read.");
+ throw new DMLRuntimeException("MatrixObject not available to read.");
LOG.trace("Exporting " + this.getDebugName() + " to " + fName + " in format " + outputFormat);
//TODO remove
- boolean copiedFromGPU = false;
- for (Map.Entry<GPUContext, GPUObject> kv : _gpuObjects.entrySet()) {
- GPUObject gObj = kv.getValue();
- if (gObj != null && copiedFromGPU && gObj.isDirty()) {
- LOG.error("Inconsistent internal state - A copy of this CacheableData was dirty on more than 1 GPU");
- throw new CacheException("Internal Error : Inconsistent internal state, A copy of this CacheableData was dirty on more than 1 GPU");
- } else if (gObj != null){
- copiedFromGPU = gObj.acquireHostRead(null);
- if( _data == null )
- getCache();
- }
- }
+ boolean copiedFromGPU = false;
+ for (Map.Entry<GPUContext, GPUObject> kv : _gpuObjects.entrySet()) {
+ GPUObject gObj = kv.getValue();
+ if (gObj != null && copiedFromGPU && gObj.isDirty()) {
+ throw new DMLRuntimeException("Internal Error : Inconsistent internal state, A copy of this CacheableData was dirty on more than 1 GPU");
+ } else if (gObj != null){
+ copiedFromGPU = gObj.acquireHostRead(null);
+ if( _data == null )
+ getCache();
+ }
+ }
- //check for persistent or transient writes
+ //check for persistent or transient writes
boolean pWrite = !fName.equals(_hdfsFileName);
if( !pWrite )
setHDFSFileExists(true);
@@ -792,14 +774,14 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
new Path(_hdfsFileName), new Path(fName));
//actual export (note: no direct transfer of local copy in order to ensure blocking (and hence, parallelism))
- if( isDirty() || !eqScheme ||
- (pWrite && !isEqualOutputFormat(outputFormat)) )
- {
+ if( isDirty() || !eqScheme ||
+ (pWrite && !isEqualOutputFormat(outputFormat)) )
+ {
// CASE 1: dirty in-mem matrix or pWrite w/ different format (write matrix to fname; load into memory if evicted)
- // a) get the matrix
+ // a) get the matrix
if( isEmpty(true) )
{
- //read data from HDFS if required (never read before), this applies only to pWrite w/ different output formats
+ //read data from HDFS if required (never read before), this applies only to pWrite w/ different output formats
//note: for large rdd outputs, we compile dedicated writespinstructions (no need to handle this here)
try
{
@@ -811,7 +793,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
}
catch (IOException e)
{
- throw new CacheException("Reading of " + _hdfsFileName + " ("+hashCode()+") failed.", e);
+ throw new DMLRuntimeException("Reading of " + _hdfsFileName + " ("+hashCode()+") failed.", e);
}
}
//get object from cache
@@ -820,19 +802,16 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
acquire( false, _data==null ); //incl. read matrix if evicted
// b) write the matrix
- try
- {
+ try {
writeMetaData( fName, outputFormat, formatProperties );
writeBlobToHDFS( fName, outputFormat, replication, formatProperties );
if ( !pWrite )
setDirty(false);
}
- catch (Exception e)
- {
- throw new CacheException ("Export to " + fName + " failed.", e);
+ catch (Exception e) {
+ throw new DMLRuntimeException("Export to " + fName + " failed.", e);
}
- finally
- {
+ finally {
release(opcode);
}
}
@@ -850,7 +829,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
writeMetaData( fName, outputFormat, formatProperties );
}
catch (Exception e) {
- throw new CacheException ("Export to " + fName + " failed.", e);
+ throw new DMLRuntimeException("Export to " + fName + " failed.", e);
}
}
else if( getRDDHandle()!=null && getRDDHandle().isPending()
@@ -868,7 +847,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
getRDDHandle().setPending(false);
}
catch (Exception e) {
- throw new CacheException ("Export to " + fName + " failed.", e);
+ throw new DMLRuntimeException("Export to " + fName + " failed.", e);
}
}
else
@@ -902,11 +881,9 @@ 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 CacheException if CacheException occurs
+ * @throws DMLRuntimeException if CacheException occurs
*/
- protected void restoreBlobIntoMemory()
- throws CacheException
- {
+ protected void restoreBlobIntoMemory() {
String cacheFilePathAndName = getCacheFilePathAndName();
long begin = LOG.isTraceEnabled() ? System.currentTimeMillis() : 0;
@@ -915,22 +892,22 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
(_hdfsFileName == null ? "null" : _hdfsFileName) + ", Restore from path: " + cacheFilePathAndName);
if (_data != null)
- throw new CacheException (cacheFilePathAndName + " : Cannot restore on top of existing in-memory data.");
+ throw new DMLRuntimeException(cacheFilePathAndName + " : Cannot restore on top of existing in-memory data.");
try {
_data = readBlobFromCache(cacheFilePathAndName);
}
catch (IOException e) {
- throw new CacheException (cacheFilePathAndName + " : Restore failed.", e);
+ throw new DMLRuntimeException(cacheFilePathAndName + " : Restore failed.", e);
}
//check for success
- if (_data == null)
- throw new CacheException (cacheFilePathAndName + " : Restore failed.");
-
- if( LOG.isTraceEnabled() )
- LOG.trace("Restoring matrix - COMPLETED ... " + (System.currentTimeMillis()-begin) + " msec.");
- }
+ if (_data == null)
+ throw new DMLRuntimeException (cacheFilePathAndName + " : Restore failed.");
+
+ if( LOG.isTraceEnabled() )
+ LOG.trace("Restoring matrix - COMPLETED ... " + (System.currentTimeMillis()-begin) + " msec.");
+ }
protected abstract T readBlobFromCache(String fname)
throws IOException;
@@ -989,22 +966,22 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
throws IOException;
protected abstract void writeBlobToHDFS(String fname, String ofmt, int rep, FileFormatProperties fprop)
- throws IOException, DMLRuntimeException;
+ throws IOException;
protected abstract void writeBlobFromRDDtoHDFS(RDDObject rdd, String fname, String ofmt)
- throws IOException, DMLRuntimeException;
+ throws IOException;
protected void writeMetaData (String filePathAndName, String outputFormat, FileFormatProperties formatProperties)
- throws DMLRuntimeException, IOException
+ throws IOException
{
MetaDataFormat iimd = (MetaDataFormat) _metaData;
if (iimd == null)
throw new DMLRuntimeException("Unexpected error while writing mtd file (" + filePathAndName + ") -- metadata is null.");
- // Write the matrix to HDFS in requested format
+ // Write the matrix to HDFS in requested format
OutputInfo oinfo = (outputFormat != null ? OutputInfo.stringToOutputInfo (outputFormat)
- : InputInfo.getMatchingOutputInfo (iimd.getInputInfo ()));
+ : InputInfo.getMatchingOutputInfo (iimd.getInputInfo ()));
if ( oinfo != OutputInfo.MatrixMarketOutputInfo ) {
// Get the dimension information from the metadata stored within MatrixObject
@@ -1020,7 +997,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
//write the actual meta data file
MapReduceTool.writeMetaDataFile (filePathAndName + ".mtd", valueType,
- getSchema(), dataType, mc, oinfo, formatProperties);
+ getSchema(), dataType, mc, oinfo, formatProperties);
}
}
@@ -1079,11 +1056,8 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* @param isModify : <code>true</code> for the exclusive "modify" lock,
* <code>false</code> for a shared "read" lock.
* @param restore true if restore
- * @throws CacheException if CacheException occurs
*/
- protected void acquire (boolean isModify, boolean restore)
- throws CacheException
- {
+ protected void acquire (boolean isModify, boolean restore) {
switch ( _cacheStatus )
{
case CACHED:
@@ -1098,12 +1072,12 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
break;
case READ:
if (isModify)
- throw new CacheException ("READ-MODIFY not allowed.");
+ throw new DMLRuntimeException("READ-MODIFY not allowed.");
else
addOneRead();
break;
case MODIFY:
- throw new CacheException ("MODIFY-MODIFY not allowed.");
+ throw new DMLRuntimeException("MODIFY-MODIFY not allowed.");
}
if( LOG.isTraceEnabled() )
@@ -1122,17 +1096,15 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
* the lock count.
*
* @param cacheNoWrite ?
- * @throws CacheException if CacheException occurs
*/
protected void release(boolean cacheNoWrite)
- throws CacheException
{
switch ( _cacheStatus )
{
case EMPTY:
case CACHED:
- case CACHED_NOWRITE:
- throw new CacheException("Redundant release.");
+ case CACHED_NOWRITE:
+ throw new DMLRuntimeException("Redundant release.");
case READ:
removeOneRead( isBlobPresent(), cacheNoWrite );
break;
@@ -1141,7 +1113,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
setCached();
else
setEmpty();
- break;
+ break;
}
if( LOG.isTraceEnabled() )
@@ -1160,7 +1132,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
public String getStatusAsString() {
return _cacheStatus.toString();
}
-
+
public boolean isCached(boolean inclCachedNoWrite) {
if( inclCachedNoWrite )
return (_cacheStatus == CacheStatus.CACHED || _cacheStatus == CacheStatus.CACHED_NOWRITE);
@@ -1371,9 +1343,7 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
_activeFlag = true;
}
- public synchronized boolean moveData(String fName, String outputFormat)
- throws CacheException
- {
+ public synchronized boolean moveData(String fName, String outputFormat) {
boolean ret = false;
try
@@ -1396,11 +1366,10 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
MapReduceTool.renameFileOnHDFS( _hdfsFileName, fName );
writeMetaData( fName, outputFormat, null );
ret = true;
- }
+ }
}
- catch (Exception e)
- {
- throw new CacheException ("Move to " + fName + " failed.", e);
+ catch (Exception e) {
+ throw new DMLRuntimeException("Move to " + fName + " failed.", e);
}
return ret;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/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 28510cd..a37ac69 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
@@ -133,10 +133,10 @@ public class FrameObject extends CacheableData<FrameBlock>
@Override
public void refreshMetaData()
- throws CacheException
+ throws DMLRuntimeException
{
if ( _data == null || _metaData ==null ) //refresh only for existing data
- throw new CacheException("Cannot refresh meta data because there is no data or meta data. ");
+ throw new DMLRuntimeException("Cannot refresh meta data because there is no data or meta data. ");
//update matrix characteristics
MatrixCharacteristics mc = _metaData.getMatrixCharacteristics();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/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 8bf8efd..6aefbb3 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
@@ -140,15 +140,11 @@ public class MatrixObject extends CacheableData<MatrixBlock>
/**
* Make the matrix metadata consistent with the in-memory matrix data
- *
- * @throws CacheException if CacheException occurs
*/
@Override
- public void refreshMetaData()
- throws CacheException
- {
+ public void refreshMetaData() {
if ( _data == null || _metaData ==null ) //refresh only for existing data
- throw new CacheException("Cannot refresh meta data because there is no data or meta data. ");
+ throw new DMLRuntimeException("Cannot refresh meta data because there is no data or meta data. ");
//we need to throw an exception, otherwise input/output format cannot be inferred
MatrixCharacteristics mc = _metaData.getMatrixCharacteristics();
@@ -233,17 +229,17 @@ public class MatrixObject extends CacheableData<MatrixBlock>
*
* @param pred index range
* @return matrix block
- * @throws CacheException if CacheException occurs
+ * @throws DMLRuntimeException if CacheException occurs
*/
public synchronized MatrixBlock readMatrixPartition( IndexRange pred )
- throws CacheException
+ throws DMLRuntimeException
{
if( LOG.isTraceEnabled() )
LOG.trace("Acquire partition "+hashCode()+" "+pred);
long t0 = DMLScript.STATISTICS ? System.nanoTime() : 0;
if ( !_partitioned )
- throw new CacheException ("MatrixObject not available to indexed read.");
+ throw new DMLRuntimeException("MatrixObject not available to indexed read.");
//return static partition of set from outside of the program
if( _partitionInMemory != null )
@@ -302,7 +298,7 @@ public class MatrixObject extends CacheableData<MatrixBlock>
cols = _partitionSize;
break;
default:
- throw new CacheException("Unsupported partition format: "+_partitionFormat);
+ throw new DMLRuntimeException("Unsupported partition format: "+_partitionFormat);
}
@@ -338,9 +334,8 @@ public class MatrixObject extends CacheableData<MatrixBlock>
//NOTE: currently no special treatment of non-existing partitions necessary
// because empty blocks are written anyway
}
- catch(Exception ex)
- {
- throw new CacheException(ex);
+ catch(Exception ex) {
+ throw new DMLRuntimeException(ex);
}
if( DMLScript.STATISTICS ){
@@ -352,10 +347,10 @@ public class MatrixObject extends CacheableData<MatrixBlock>
}
public String getPartitionFileName( IndexRange pred, int brlen, int bclen )
- throws CacheException
+ throws DMLRuntimeException
{
if ( !_partitioned )
- throw new CacheException ("MatrixObject not available to indexed read.");
+ throw new DMLRuntimeException("MatrixObject not available to indexed read.");
StringBuilder sb = new StringBuilder();
sb.append(_hdfsFileName);
@@ -387,7 +382,7 @@ public class MatrixObject extends CacheableData<MatrixBlock>
sb.append((pred.colStart-1)/_partitionSize+1);
break;
default:
- throw new CacheException ("MatrixObject not available to indexed read.");
+ throw new DMLRuntimeException("MatrixObject not available to indexed read.");
}
return sb.toString();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/ResultMergeLocalFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/ResultMergeLocalFile.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/ResultMergeLocalFile.java
index 0768328..b2bd267 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/ResultMergeLocalFile.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/ResultMergeLocalFile.java
@@ -42,7 +42,6 @@ import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
import org.apache.sysml.runtime.controlprogram.parfor.util.Cell;
import org.apache.sysml.runtime.controlprogram.parfor.util.IDSequence;
@@ -976,7 +975,7 @@ public class ResultMergeLocalFile extends ResultMerge
}
private static void copyAllFiles( String fnameNew, ArrayList<MatrixObject> inMO )
- throws CacheException, IOException
+ throws DMLRuntimeException, IOException
{
JobConf job = new JobConf(ConfigurationManager.getCachedJobConf());
Path path = new Path( fnameNew );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
index 28368c7..fc42996 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/OptTreePlanChecker.java
@@ -50,7 +50,6 @@ public class OptTreePlanChecker
{
public static void checkProgramCorrectness( ProgramBlock pb, StatementBlock sb, Set<String> fnStack )
- throws HopsException, DMLRuntimeException
{
Program prog = pb.getProgram();
DMLProgram dprog = sb.getDMLProg();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
index 3bb0c93..71295b4 100644
--- a/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
+++ b/src/main/java/org/apache/sysml/runtime/controlprogram/parfor/opt/ProgramRecompiler.java
@@ -19,7 +19,6 @@
package org.apache.sysml.runtime.controlprogram.parfor.opt;
-import java.io.IOException;
import java.util.ArrayList;
import org.apache.sysml.conf.ConfigurationManager;
@@ -33,7 +32,6 @@ import org.apache.sysml.hops.codegen.SpoofCompiler.IntegrationType;
import org.apache.sysml.hops.recompile.Recompiler;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.parser.DMLProgram;
import org.apache.sysml.parser.DMLTranslator;
import org.apache.sysml.parser.ForStatement;
@@ -60,7 +58,6 @@ import org.apache.sysml.runtime.instructions.cp.ScalarObject;
public class ProgramRecompiler
{
public static ArrayList<ProgramBlock> generatePartitialRuntimeProgram(Program rtprog, ArrayList<StatementBlock> sbs)
- throws LopsException, DMLRuntimeException, IOException, HopsException
{
ArrayList<ProgramBlock> ret = new ArrayList<>();
DMLConfig config = ConfigurationManager.getDMLConfig();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java
index ffad8ff..ba5fad0 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java
@@ -19,7 +19,6 @@
package org.apache.sysml.runtime.instructions.cp;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.LiteralOp;
import org.apache.sysml.parser.Expression.ValueType;
import org.apache.sysml.runtime.util.UtilFunctions;
@@ -66,7 +65,7 @@ public abstract class ScalarObjectFactory
}
}
- public static ScalarObject createScalarObject(ValueType vt, LiteralOp lit) throws HopsException {
+ public static ScalarObject createScalarObject(ValueType vt, LiteralOp lit) {
switch( vt ) {
case DOUBLE: return new DoubleObject(lit.getDoubleValue());
case INT: return new IntObject(lit.getLongValue());
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
index 14eadeb..f656216 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
@@ -43,7 +43,6 @@ import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
import org.apache.sysml.runtime.controlprogram.parfor.util.Cell;
@@ -224,13 +223,8 @@ public class ParameterizedBuiltinCPFileInstruction extends ParameterizedBuiltinC
if( rows==0 || cols ==0 ){
rows = Math.max(rows, 1);
cols = Math.max(cols, 1);
- try {
- moNew.acquireModify(new MatrixBlock((int)rows, (int) cols, true));
- moNew.release();
- }
- catch (CacheException e) {
- throw new DMLRuntimeException(e);
- }
+ moNew.acquireModify(new MatrixBlock((int)rows, (int) cols, true));
+ moNew.release();
}
//create deep copy of metadata obj
[06/10] systemml git commit: [SYSTEMML-2191] Cleanup exception
hierarchy and handling, part 1
Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/compile/Dag.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/compile/Dag.java b/src/main/java/org/apache/sysml/lops/compile/Dag.java
index b777623..f0f74cc 100644
--- a/src/main/java/org/apache/sysml/lops/compile/Dag.java
+++ b/src/main/java/org/apache/sysml/lops/compile/Dag.java
@@ -19,7 +19,6 @@
package org.apache.sysml.lops.compile;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -240,12 +239,8 @@ public class Dag<N extends Lop>
* @param sb statement block
* @param config dml configuration
* @return list of instructions
- * @throws LopsException if LopsException occurs
- * @throws IOException if IOException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- public ArrayList<Instruction> getJobs(StatementBlock sb, DMLConfig config)
- throws LopsException, DMLRuntimeException {
+ public ArrayList<Instruction> getJobs(StatementBlock sb, DMLConfig config) {
if (config != null) {
total_reducers = config.getIntValue(DMLConfig.NUM_REDUCERS);
scratch = config.getTextValue(DMLConfig.SCRATCH_SPACE) + "/";
@@ -267,9 +262,7 @@ public class Dag<N extends Lop>
}
- private static void deleteUpdatedTransientReadVariables(StatementBlock sb, ArrayList<Lop> nodeV,
- ArrayList<Instruction> inst) throws DMLRuntimeException {
-
+ private static void deleteUpdatedTransientReadVariables(StatementBlock sb, ArrayList<Lop> nodeV, ArrayList<Instruction> inst) {
if ( sb == null )
return;
@@ -341,8 +334,7 @@ public class Dag<N extends Lop>
}
- private static void generateRemoveInstructions(StatementBlock sb, ArrayList<Instruction> deleteInst)
- throws DMLRuntimeException {
+ private static void generateRemoveInstructions(StatementBlock sb, ArrayList<Instruction> deleteInst) {
if ( sb == null )
return;
@@ -350,7 +342,6 @@ public class Dag<N extends Lop>
if( LOG.isTraceEnabled() )
LOG.trace("In generateRemoveInstructions()");
-
Instruction inst = null;
// RULE 1: if in IN and not in OUT, then there should be an rmvar or rmfilevar inst
// (currently required for specific cases of external functions)
@@ -384,9 +375,7 @@ public class Dag<N extends Lop>
}
}
- private static boolean isCompatible(ArrayList<Lop> nodes, JobType jt, int from, int to)
- throws LopsException
- {
+ private static boolean isCompatible(ArrayList<Lop> nodes, JobType jt, int from, int to) {
int base = jt.getBase();
for ( Lop node : nodes ) {
if ((node.getCompatibleJobs() & base) == 0) {
@@ -427,7 +416,7 @@ public class Dag<N extends Lop>
* Add node, and its relevant children to job-specific node vectors.
*/
private void addNodeByJobType(Lop node, ArrayList<ArrayList<Lop>> arr,
- ArrayList<Lop> execNodes, boolean eliminate) throws LopsException {
+ ArrayList<Lop> execNodes, boolean eliminate) {
if (!eliminate) {
// Check if this lop defines a MR job.
@@ -534,11 +523,10 @@ public class Dag<N extends Lop>
* @param execNodes list of exec low-level operators
* @param jobNodes list of job low-level operators
* @param finishedNodes list of finished low-level operators
- * @throws LopsException if LopsException occurs
*/
private void handleSingleOutputJobs(ArrayList<Lop> execNodes,
ArrayList<ArrayList<Lop>> jobNodes, ArrayList<Lop> finishedNodes)
- throws LopsException {
+ {
/*
* If the input of a MMCJ/MMRJ job (must have executed in a Mapper) is used
* by multiple lops then we should mark it as not-finished.
@@ -635,11 +623,8 @@ public class Dag<N extends Lop>
*
* @param nodes_v list of nodes
* @param inst list of instructions
- * @throws LopsException if LopsException occurs
- * @throws IOException if IOException occurs
*/
- private static void generateInstructionsForInputVariables(ArrayList<Lop> nodes_v, ArrayList<Instruction> inst)
- throws LopsException {
+ private static void generateInstructionsForInputVariables(ArrayList<Lop> nodes_v, ArrayList<Instruction> inst) {
for(Lop n : nodes_v) {
if (n.getExecLocation() == ExecLocation.Data && !((Data) n).isTransient()
&& ((Data) n).getOperationType() == OperationTypes.READ
@@ -767,12 +752,8 @@ public class Dag<N extends Lop>
* @param sb statement block
* @param node_v list of low-level operators
* @return list of instructions
- * @throws LopsException if LopsException occurs
- * @throws IOException if IOException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
private ArrayList<Instruction> doGreedyGrouping(StatementBlock sb, ArrayList<Lop> node_v)
- throws LopsException, DMLRuntimeException
{
if( LOG.isTraceEnabled() )
LOG.trace("Grouping DAG ============");
@@ -1246,9 +1227,8 @@ public class Dag<N extends Lop>
* @param node low-level operator
* @param inst list of instructions
* @param delteInst list of instructions
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- private static void processConsumersForInputs(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> delteInst) throws DMLRuntimeException {
+ private static void processConsumersForInputs(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> delteInst) {
// reduce the consumer count for all input lops
// if the count becomes zero, then then variable associated w/ input can be removed
for(Lop in : node.getInputs() ) {
@@ -1261,7 +1241,7 @@ public class Dag<N extends Lop>
}
}
- private static void processConsumers(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> deleteInst, Lop locationInfo) throws DMLRuntimeException {
+ private static void processConsumers(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> deleteInst, Lop locationInfo) {
// reduce the consumer count for all input lops
// if the count becomes zero, then then variable associated w/ input can be removed
if ( node.removeConsumer() == 0 ) {
@@ -1290,11 +1270,9 @@ public class Dag<N extends Lop>
* @param inst list of instructions
* @param writeInst list of write instructions
* @param deleteInst list of delete instructions
- * @throws LopsException if LopsException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
private void generateControlProgramJobs(ArrayList<Lop> execNodes,
- ArrayList<Instruction> inst, ArrayList<Instruction> writeInst, ArrayList<Instruction> deleteInst) throws LopsException, DMLRuntimeException {
+ ArrayList<Instruction> inst, ArrayList<Instruction> writeInst, ArrayList<Instruction> deleteInst) {
// nodes to be deleted from execnodes
ArrayList<Lop> markedNodes = new ArrayList<>();
@@ -1569,11 +1547,10 @@ public class Dag<N extends Lop>
* @param execNodes list of exec nodes
* @param queuedNodes list of queued nodes
* @param jobvec list of lists of low-level operators
- * @throws LopsException if LopsException occurs
*/
private void removeNodesForNextIteration(Lop node, ArrayList<Lop> finishedNodes,
ArrayList<Lop> execNodes, ArrayList<Lop> queuedNodes,
- ArrayList<ArrayList<Lop>> jobvec) throws LopsException {
+ ArrayList<ArrayList<Lop>> jobvec) {
// only queued nodes with multiple inputs need to be handled.
if (node.getInputs().size() == 1)
@@ -1900,9 +1877,8 @@ public class Dag<N extends Lop>
* @param lops low-level operator
* @param jobvec list of lists of low-level operators
* @return job index for a low-level operator
- * @throws LopsException if LopsException occurs
*/
- private static int jobType(Lop lops, ArrayList<ArrayList<Lop>> jobvec) throws LopsException {
+ private static int jobType(Lop lops, ArrayList<ArrayList<Lop>> jobvec) {
for ( JobType jt : JobType.values()) {
int i = jt.getId();
if (i > 0 && jobvec.get(i) != null && jobvec.get(i).contains(lops)) {
@@ -1969,10 +1945,8 @@ public class Dag<N extends Lop>
* Method to print the lops grouped by job type
*
* @param jobNodes list of lists of low-level operators
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
private static void printJobNodes(ArrayList<ArrayList<Lop>> jobNodes)
- throws DMLRuntimeException
{
if (LOG.isTraceEnabled()){
for ( JobType jt : JobType.values() ) {
@@ -2063,14 +2037,11 @@ public class Dag<N extends Lop>
* @param writeinst list of write instructions
* @param deleteinst list of delete instructions
* @param jobNodes list of list of low-level operators
- * @throws LopsException if LopsException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
private void generateMRJobs(ArrayList<Lop> execNodes,
ArrayList<Instruction> inst,
ArrayList<Instruction> writeinst,
ArrayList<Instruction> deleteinst, ArrayList<ArrayList<Lop>> jobNodes)
- throws LopsException, DMLRuntimeException
{
printJobNodes(jobNodes);
@@ -2195,10 +2166,8 @@ public class Dag<N extends Lop>
* @param node low-level operator
* @param cellModeOverride override mode
* @return output info
- * @throws LopsException if LopsException occurs
*/
- private static OutputInfo getOutputInfo(Lop node, boolean cellModeOverride)
- throws LopsException
+ private static OutputInfo getOutputInfo(Lop node, boolean cellModeOverride)
{
if ( (node.getDataType() == DataType.SCALAR && node.getExecType() == ExecType.CP)
|| node instanceof FunctionCallCP )
@@ -2290,11 +2259,8 @@ public class Dag<N extends Lop>
* @param cellModeOverride override mode
* @param copyTWrite ?
* @return node output
- * @throws DMLRuntimeException if DMLRuntimeException occurs
- * @throws LopsException if LopsException occurs
*/
- private NodeOutput setupNodeOutputs(Lop node, ExecType et, boolean cellModeOverride, boolean copyTWrite)
- throws DMLRuntimeException, LopsException {
+ private NodeOutput setupNodeOutputs(Lop node, ExecType et, boolean cellModeOverride, boolean copyTWrite) {
OutputParameters oparams = node.getOutputParameters();
NodeOutput out = new NodeOutput();
@@ -2656,12 +2622,10 @@ public class Dag<N extends Lop>
* @param deleteinst list of delete instructions
* @param rmvarinst list of rmvar instructions
* @param jt job type
- * @throws LopsException if LopsException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
private void generateMapReduceInstructions(ArrayList<Lop> execNodes,
ArrayList<Instruction> inst, ArrayList<Instruction> writeinst, ArrayList<Instruction> deleteinst, ArrayList<Instruction> rmvarinst,
- JobType jt) throws LopsException, DMLRuntimeException
+ JobType jt)
{
ArrayList<Byte> resultIndices = new ArrayList<>();
ArrayList<String> inputs = new ArrayList<>();
@@ -2936,7 +2900,6 @@ public class Dag<N extends Lop>
* @param inputLops list of input lops
* @param MRJobLineNumbers MR job line numbers
* @return -1 if problem
- * @throws LopsException if LopsException occurs
*/
private int getAggAndOtherInstructions(Lop node, ArrayList<Lop> execNodes,
ArrayList<String> shuffleInstructions,
@@ -2944,7 +2907,7 @@ public class Dag<N extends Lop>
ArrayList<String> otherInstructionsReducer,
HashMap<Lop, Integer> nodeIndexMapping, int[] start_index,
ArrayList<String> inputLabels, ArrayList<Lop> inputLops,
- ArrayList<Integer> MRJobLineNumbers) throws LopsException
+ ArrayList<Integer> MRJobLineNumbers)
{
int ret_val = -1;
@@ -3193,14 +3156,13 @@ public class Dag<N extends Lop>
* @param inputLops list of input lops
* @param MRJobLineNumbers MR job line numbers
* @return -1 if problem
- * @throws LopsException if LopsException occurs
*/
private static int getRecordReaderInstructions(Lop node, ArrayList<Lop> execNodes,
ArrayList<String> inputStrings,
ArrayList<String> recordReaderInstructions,
HashMap<Lop, Integer> nodeIndexMapping, int[] start_index,
ArrayList<String> inputLabels, ArrayList<Lop> inputLops,
- ArrayList<Integer> MRJobLineNumbers) throws LopsException
+ ArrayList<Integer> MRJobLineNumbers)
{
// if input source, return index
if (nodeIndexMapping.containsKey(node))
@@ -3294,14 +3256,13 @@ public class Dag<N extends Lop>
* @param inputLabels input labels
* @param MRJoblineNumbers MR job line numbers
* @return -1 if problem
- * @throws LopsException if LopsException occurs
*/
private int getMapperInstructions(Lop node, ArrayList<Lop> execNodes,
ArrayList<String> inputStrings,
ArrayList<String> instructionsInMapper,
HashMap<Lop, Integer> nodeIndexMapping, int[] start_index,
ArrayList<String> inputLabels, ArrayList<Lop> inputLops,
- ArrayList<Integer> MRJobLineNumbers) throws LopsException
+ ArrayList<Integer> MRJobLineNumbers)
{
// if input source, return index
if (nodeIndexMapping.containsKey(node))
@@ -3436,8 +3397,7 @@ public class Dag<N extends Lop>
ArrayList<Long> numRows, ArrayList<Long> numCols,
ArrayList<Long> numRowsPerBlock, ArrayList<Long> numColsPerBlock,
HashMap<Lop, Integer> nodeIndexMapping, ArrayList<String> inputLabels,
- ArrayList<Lop> inputLops, ArrayList<Integer> MRJobLineNumbers)
- throws LopsException {
+ ArrayList<Lop> inputLops, ArrayList<Integer> MRJobLineNumbers) {
// treat rand as an input.
if (node.getType() == Type.DataGen && execNodes.contains(node)
&& !nodeIndexMapping.containsKey(node)) {
@@ -3836,11 +3796,8 @@ public class Dag<N extends Lop>
*
* @param insts list of instructions
* @return new list of potentially modified instructions
- * @throws DMLRuntimeException in case of instruction parsing errors
*/
- private static ArrayList<Instruction> cleanupInstructions(ArrayList<Instruction> insts)
- throws DMLRuntimeException
- {
+ private static ArrayList<Instruction> cleanupInstructions(ArrayList<Instruction> insts) {
//step 1: create mvvar instructions: assignvar s1 s2, rmvar s1 -> mvvar s1 s2
ArrayList<Instruction> tmp1 = collapseAssignvarAndRmvarInstructions(insts);
@@ -3850,9 +3807,7 @@ public class Dag<N extends Lop>
return tmp2;
}
- private static ArrayList<Instruction> collapseAssignvarAndRmvarInstructions(ArrayList<Instruction> insts)
- throws DMLRuntimeException
- {
+ private static ArrayList<Instruction> collapseAssignvarAndRmvarInstructions(ArrayList<Instruction> insts) {
ArrayList<Instruction> ret = new ArrayList<>();
Iterator<Instruction> iter = insts.iterator();
while( iter.hasNext() ) {
@@ -3880,9 +3835,7 @@ public class Dag<N extends Lop>
return ret;
}
- private static ArrayList<Instruction> createPackedRmvarInstructions(ArrayList<Instruction> insts)
- throws DMLRuntimeException
- {
+ private static ArrayList<Instruction> createPackedRmvarInstructions(ArrayList<Instruction> insts) {
ArrayList<Instruction> ret = new ArrayList<>();
ArrayList<String> currRmVar = new ArrayList<>();
for( Instruction inst : insts ) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/compile/JobType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/compile/JobType.java b/src/main/java/org/apache/sysml/lops/compile/JobType.java
index 2f55088..44502ab 100644
--- a/src/main/java/org/apache/sysml/lops/compile/JobType.java
+++ b/src/main/java/org/apache/sysml/lops/compile/JobType.java
@@ -128,7 +128,7 @@ public enum JobType
return allowsNoOtherInstructions;
}
- public Lop.Type getShuffleLopType() throws DMLRuntimeException {
+ public Lop.Type getShuffleLopType() {
if ( !allowsSingleShuffleInstruction )
throw new DMLRuntimeException("Shuffle Lop Type is not defined for a job (" + getName() + ") with allowsSingleShuffleInstruction=false.");
else {
@@ -187,8 +187,7 @@ public enum JobType
}
}
- public boolean isCompatibleWithParentNodes()
- throws DMLRuntimeException
+ public boolean isCompatibleWithParentNodes()
{
if ( !allowsSingleShuffleInstruction )
throw new DMLRuntimeException("isCompatibleWithParentNodes() can not be invoked for a job (" + getName() + ") with allowsSingleShuffleInstruction=false.");
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java b/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java
index 2c04425..3c395de 100644
--- a/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java
+++ b/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java
@@ -86,10 +86,8 @@ public class RunMRJobs
* @param inst instruction
* @param ec execution context
* @return job status
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
public static JobReturn prepareAndSubmitJob( MRJobInstruction inst, ExecutionContext ec )
- throws DMLRuntimeException
{
// Obtain references to all input matrices
MatrixObject[] inputMatrices = inst.extractInputMatrices(ec);
@@ -105,7 +103,7 @@ public class RunMRJobs
}
//check input files
- checkEmptyInputs( inst, inputMatrices );
+ checkEmptyInputs( inst, inputMatrices );
}
// Obtain references to all output matrices
@@ -154,12 +152,10 @@ public class RunMRJobs
*
* @param inst instruction
* @return job status
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
public static JobReturn submitJob(MRJobInstruction inst )
- throws DMLRuntimeException
{
- JobReturn ret = new JobReturn();
+ JobReturn ret = new JobReturn();
MatrixObject[] inputMatrices = inst.getInputMatrices();
MatrixObject[] outputMatrices = inst.getOutputMatrices();
boolean execCP = false;
@@ -385,9 +381,8 @@ public class RunMRJobs
* @param varName variable name
* @param map local variable map
* @return string variable name
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- private static String getVarNameReplacement(String inst, String varName, LocalVariableMap map) throws DMLRuntimeException {
+ private static String getVarNameReplacement(String inst, String varName, LocalVariableMap map) {
Data val = map.get(varName);
if ( val != null ) {
String replacement = null;
@@ -410,9 +405,8 @@ public class RunMRJobs
* @param inst string instruction
* @param map local variable map
* @return string instruction after replacement
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- private static String updateInstLabels(String inst, LocalVariableMap map) throws DMLRuntimeException {
+ private static String updateInstLabels(String inst, LocalVariableMap map) {
if ( inst.contains(Lop.VARIABLE_NAME_PLACEHOLDER) ) {
int skip = Lop.VARIABLE_NAME_PLACEHOLDER.toString().length();
while ( inst.contains(Lop.VARIABLE_NAME_PLACEHOLDER) ) {
@@ -432,9 +426,8 @@ public class RunMRJobs
* @param instList instruction list as string
* @param labelValueMapping local variable map
* @return instruction list after replacement
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- public static String updateLabels (String instList, LocalVariableMap labelValueMapping) throws DMLRuntimeException {
+ public static String updateLabels (String instList, LocalVariableMap labelValueMapping) {
if ( !instList.contains(Lop.VARIABLE_NAME_PLACEHOLDER) )
return instList;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/AssignmentStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/AssignmentStatement.java b/src/main/java/org/apache/sysml/parser/AssignmentStatement.java
index 7746fb3..72b2ce8 100644
--- a/src/main/java/org/apache/sysml/parser/AssignmentStatement.java
+++ b/src/main/java/org/apache/sysml/parser/AssignmentStatement.java
@@ -34,7 +34,7 @@ public class AssignmentStatement extends Statement
// rewrites statement to support function inlining (creates deep copy)
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException {
+ public Statement rewriteStatement(String prefix) {
// rewrite target (deep copy)
DataIdentifier newTarget = (DataIdentifier) _targetList.get(0).rewriteExpression(prefix);
// rewrite source (deep copy)
@@ -55,12 +55,12 @@ public class AssignmentStatement extends Statement
setParseInfo(parseInfo);
}
- public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp) throws LanguageException {
+ public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp) {
this(di, exp);
setCtxValues(ctx);
}
- public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp, String filename) throws LanguageException {
+ public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp, String filename) {
this(ctx, di, exp);
setFilename(filename);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BinaryExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/BinaryExpression.java b/src/main/java/org/apache/sysml/parser/BinaryExpression.java
index c4f23ea..83dc3d0 100644
--- a/src/main/java/org/apache/sysml/parser/BinaryExpression.java
+++ b/src/main/java/org/apache/sysml/parser/BinaryExpression.java
@@ -29,7 +29,7 @@ public class BinaryExpression extends Expression
private BinaryOp _opcode;
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException{
+ public Expression rewriteExpression(String prefix) {
BinaryExpression newExpr = new BinaryExpression(this._opcode, this);
newExpr.setLeft(_left.rewriteExpression(prefix));
newExpr.setRight(_right.rewriteExpression(prefix));
@@ -87,12 +87,10 @@ public class BinaryExpression extends Expression
* Validate parse tree : Process Binary Expression in an assignment
* statement
*
- * @throws LanguageException if LanguageException occurs
*/
@Override
public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException
- {
+ {
//recursive validate
if (_left instanceof FunctionCallIdentifier || _right instanceof FunctionCallIdentifier) {
raiseValidateError("User-defined function calls not supported in binary expressions.", false,
@@ -146,8 +144,7 @@ public class BinaryExpression extends Expression
this.setOutput(output);
}
- private void checkAndSetDimensions(DataIdentifier output, boolean conditional)
- throws LanguageException {
+ private void checkAndSetDimensions(DataIdentifier output, boolean conditional) {
Identifier left = this.getLeft().getOutput();
Identifier right = this.getRight().getOutput();
Identifier pivot = null;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BooleanExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/BooleanExpression.java b/src/main/java/org/apache/sysml/parser/BooleanExpression.java
index 31d7b1f..688cc64 100644
--- a/src/main/java/org/apache/sysml/parser/BooleanExpression.java
+++ b/src/main/java/org/apache/sysml/parser/BooleanExpression.java
@@ -76,7 +76,7 @@ public class BooleanExpression extends Expression
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException{
+ public Expression rewriteExpression(String prefix) {
BooleanExpression newExpr = new BooleanExpression(this._opcode, this);
newExpr.setLeft(_left.rewriteExpression(prefix));
if (_right != null)
@@ -88,7 +88,7 @@ public class BooleanExpression extends Expression
* Validate parse tree : Process Boolean Expression
*/
@Override
- public void validateExpression(HashMap<String,DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) throws LanguageException{
+ public void validateExpression(HashMap<String,DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) {
//recursive validate
getLeft().validateExpression(ids, constVars, conditional);
if (_left instanceof FunctionCallIdentifier){
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java b/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java
index 60836cd..d6d63b5 100644
--- a/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java
@@ -53,7 +53,7 @@ public class BooleanIdentifier extends ConstIdentifier
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException{
+ public Expression rewriteExpression(String prefix) {
return this;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
index 2da1f23..b597dd0 100644
--- a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
+++ b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java
@@ -64,7 +64,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
Expression[] newArgs = new Expression[_args.length];
for (int i = 0; i < _args.length; i++) {
newArgs[i] = _args[i].rewriteExpression(prefix);
@@ -99,7 +99,6 @@ public class BuiltinFunctionExpression extends DataIdentifier
@Override
public void validateExpression(MultiAssignmentStatement stmt, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException
{
if (this.getFirstExpr() instanceof FunctionCallIdentifier){
raiseValidateError("UDF function call not supported as parameter to built-in function call", false);
@@ -251,8 +250,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
}
- private static ArrayList<ParameterExpression> orderConvolutionParams(ArrayList<ParameterExpression> paramExpression,
- int skip) throws LanguageException {
+ private static ArrayList<ParameterExpression> orderConvolutionParams(ArrayList<ParameterExpression> paramExpression, int skip) {
ArrayList<ParameterExpression> newParams = new ArrayList<>();
for(int i = 0; i < skip; i++)
@@ -280,7 +278,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
private static ArrayList<ParameterExpression> replaceListParams(ArrayList<ParameterExpression> paramExpression,
- String inputVarName, String outputVarName, int startIndex) throws LanguageException {
+ String inputVarName, String outputVarName, int startIndex) {
ArrayList<ParameterExpression> newParamExpression = new ArrayList<>();
int i = startIndex;
int j = 1; // Assumption: sequential ordering pool_size1, pool_size2
@@ -297,7 +295,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
private static ArrayList<ParameterExpression> expandListParams(ArrayList<ParameterExpression> paramExpression,
- HashSet<String> paramsToExpand) throws LanguageException {
+ HashSet<String> paramsToExpand) {
ArrayList<ParameterExpression> newParamExpressions = new ArrayList<>();
for(ParameterExpression expr : paramExpression) {
if(paramsToExpand.contains(expr.getName())) {
@@ -351,13 +349,10 @@ public class BuiltinFunctionExpression extends DataIdentifier
/**
* Validate parse tree : Process BuiltinFunction Expression in an assignment
* statement
- *
- * @throws LanguageException if LanguageException occurs
*/
@Override
- public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException {
-
+ public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
+ {
for(int i=0; i < _args.length; i++ ) {
if (_args[i] instanceof FunctionCallIdentifier){
@@ -1289,7 +1284,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
}
- private void setBinaryOutputProperties(DataIdentifier output) throws LanguageException {
+ private void setBinaryOutputProperties(DataIdentifier output) {
DataType dt1 = getFirstExpr().getOutput().getDataType();
DataType dt2 = getSecondExpr().getOutput().getDataType();
DataType dtOut = (dt1==DataType.MATRIX || dt2==DataType.MATRIX) ?
@@ -1304,7 +1299,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
output.setBlockDimensions (dims.getRowsPerBlock(), dims.getColsPerBlock());
}
- private void setTernaryOutputProperties(DataIdentifier output, boolean conditional) throws LanguageException {
+ private void setTernaryOutputProperties(DataIdentifier output, boolean conditional) {
DataType dt1 = getFirstExpr().getOutput().getDataType();
DataType dt2 = getSecondExpr().getOutput().getDataType();
DataType dt3 = getThirdExpr().getOutput().getDataType();
@@ -1354,9 +1349,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
return ( expr != null && expr instanceof ConstIdentifier );
}
- private static double getDoubleValue(Expression expr)
- throws LanguageException
- {
+ private static double getDoubleValue(Expression expr) {
if ( expr instanceof DoubleIdentifier )
return ((DoubleIdentifier)expr).getValue();
else if ( expr instanceof IntIdentifier)
@@ -1397,7 +1390,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
}
- private void checkMathFunctionParam() throws LanguageException {
+ private void checkMathFunctionParam() {
switch (this.getOpCode()) {
case COS:
case SIN:
@@ -1466,9 +1459,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
return result;
}
- protected void checkNumParameters(int count) //always unconditional
- throws LanguageException
- {
+ protected void checkNumParameters(int count) { //always unconditional
if (getFirstExpr() == null) {
raiseValidateError("Missing argument for function " + this.getOpCode(), false,
LanguageErrorCodes.INVALID_PARAMETERS);
@@ -1485,7 +1476,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
}
- protected void checkMatrixParam(Expression e) throws LanguageException {
+ protected void checkMatrixParam(Expression e) {
if (e.getOutput().getDataType() != DataType.MATRIX) {
raiseValidateError(
"Expecting matrix argument for function " + this.getOpCode().toString().toLowerCase() + "().",
@@ -1493,41 +1484,31 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
}
- protected void checkMatrixFrameParam(Expression e) //always unconditional
- throws LanguageException
- {
+ protected void checkMatrixFrameParam(Expression e) { //always unconditional
if (e.getOutput().getDataType() != DataType.MATRIX && e.getOutput().getDataType() != DataType.FRAME) {
raiseValidateError("Expecting matrix or frame parameter for function "+ getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS);
}
}
- protected void checkMatrixScalarParam(Expression e) //always unconditional
- throws LanguageException
- {
+ protected void checkMatrixScalarParam(Expression e) { //always unconditional
if (e.getOutput().getDataType() != DataType.MATRIX && e.getOutput().getDataType() != DataType.SCALAR) {
raiseValidateError("Expecting matrix or scalar parameter for function "+ getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS);
}
}
- private void checkScalarParam(Expression e) //always unconditional
- throws LanguageException
- {
+ private void checkScalarParam(Expression e) { //always unconditional
if (e.getOutput().getDataType() != DataType.SCALAR) {
raiseValidateError("Expecting scalar parameter for function " + this.getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS);
}
}
- private void checkScalarFrameParam(Expression e) //always unconditional
- throws LanguageException
- {
+ private void checkScalarFrameParam(Expression e) { //always unconditional
if (e.getOutput().getDataType() != DataType.SCALAR && e.getOutput().getDataType() != DataType.FRAME) {
raiseValidateError("Expecting scalar parameter for function " + this.getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS);
}
}
- private void checkValueTypeParam(Expression e, ValueType vt) //always unconditional
- throws LanguageException
- {
+ private void checkValueTypeParam(Expression e, ValueType vt) { //always unconditional
if (e.getOutput().getValueType() != vt) {
raiseValidateError("Expecting parameter of different value type " + this.getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS);
}
@@ -1541,9 +1522,7 @@ public class BuiltinFunctionExpression extends DataIdentifier
return (e.getOutput().getDim1() != -1 && e.getOutput().getDim2() != -1);
}
- private void check1DMatrixParam(Expression e) //always unconditional
- throws LanguageException
- {
+ private void check1DMatrixParam(Expression e) { //always unconditional
checkMatrixParam(e);
// throw an exception, when e's output is NOT a one-dimensional matrix
@@ -1554,16 +1533,15 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
}
- private void checkMatchingDimensions(Expression expr1, Expression expr2) throws LanguageException {
+ private void checkMatchingDimensions(Expression expr1, Expression expr2) {
checkMatchingDimensions(expr1, expr2, false);
}
- private void checkMatchingDimensions(Expression expr1, Expression expr2, boolean allowsMV) throws LanguageException {
+ private void checkMatchingDimensions(Expression expr1, Expression expr2, boolean allowsMV) {
checkMatchingDimensions(expr1, expr2, allowsMV, false);
}
private void checkMatchingDimensions(Expression expr1, Expression expr2, boolean allowsMV, boolean conditional)
- throws LanguageException
{
if (expr1 != null && expr2 != null) {
@@ -1585,7 +1563,6 @@ public class BuiltinFunctionExpression extends DataIdentifier
}
private void checkMatchingDimensionsQuantile()
- throws LanguageException
{
if (getFirstExpr().getOutput().getDim1() != getSecondExpr().getOutput().getDim1()) {
raiseValidateError("Mismatch in matrix dimensions for "
@@ -1817,11 +1794,8 @@ public class BuiltinFunctionExpression extends DataIdentifier
* @param vt Value type ({@code ValueType.DOUBLE}, {@code ValueType.INT}, or {@code ValueType.BOOLEAN}).
* @return Built-in function operator ({@code BuiltinFunctionOp.AS_DOUBLE},
* {@code BuiltinFunctionOp.AS_INT}, or {@code BuiltinFunctionOp.AS_BOOLEAN}).
- * @throws LanguageException thrown if ValueType not accepted
*/
- public static BuiltinFunctionOp getValueTypeCastOperator( ValueType vt )
- throws LanguageException
- {
+ public static BuiltinFunctionOp getValueTypeCastOperator( ValueType vt ) {
switch( vt )
{
case DOUBLE:
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ConstIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ConstIdentifier.java b/src/main/java/org/apache/sysml/parser/ConstIdentifier.java
index 4d7ffb1..3809969 100644
--- a/src/main/java/org/apache/sysml/parser/ConstIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/ConstIdentifier.java
@@ -21,11 +21,9 @@ package org.apache.sysml.parser;
public abstract class ConstIdentifier extends Identifier
{
-
public ConstIdentifier(){
super();
}
- public abstract long getLongValue()
- throws LanguageException;
+ public abstract long getLongValue();
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DMLProgram.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DMLProgram.java b/src/main/java/org/apache/sysml/parser/DMLProgram.java
index 6bc5847..c5f94ed 100644
--- a/src/main/java/org/apache/sysml/parser/DMLProgram.java
+++ b/src/main/java/org/apache/sysml/parser/DMLProgram.java
@@ -76,7 +76,7 @@ public class DMLProgram
return retVal;
}
- public HashMap<String, FunctionStatementBlock> getFunctionStatementBlocks(String namespaceKey) throws LanguageException{
+ public HashMap<String, FunctionStatementBlock> getFunctionStatementBlocks(String namespaceKey) {
DMLProgram namespaceProgram = this.getNamespaces().get(namespaceKey);
if (namespaceProgram == null){
LOG.error("ERROR: namespace " + namespaceKey + " is undefined");
@@ -94,9 +94,7 @@ public class DMLProgram
return ret;
}
- public ArrayList<FunctionStatementBlock> getFunctionStatementBlocks()
- throws LanguageException
- {
+ public ArrayList<FunctionStatementBlock> getFunctionStatementBlocks() {
ArrayList<FunctionStatementBlock> ret = new ArrayList<>();
for( DMLProgram nsProg : _namespaces.values() )
@@ -105,9 +103,7 @@ public class DMLProgram
return ret;
}
- public void addFunctionStatementBlock( String namespace, String fname, FunctionStatementBlock fsb )
- throws LanguageException
- {
+ public void addFunctionStatementBlock( String namespace, String fname, FunctionStatementBlock fsb ) {
DMLProgram namespaceProgram = this.getNamespaces().get(namespace);
if (namespaceProgram == null)
throw new LanguageException( "Namespace does not exist." );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DMLTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DMLTranslator.java b/src/main/java/org/apache/sysml/parser/DMLTranslator.java
index 8a0c5df..b0b1938 100644
--- a/src/main/java/org/apache/sysml/parser/DMLTranslator.java
+++ b/src/main/java/org/apache/sysml/parser/DMLTranslator.java
@@ -109,12 +109,8 @@ public class DMLTranslator
* Validate parse tree
*
* @param dmlp dml program
- * @throws LanguageException if LanguageException occurs
- * @throws ParseException if ParseException occurs
- * @throws IOException if IOException occurs
*/
public void validateParseTree(DMLProgram dmlp)
- throws LanguageException, ParseException, IOException
{
//STEP1: Pre-processing steps for validate - e.g., prepare read-after-write meta data
boolean fWriteRead = prepareReadAfterWrite(dmlp, new HashMap<String, DataIdentifier>());
@@ -168,7 +164,7 @@ public class DMLTranslator
}
}
- public void liveVariableAnalysis(DMLProgram dmlp) throws LanguageException {
+ public void liveVariableAnalysis(DMLProgram dmlp) {
// for each namespace, handle function program blocks -- forward direction
for (String namespaceKey : dmlp.getNamespaces().keySet()) {
@@ -235,12 +231,8 @@ public class DMLTranslator
* Construct Hops from parse tree
*
* @param dmlp dml program
- * @throws ParseException if ParseException occurs
- * @throws LanguageException if LanguageException occurs
*/
- public void constructHops(DMLProgram dmlp)
- throws ParseException, LanguageException
- {
+ public void constructHops(DMLProgram dmlp) {
// Step 1: construct hops for all functions
// for each namespace, handle function program blocks
for (String namespaceKey : dmlp.getNamespaces().keySet()){
@@ -259,7 +251,6 @@ public class DMLTranslator
}
public void rewriteHopsDAG(DMLProgram dmlp)
- throws ParseException, LanguageException, HopsException, DMLRuntimeException
{
//apply hop rewrites (static rewrites)
ProgramRewriter rewriter = new ProgramRewriter(true, false);
@@ -298,25 +289,19 @@ public class DMLTranslator
}
}
- public void codgenHopsDAG(DMLProgram dmlp)
- throws LanguageException, HopsException, DMLRuntimeException
- {
+ public void codgenHopsDAG(DMLProgram dmlp) {
SpoofCompiler.generateCode(dmlp);
}
- public void codgenHopsDAG(Program rtprog)
- throws LanguageException, HopsException, DMLRuntimeException, LopsException, IOException
- {
+ public void codgenHopsDAG(Program rtprog) {
SpoofCompiler.generateCode(rtprog);
}
- public void codgenHopsDAG(ProgramBlock pb)
- throws HopsException, DMLRuntimeException, LopsException, IOException
- {
+ public void codgenHopsDAG(ProgramBlock pb) {
SpoofCompiler.generateCodeFromProgramBlock(pb);
}
- public void constructLops(DMLProgram dmlp) throws ParseException, LanguageException, HopsException, LopsException {
+ public void constructLops(DMLProgram dmlp) {
// for each namespace, handle function program blocks handle function
for( String namespaceKey : dmlp.getNamespaces().keySet() )
for( FunctionStatementBlock fsb : dmlp.getFunctionStatementBlocks(namespaceKey).values() )
@@ -328,7 +313,6 @@ public class DMLTranslator
}
public boolean constructLops(StatementBlock sb)
- throws HopsException, LopsException
{
boolean ret = false;
@@ -456,9 +440,7 @@ public class DMLTranslator
return rtprog ;
}
- public ProgramBlock createRuntimeProgramBlock(Program prog, StatementBlock sb, DMLConfig config)
- throws IOException, LopsException, DMLRuntimeException
- {
+ public ProgramBlock createRuntimeProgramBlock(Program prog, StatementBlock sb, DMLConfig config) {
Dag<Lop> dag = null;
Dag<Lop> pred_dag = null;
@@ -711,7 +693,7 @@ public class DMLTranslator
return retPB;
}
- public void printLops(DMLProgram dmlp) throws ParseException, LanguageException, HopsException, LopsException {
+ public void printLops(DMLProgram dmlp) {
if (LOG.isDebugEnabled()){
// for each namespace, handle function program blocks
for (String namespaceKey : dmlp.getNamespaces().keySet()){
@@ -728,7 +710,7 @@ public class DMLTranslator
}
}
- public void printLops(StatementBlock current) throws ParseException, HopsException, LopsException {
+ public void printLops(StatementBlock current) {
if (LOG.isDebugEnabled()){
ArrayList<Lop> lopsDAG = current.getLops();
@@ -842,7 +824,7 @@ public class DMLTranslator
}
}
- public void refreshMemEstimates(DMLProgram dmlp) throws ParseException, LanguageException, HopsException {
+ public void refreshMemEstimates(DMLProgram dmlp) {
// for each namespace, handle function program blocks -- forward direction
for (String namespaceKey : dmlp.getNamespaces().keySet()){
@@ -859,7 +841,7 @@ public class DMLTranslator
}
}
- public void refreshMemEstimates(StatementBlock current) throws ParseException, HopsException {
+ public void refreshMemEstimates(StatementBlock current) {
MemoTable memo = new MemoTable();
@@ -926,7 +908,7 @@ public class DMLTranslator
}
}
- public static void resetHopsDAGVisitStatus(DMLProgram dmlp) throws ParseException, LanguageException, HopsException {
+ public static void resetHopsDAGVisitStatus(DMLProgram dmlp) {
// for each namespace, handle function program blocks -- forward direction
for (String namespaceKey : dmlp.getNamespaces().keySet()){
@@ -943,7 +925,7 @@ public class DMLTranslator
}
}
- public static void resetHopsDAGVisitStatus(StatementBlock current) throws ParseException, HopsException {
+ public static void resetHopsDAGVisitStatus(StatementBlock current) {
if( HopRewriteUtils.isLastLevelStatementBlock(current) ) {
ArrayList<Hop> hopsDAG = current.getHops();
@@ -998,7 +980,7 @@ public class DMLTranslator
}
}
- public void resetLopsDAGVisitStatus(DMLProgram dmlp) throws HopsException, LanguageException {
+ public void resetLopsDAGVisitStatus(DMLProgram dmlp) {
// for each namespace, handle function program blocks
for (String namespaceKey : dmlp.getNamespaces().keySet()){
@@ -1014,7 +996,7 @@ public class DMLTranslator
}
}
- public void resetLopsDAGVisitStatus(StatementBlock current) throws HopsException {
+ public void resetLopsDAGVisitStatus(StatementBlock current) {
ArrayList<Hop> hopsDAG = current.getHops();
@@ -1085,9 +1067,7 @@ public class DMLTranslator
}
- public void constructHops(StatementBlock sb)
- throws ParseException, LanguageException {
-
+ public void constructHops(StatementBlock sb) {
if (sb instanceof WhileStatementBlock) {
constructHopsForWhileControlBlock((WhileStatementBlock) sb);
return;
@@ -1419,8 +1399,7 @@ public class DMLTranslator
}
- public void constructHopsForIfControlBlock(IfStatementBlock sb) throws ParseException, LanguageException {
-
+ public void constructHopsForIfControlBlock(IfStatementBlock sb) {
IfStatement ifsb = (IfStatement) sb.getStatement(0);
ArrayList<StatementBlock> ifBody = ifsb.getIfBody();
ArrayList<StatementBlock> elseBody = ifsb.getElseBody();
@@ -1443,48 +1422,30 @@ public class DMLTranslator
* Constructs Hops for a given ForStatementBlock or ParForStatementBlock, respectively.
*
* @param sb for statement block
- * @throws ParseException if ParseException occurs
- * @throws LanguageException if LanguageException occurs
*/
- public void constructHopsForForControlBlock(ForStatementBlock sb)
- throws ParseException, LanguageException
- {
-
+ public void constructHopsForForControlBlock(ForStatementBlock sb) {
ForStatement fs = (ForStatement) sb.getStatement(0);
ArrayList<StatementBlock> body = fs.getBody();
-
- // construct hops for iterable predicate
constructHopsForIterablePredicate(sb);
-
- for( StatementBlock current : body ) {
+ for( StatementBlock current : body )
constructHops(current);
- }
}
- public void constructHopsForFunctionControlBlock(FunctionStatementBlock fsb) throws ParseException, LanguageException {
-
+ public void constructHopsForFunctionControlBlock(FunctionStatementBlock fsb) {
ArrayList<StatementBlock> body = ((FunctionStatement)fsb.getStatement(0)).getBody();
-
- for( StatementBlock current : body ) {
+ for( StatementBlock current : body )
constructHops(current);
- }
}
- public void constructHopsForWhileControlBlock(WhileStatementBlock sb)
- throws ParseException, LanguageException {
-
+ public void constructHopsForWhileControlBlock(WhileStatementBlock sb) {
ArrayList<StatementBlock> body = ((WhileStatement)sb.getStatement(0)).getBody();
-
- // construct hops for while predicate
constructHopsForConditionalPredicate(sb);
-
- for( StatementBlock current : body ) {
+ for( StatementBlock current : body )
constructHops(current);
- }
}
- public void constructHopsForConditionalPredicate(StatementBlock passedSB) throws ParseException {
+ public void constructHopsForConditionalPredicate(StatementBlock passedSB) {
HashMap<String, Hop> _ids = new HashMap<>();
@@ -1582,10 +1543,8 @@ public class DMLTranslator
* Method used for both ForStatementBlock and ParForStatementBlock.
*
* @param fsb for statement block
- * @throws ParseException if ParseException occurs
*/
public void constructHopsForIterablePredicate(ForStatementBlock fsb)
- throws ParseException
{
HashMap<String, Hop> _ids = new HashMap<>();
@@ -1643,10 +1602,9 @@ public class DMLTranslator
* @param target data identifier
* @param hops map of high-level operators
* @return high-level operator
- * @throws ParseException if ParseException occurs
*/
- private Hop processExpression(Expression source, DataIdentifier target, HashMap<String, Hop> hops) throws ParseException {
- try {
+ private Hop processExpression(Expression source, DataIdentifier target, HashMap<String, Hop> hops) {
+ try {
if( source instanceof BinaryExpression )
return processBinaryExpression((BinaryExpression) source, target, hops);
else if( source instanceof RelationalExpression )
@@ -1724,25 +1682,20 @@ public class DMLTranslator
*
* @param source source expression
* @param hops map of high-level operators
- * @return high-level operator
- * @throws ParseException if ParseException occurs
+ * @return high-level operatos
*/
- private Hop processTempIntExpression( Expression source, HashMap<String, Hop> hops )
- throws ParseException
- {
+ private Hop processTempIntExpression( Expression source, HashMap<String, Hop> hops ) {
if( source == null )
return null;
-
- DataIdentifier tmpOut = createTarget();
+ DataIdentifier tmpOut = createTarget();
tmpOut.setDataType(DataType.SCALAR);
- tmpOut.setValueType(ValueType.INT);
+ tmpOut.setValueType(ValueType.INT);
source.setOutput(tmpOut);
- return processExpression(source, tmpOut, hops );
+ return processExpression(source, tmpOut, hops );
}
private Hop processLeftIndexedExpression(Expression source, IndexedIdentifier target, HashMap<String, Hop> hops)
- throws ParseException {
-
+ {
// process target indexed expressions
Hop rowLowerHops = null, rowUpperHops = null, colLowerHops = null, colUpperHops = null;
@@ -1804,9 +1757,7 @@ public class DMLTranslator
}
- private Hop processIndexingExpression(IndexedIdentifier source, DataIdentifier target, HashMap<String, Hop> hops)
- throws ParseException {
-
+ private Hop processIndexingExpression(IndexedIdentifier source, DataIdentifier target, HashMap<String, Hop> hops) {
// process Hops for indexes (for source)
Hop rowLowerHops = null, rowUpperHops = null, colLowerHops = null, colUpperHops = null;
@@ -1867,10 +1818,8 @@ public class DMLTranslator
* @param target data identifier
* @param hops map of high-level operators
* @return high-level operator
- * @throws ParseException if ParseException occurs
*/
private Hop processBinaryExpression(BinaryExpression source, DataIdentifier target, HashMap<String, Hop> hops)
- throws ParseException
{
Hop left = processExpression(source.getLeft(), null, hops);
Hop right = processExpression(source.getRight(), null, hops);
@@ -1915,8 +1864,7 @@ public class DMLTranslator
}
- private Hop processRelationalExpression(RelationalExpression source, DataIdentifier target,
- HashMap<String, Hop> hops) throws ParseException {
+ private Hop processRelationalExpression(RelationalExpression source, DataIdentifier target, HashMap<String, Hop> hops) {
Hop left = processExpression(source.getLeft(), null, hops);
Hop right = processExpression(source.getRight(), null, hops);
@@ -1959,7 +1907,6 @@ public class DMLTranslator
}
private Hop processBooleanExpression(BooleanExpression source, DataIdentifier target, HashMap<String, Hop> hops)
- throws ParseException
{
// Boolean Not has a single parameter
boolean constLeft = (source.getLeft().getOutput() instanceof ConstIdentifier);
@@ -2010,7 +1957,7 @@ public class DMLTranslator
}
}
- private static Hop constructDfHop(String name, DataType dt, ValueType vt, ParameterizedBuiltinFunctionOp op, HashMap<String,Hop> paramHops) throws HopsException {
+ private static Hop constructDfHop(String name, DataType dt, ValueType vt, ParameterizedBuiltinFunctionOp op, HashMap<String,Hop> paramHops) {
// Add a hop to paramHops to store distribution information.
// Distribution parameter hops would have been already present in paramHops.
@@ -2051,7 +1998,7 @@ public class DMLTranslator
}
private Hop processMultipleReturnParameterizedBuiltinFunctionExpression(ParameterizedBuiltinFunctionExpression source, ArrayList<DataIdentifier> targetList,
- HashMap<String, Hop> hops) throws ParseException
+ HashMap<String, Hop> hops)
{
FunctionType ftype = FunctionType.MULTIRETURN_BUILTIN;
String nameSpace = DMLProgram.INTERNAL_NAMESPACE;
@@ -2098,11 +2045,9 @@ public class DMLTranslator
* @param target data identifier
* @param hops map of high-level operators
* @return high-level operator
- * @throws ParseException if ParseException occurs
- * @throws HopsException if HopsException occurs
*/
private Hop processParameterizedBuiltinFunctionExpression(ParameterizedBuiltinFunctionExpression source, DataIdentifier target,
- HashMap<String, Hop> hops) throws ParseException, HopsException {
+ HashMap<String, Hop> hops) {
// this expression has multiple "named" parameters
HashMap<String, Hop> paramHops = new HashMap<>();
@@ -2215,11 +2160,9 @@ public class DMLTranslator
* @param target data identifier
* @param hops map of high-level operators
* @return high-level operator
- * @throws ParseException if ParseException occurs
- * @throws HopsException if HopsException occurs
*/
private Hop processDataExpression(DataExpression source, DataIdentifier target,
- HashMap<String, Hop> hops) throws ParseException, HopsException {
+ HashMap<String, Hop> hops) {
// this expression has multiple "named" parameters
HashMap<String, Hop> paramHops = new HashMap<>();
@@ -2295,10 +2238,9 @@ public class DMLTranslator
* @param targetList list of data identifiers
* @param hops map of high-level operators
* @return high-level operator
- * @throws ParseException if ParseException occurs
*/
private Hop processMultipleReturnBuiltinFunctionExpression(BuiltinFunctionExpression source, ArrayList<DataIdentifier> targetList,
- HashMap<String, Hop> hops) throws ParseException {
+ HashMap<String, Hop> hops) {
// Construct Hops for all inputs
ArrayList<Hop> inputs = new ArrayList<>();
@@ -2359,11 +2301,9 @@ public class DMLTranslator
* @param target data identifier
* @param hops map of high-level operators
* @return high-level operator
- * @throws ParseException if ParseException occurs
- * @throws HopsException if HopsException occurs
*/
private Hop processBuiltinFunctionExpression(BuiltinFunctionExpression source, DataIdentifier target,
- HashMap<String, Hop> hops) throws ParseException, HopsException {
+ HashMap<String, Hop> hops) {
Hop expr = processExpression(source.getFirstExpr(), null, hops);
Hop expr2 = null;
if (source.getSecondExpr() != null) {
@@ -3077,7 +3017,7 @@ public class DMLTranslator
return currBuiltinOp;
}
- private Hop[] processAllExpressions(Expression[] expr, HashMap<String, Hop> hops) throws ParseException {
+ private Hop[] processAllExpressions(Expression[] expr, HashMap<String, Hop> hops) {
Hop[] ret = new Hop[expr.length];
for(int i=0; i<expr.length; i++)
ret[i] = processExpression(expr[i], null, hops);
@@ -3090,7 +3030,7 @@ public class DMLTranslator
HopRewriteUtils.copyLineNumbers(in, out);
}
- private ArrayList<Hop> getALHopsForConvOpPoolingCOL2IM(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException {
+ private ArrayList<Hop> getALHopsForConvOpPoolingCOL2IM(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) {
ArrayList<Hop> ret = new ArrayList<>();
ret.add(first);
Expression[] allExpr = source.getAllExpr();
@@ -3105,7 +3045,7 @@ public class DMLTranslator
return ret;
}
- private ArrayList<Hop> getALHopsForPoolingForwardIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException {
+ private ArrayList<Hop> getALHopsForPoolingForwardIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) {
ArrayList<Hop> ret = new ArrayList<>();
ret.add(first);
Expression[] allExpr = source.getAllExpr();
@@ -3126,7 +3066,7 @@ public class DMLTranslator
}
@SuppressWarnings("unused") //TODO remove if not used
- private ArrayList<Hop> getALHopsForConvOpPoolingIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException {
+ private ArrayList<Hop> getALHopsForConvOpPoolingIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) {
ArrayList<Hop> ret = new ArrayList<Hop>();
ret.add(first);
Expression[] allExpr = source.getAllExpr();
@@ -3157,7 +3097,7 @@ public class DMLTranslator
return ret;
}
- private ArrayList<Hop> getALHopsForConvOp(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException {
+ private ArrayList<Hop> getALHopsForConvOp(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) {
ArrayList<Hop> ret = new ArrayList<>();
ret.add(first);
Expression[] allExpr = source.getAllExpr();
@@ -3178,9 +3118,7 @@ public class DMLTranslator
h.setColsInBlock(id.getColumnsInBlock());
}
- private boolean prepareReadAfterWrite( DMLProgram prog, HashMap<String, DataIdentifier> pWrites )
- throws LanguageException
- {
+ private boolean prepareReadAfterWrite( DMLProgram prog, HashMap<String, DataIdentifier> pWrites ) {
boolean ret = false;
//process functions
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DataExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DataExpression.java b/src/main/java/org/apache/sysml/parser/DataExpression.java
index fa762f5..46757f4 100644
--- a/src/main/java/org/apache/sysml/parser/DataExpression.java
+++ b/src/main/java/org/apache/sysml/parser/DataExpression.java
@@ -137,14 +137,13 @@ public class DataExpression extends DataIdentifier
}
public static DataExpression getDataExpression(ParserRuleContext ctx, String functionName,
- ArrayList<ParameterExpression> passedParamExprs, String filename, CustomErrorListener errorListener)
- throws LanguageException {
+ ArrayList<ParameterExpression> passedParamExprs, String filename, CustomErrorListener errorListener) {
ParseInfo pi = ParseInfo.ctxAndFilenameToParseInfo(ctx, filename);
return getDataExpression(functionName, passedParamExprs, pi, errorListener);
}
public static DataExpression getDataExpression(String functionName, ArrayList<ParameterExpression> passedParamExprs,
- ParseInfo parseInfo, CustomErrorListener errorListener) throws LanguageException {
+ ParseInfo parseInfo, CustomErrorListener errorListener) {
if (functionName == null || passedParamExprs == null)
return null;
@@ -296,7 +295,6 @@ public class DataExpression extends DataIdentifier
} // end method getBuiltinFunctionExpression
public void addRandExprParam(String paramName, Expression paramValue)
- throws LanguageException
{
if (DMLScript.VALIDATOR_IGNORE_ISSUES && (paramValue == null)) {
return;
@@ -334,7 +332,6 @@ public class DataExpression extends DataIdentifier
}
public void addMatrixExprParam(String paramName, Expression paramValue)
- throws LanguageException
{
// check name is valid
boolean found = false;
@@ -381,7 +378,7 @@ public class DataExpression extends DataIdentifier
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
HashMap<String,Expression> newVarParams = new HashMap<>();
for( Entry<String, Expression> e : _varParams.entrySet() ){
@@ -480,9 +477,7 @@ public class DataExpression extends DataIdentifier
_varParams.remove(name);
}
- private String getInputFileName(HashMap<String, ConstIdentifier> currConstVars, boolean conditional)
- throws LanguageException
- {
+ private String getInputFileName(HashMap<String, ConstIdentifier> currConstVars, boolean conditional) {
String filename = null;
Expression fileNameExpr = getVarParam(IO_FILENAME);
@@ -513,7 +508,7 @@ public class DataExpression extends DataIdentifier
return filename;
}
- public static String getMTDFileName(String inputFileName) throws LanguageException {
+ public static String getMTDFileName(String inputFileName) {
return inputFileName + ".mtd";
}
@@ -523,8 +518,7 @@ public class DataExpression extends DataIdentifier
*/
@Override
public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional)
- throws LanguageException
- {
+ {
// validate all input parameters
for ( Entry<String,Expression> e : getVarParams().entrySet() ) {
String s = e.getKey();
@@ -1603,7 +1597,6 @@ public class DataExpression extends DataIdentifier
private String fileNameCat(BinaryExpression expr, HashMap<String, ConstIdentifier> currConstVars, String filename, boolean conditional)
- throws LanguageException
{
// Processing the left node first
if (expr.getLeft() instanceof BinaryExpression
@@ -1693,7 +1686,6 @@ public class DataExpression extends DataIdentifier
@SuppressWarnings("unchecked")
private void parseMetaDataFileParameters(String mtdFileName, JSONObject configObject, boolean conditional)
- throws LanguageException
{
for( Object obj : configObject.entrySet() ){
Entry<Object,Object> e = (Entry<Object, Object>) obj;
@@ -1781,7 +1773,6 @@ public class DataExpression extends DataIdentifier
}
public JSONObject readMetadataFile(String filename, boolean conditional)
- throws LanguageException
{
JSONObject retVal = null;
boolean exists = MapReduceTool.existsFileOnHDFS(filename);
@@ -1838,7 +1829,6 @@ public class DataExpression extends DataIdentifier
}
public String[] readMatrixMarketFile(String filename, boolean conditional)
- throws LanguageException
{
String[] retVal = new String[2];
retVal[0] = new String("");
@@ -1887,7 +1877,6 @@ public class DataExpression extends DataIdentifier
}
public boolean checkHasMatrixMarketFormat(String inputFileName, String mtdFileName, boolean conditional)
- throws LanguageException
{
// Check the MTD file exists. if there is an MTD file, return false.
JSONObject mtdObject = readMetadataFile(mtdFileName, conditional);
@@ -1918,9 +1907,7 @@ public class DataExpression extends DataIdentifier
return false;
}
- public boolean checkHasDelimitedFormat(String filename, boolean conditional)
- throws LanguageException
- {
+ public boolean checkHasDelimitedFormat(String filename, boolean conditional) {
// if the MTD file exists, check the format is not binary
JSONObject mtdObject = readMetadataFile(filename + ".mtd", conditional);
if (mtdObject != null) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DataIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DataIdentifier.java b/src/main/java/org/apache/sysml/parser/DataIdentifier.java
index 34caf4e..8d8c749 100644
--- a/src/main/java/org/apache/sysml/parser/DataIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/DataIdentifier.java
@@ -35,7 +35,7 @@ public class DataIdentifier extends Identifier
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException{
+ public Expression rewriteExpression(String prefix) {
DataIdentifier newId = new DataIdentifier(this);
String newIdName = prefix + _name;
newId.setName(newIdName);
@@ -81,9 +81,8 @@ public class DataIdentifier extends Identifier
* This method must be overridden by all child classes.
*
* @return true if expression returns multiple outputs
- * @throws LanguageException if LanguageException occurs
*/
- public boolean multipleReturns() throws LanguageException {
+ public boolean multipleReturns() {
throw new LanguageException("multipleReturns() must be overridden in the subclass.");
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java b/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
index 9e620a8..71c88a0 100644
--- a/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
@@ -62,7 +62,7 @@ public class DoubleIdentifier extends ConstIdentifier
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException{
+ public Expression rewriteExpression(String prefix) {
return this;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/Expression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/Expression.java b/src/main/java/org/apache/sysml/parser/Expression.java
index 2a6503d..431e21d 100644
--- a/src/main/java/org/apache/sysml/parser/Expression.java
+++ b/src/main/java/org/apache/sysml/parser/Expression.java
@@ -213,7 +213,7 @@ public abstract class Expression implements ParseInfo
_outputs = null;
}
- public abstract Expression rewriteExpression(String prefix) throws LanguageException;
+ public abstract Expression rewriteExpression(String prefix);
public void setOutput(Identifier output) {
if ( _outputs == null) {
@@ -242,15 +242,11 @@ public abstract class Expression implements ParseInfo
return _outputs;
}
- public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional)
- throws LanguageException
- {
+ public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional) {
raiseValidateError("Should never be invoked in Baseclass 'Expression'", false);
}
- public void validateExpression(MultiAssignmentStatement mas, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional)
- throws LanguageException
- {
+ public void validateExpression(MultiAssignmentStatement mas, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional) {
raiseValidateError("Should never be invoked in Baseclass 'Expression'", false);
}
@@ -384,9 +380,8 @@ public abstract class Expression implements ParseInfo
* @param expression2 Second expression
* @param cast Whether a cast should potentially be performed
* @return The data type ({@link DataType})
- * @throws LanguageException if LanguageException occurs
*/
- public static DataType computeDataType(Expression expression1, Expression expression2, boolean cast) throws LanguageException {
+ public static DataType computeDataType(Expression expression1, Expression expression2, boolean cast) {
return computeDataType(expression1.getOutput(), expression2.getOutput(), cast);
}
@@ -399,9 +394,8 @@ public abstract class Expression implements ParseInfo
* @param identifier2 Second identifier
* @param cast Whether a cast should potentially be performed
* @return The data type ({@link DataType})
- * @throws LanguageException if LanguageException occurs
*/
- public static DataType computeDataType(Identifier identifier1, Identifier identifier2, boolean cast) throws LanguageException {
+ public static DataType computeDataType(Identifier identifier1, Identifier identifier2, boolean cast) {
DataType d1 = identifier1.getDataType();
DataType d2 = identifier2.getDataType();
@@ -432,9 +426,8 @@ public abstract class Expression implements ParseInfo
* @param expression2 Second expression
* @param cast Whether a cast should potentially be performed
* @return The value type ({@link ValueType})
- * @throws LanguageException if LanguageException occurs
*/
- public static ValueType computeValueType(Expression expression1, Expression expression2, boolean cast) throws LanguageException {
+ public static ValueType computeValueType(Expression expression1, Expression expression2, boolean cast) {
return computeValueType(expression1.getOutput(), expression2.getOutput(), cast);
}
@@ -448,9 +441,8 @@ public abstract class Expression implements ParseInfo
* @param identifier2 Second identifier
* @param cast Whether a cast should potentially be performed
* @return The value type ({@link ValueType})
- * @throws LanguageException if LanguageException occurs
*/
- public static ValueType computeValueType(Identifier identifier1, Identifier identifier2, boolean cast) throws LanguageException {
+ public static ValueType computeValueType(Identifier identifier1, Identifier identifier2, boolean cast) {
ValueType v1 = identifier1.getValueType();
ValueType v2 = identifier2.getValueType();
@@ -506,9 +498,8 @@ public abstract class Expression implements ParseInfo
* Throw a LanguageException with the message.
*
* @param message the error message
- * @throws LanguageException if LanguageException occurs
*/
- public void raiseValidateError( String message ) throws LanguageException {
+ public void raiseValidateError( String message ) {
raiseValidateError(message, false, null);
}
@@ -519,9 +510,8 @@ public abstract class Expression implements ParseInfo
* @param message the error (or warning) message
* @param conditional if {@code true}, display log warning message. Otherwise, the message
* will be thrown as a LanguageException
- * @throws LanguageException thrown if conditional is {@code false}.
*/
- public void raiseValidateError( String message, boolean conditional ) throws LanguageException {
+ public void raiseValidateError( String message, boolean conditional ) {
raiseValidateError(message, conditional, null);
}
@@ -533,9 +523,8 @@ public abstract class Expression implements ParseInfo
* @param conditional if {@code true}, display log warning message. Otherwise, the message (and optional
* error code) will be thrown as a LanguageException
* @param errorCode optional error code
- * @throws LanguageException thrown if conditional is {@code false}.
*/
- public void raiseValidateError(String msg, boolean conditional, String errorCode) throws LanguageException {
+ public void raiseValidateError(String msg, boolean conditional, String errorCode) {
if (conditional) {// warning if conditional
String fullMsg = this.printWarningLocation() + msg;
LOG.warn(fullMsg);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ExpressionList.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ExpressionList.java b/src/main/java/org/apache/sysml/parser/ExpressionList.java
index 653293c..0382c73 100644
--- a/src/main/java/org/apache/sysml/parser/ExpressionList.java
+++ b/src/main/java/org/apache/sysml/parser/ExpressionList.java
@@ -45,7 +45,7 @@ public class ExpressionList extends Expression {
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
throw new LanguageException("ExpressionList should not be exposed beyond parser layer.");
}
@Override
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java b/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java
index c3e9a68..1a87ebc 100644
--- a/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java
+++ b/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java
@@ -63,12 +63,9 @@ public class ExternalFunctionStatement extends FunctionStatement
* Validates all attributes and attribute values.
*
* @param sb statement block
- * @throws LanguageException if LanguageException occurs
*/
public void validateParameters(StatementBlock sb) //always unconditional
- throws LanguageException
{
-
//warnings for all not defined attributes
for( String varName : _otherParams.keySet() )
if( !(varName.equals(CLASS_NAME) || varName.equals(EXEC_TYPE)
@@ -144,13 +141,13 @@ public class ExternalFunctionStatement extends FunctionStatement
}
@Override
- public void initializeforwardLV(VariableSet activeIn) throws LanguageException{
+ public void initializeforwardLV(VariableSet activeIn) {
LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement");
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement");
}
@Override
- public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{
+ public VariableSet initializebackwardLV(VariableSet lo) {
LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement");
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement");
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ForStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ForStatement.java b/src/main/java/org/apache/sysml/parser/ForStatement.java
index 7309739..54f2428 100644
--- a/src/main/java/org/apache/sysml/parser/ForStatement.java
+++ b/src/main/java/org/apache/sysml/parser/ForStatement.java
@@ -29,7 +29,7 @@ public class ForStatement extends Statement
protected ArrayList<StatementBlock> _body;
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
+ public Statement rewriteStatement(String prefix) {
LOG.error(this.printErrorLocation() + "should not call rewriteStatement for ForStatement");
throw new LanguageException(this.printErrorLocation() + "should not call rewriteStatement for ForStatement");
}
@@ -84,13 +84,13 @@ public class ForStatement extends Statement
}
@Override
- public void initializeforwardLV(VariableSet activeIn) throws LanguageException{
+ public void initializeforwardLV(VariableSet activeIn) {
LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement");
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement");
}
@Override
- public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{
+ public VariableSet initializebackwardLV(VariableSet lo) {
LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement");
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement");
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ForStatementBlock.java b/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
index ae1aa75..9f0ff84 100644
--- a/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
@@ -19,13 +19,11 @@
package org.apache.sysml.parser;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.recompile.Recompiler;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.runtime.instructions.cp.BooleanObject;
@@ -54,8 +52,7 @@ public class ForStatementBlock extends StatementBlock
@Override
public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional)
- throws LanguageException, ParseException, IOException
- {
+ {
if (_statements.size() > 1){
raiseValidateError("ForStatementBlock should have only 1 statement (for statement)", conditional);
}
@@ -183,7 +180,7 @@ public class ForStatementBlock extends StatementBlock
}
@Override
- public VariableSet initializeforwardLV(VariableSet activeInPassed) throws LanguageException {
+ public VariableSet initializeforwardLV(VariableSet activeInPassed) {
ForStatement fstmt = (ForStatement)_statements.get(0);
if (_statements.size() > 1){
@@ -247,7 +244,7 @@ public class ForStatementBlock extends StatementBlock
}
@Override
- public VariableSet initializebackwardLV(VariableSet loPassed) throws LanguageException{
+ public VariableSet initializebackwardLV(VariableSet loPassed) {
ForStatement fstmt = (ForStatement)_statements.get(0);
@@ -285,7 +282,7 @@ public class ForStatementBlock extends StatementBlock
public Lop getIncrementLops() { return _incrementLops; }
@Override
- public VariableSet analyze(VariableSet loPassed) throws LanguageException{
+ public VariableSet analyze(VariableSet loPassed) {
VariableSet predVars = new VariableSet();
IterablePredicate ip = ((ForStatement)_statements.get(0)).getIterablePredicate();
@@ -339,9 +336,7 @@ public class ForStatementBlock extends StatementBlock
}
- public void performConstantPropagation(HashMap<String, ConstIdentifier> currConstVars)
- throws LanguageException
- {
+ public void performConstantPropagation(HashMap<String, ConstIdentifier> currConstVars) {
IterablePredicate ip = getIterPredicate();
// handle replacement in from expression
@@ -401,7 +396,7 @@ public class ForStatementBlock extends StatementBlock
// materialized hops recompilation flags
////
- public boolean updatePredicateRecompilationFlags() throws HopsException {
+ public boolean updatePredicateRecompilationFlags() {
if( ConfigurationManager.isDynamicRecompilation() ) {
_requiresFromRecompile = Recompiler.requiresRecompilation(getFromHops());
_requiresToRecompile = Recompiler.requiresRecompilation(getToHops());
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java b/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
index 420e5a6..2f2e618 100644
--- a/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
@@ -21,7 +21,6 @@ package org.apache.sysml.parser;
import java.util.ArrayList;
import java.util.HashMap;
-import java.io.IOException;
public class FunctionCallIdentifier extends DataIdentifier
@@ -53,7 +52,7 @@ public class FunctionCallIdentifier extends DataIdentifier
}
@Override
- public Expression rewriteExpression(String prefix) throws LanguageException {
+ public Expression rewriteExpression(String prefix) {
ArrayList<ParameterExpression> newParameterExpressions = new ArrayList<>();
for (ParameterExpression paramExpr : _paramExprs)
newParameterExpressions.add(new ParameterExpression(paramExpr.getName(), paramExpr.getExpr().rewriteExpression(prefix)));
@@ -88,11 +87,8 @@ public class FunctionCallIdentifier extends DataIdentifier
* @param constVars map of constant identifiers
* @param conditional if true, display warning for 'raiseValidateError'; if false, throw LanguageException
* for 'raiseValidateError'
- * @throws LanguageException if LanguageException occurs
- * @throws IOException if IOException occurs
*/
public void validateExpression(DMLProgram dmlp, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional)
- throws LanguageException, IOException
{
// Step 1: check the namespace exists, and that function is defined in the namespace
if (dmlp.getNamespaces().get(_namespace) == null){
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/FunctionStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/FunctionStatement.java b/src/main/java/org/apache/sysml/parser/FunctionStatement.java
index 3d7960a..5149997 100644
--- a/src/main/java/org/apache/sysml/parser/FunctionStatement.java
+++ b/src/main/java/org/apache/sysml/parser/FunctionStatement.java
@@ -31,7 +31,7 @@ public class FunctionStatement extends Statement
protected ArrayList <DataIdentifier> _outputParams;
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
+ public Statement rewriteStatement(String prefix) {
LOG.error(this.printErrorLocation() + "should not call rewriteStatement for FunctionStatement");
throw new LanguageException(this.printErrorLocation() + "should not call rewriteStatement for FunctionStatement");
}
@@ -113,13 +113,13 @@ public class FunctionStatement extends Statement
}
@Override
- public void initializeforwardLV(VariableSet activeIn) throws LanguageException{
+ public void initializeforwardLV(VariableSet activeIn) {
LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement");
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement");
}
@Override
- public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{
+ public VariableSet initializebackwardLV(VariableSet lo) {
LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement");
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement");
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java b/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
index 35ec6d4..2d7543f 100644
--- a/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
@@ -19,7 +19,6 @@
package org.apache.sysml.parser;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -44,9 +43,7 @@ public class FunctionStatementBlock extends StatementBlock
*/
@Override
public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional)
- throws LanguageException, ParseException, IOException
{
-
if (_statements.size() > 1){
LOG.error(this.printBlockErrorLocation() + "FunctionStatementBlock should have only 1 statement (FunctionStatement)");
throw new LanguageException(this.printBlockErrorLocation() + "FunctionStatementBlock should have only 1 statement (FunctionStatement)");
@@ -201,7 +198,7 @@ public class FunctionStatementBlock extends StatementBlock
}
@Override
- public VariableSet initializeforwardLV(VariableSet activeInPassed) throws LanguageException {
+ public VariableSet initializeforwardLV(VariableSet activeInPassed) {
FunctionStatement fstmt = (FunctionStatement)_statements.get(0);
if (_statements.size() > 1){
LOG.error(this.printBlockErrorLocation() + "FunctionStatementBlock should have only 1 statement (while statement)");
@@ -245,7 +242,7 @@ public class FunctionStatementBlock extends StatementBlock
}
@Override
- public VariableSet initializebackwardLV(VariableSet loPassed) throws LanguageException{
+ public VariableSet initializebackwardLV(VariableSet loPassed) {
FunctionStatement wstmt = (FunctionStatement)_statements.get(0);
@@ -265,12 +262,12 @@ public class FunctionStatementBlock extends StatementBlock
}
@Override
- public VariableSet analyze(VariableSet loPassed) throws LanguageException{
+ public VariableSet analyze(VariableSet loPassed) {
LOG.error(this.printBlockErrorLocation() + "Both liveIn and liveOut variables need to be specified for liveness analysis for FunctionStatementBlock");
throw new LanguageException(this.printBlockErrorLocation() + "Both liveIn and liveOut variables need to be specified for liveness analysis for FunctionStatementBlock");
}
- public VariableSet analyze(VariableSet liPassed, VariableSet loPassed) throws LanguageException{
+ public VariableSet analyze(VariableSet liPassed, VariableSet loPassed) {
VariableSet candidateLO = new VariableSet();
candidateLO.addVariables(loPassed);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/Identifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/Identifier.java b/src/main/java/org/apache/sysml/parser/Identifier.java
index 3c44452..ffb455b 100644
--- a/src/main/java/org/apache/sysml/parser/Identifier.java
+++ b/src/main/java/org/apache/sysml/parser/Identifier.java
@@ -140,7 +140,6 @@ public abstract class Identifier extends Expression
@Override
public void validateExpression(HashMap<String,DataIdentifier> ids, HashMap<String,ConstIdentifier> constVars, boolean conditional)
- throws LanguageException
{
if( getOutput() instanceof DataIdentifier ) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/IfStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IfStatement.java b/src/main/java/org/apache/sysml/parser/IfStatement.java
index 1448e8a..7352b22 100644
--- a/src/main/java/org/apache/sysml/parser/IfStatement.java
+++ b/src/main/java/org/apache/sysml/parser/IfStatement.java
@@ -30,7 +30,7 @@ public class IfStatement extends Statement
private ArrayList<StatementBlock> _elseBody;
@Override
- public Statement rewriteStatement(String prefix) throws LanguageException{
+ public Statement rewriteStatement(String prefix) {
LOG.error(this.printErrorLocation() + "should not call rewriteStatement for IfStatement");
throw new LanguageException(this.printErrorLocation() + "should not call rewriteStatement for IfStatement");
}
@@ -81,14 +81,12 @@ public class IfStatement extends Statement
}
@Override
- public void initializeforwardLV(VariableSet activeIn) throws LanguageException{
- LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement");
+ public void initializeforwardLV(VariableSet activeIn) {
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement");
}
@Override
- public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{
- LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement");
+ public VariableSet initializebackwardLV(VariableSet lo) {
throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement");
}
[07/10] systemml git commit: [SYSTEMML-2191] Cleanup exception
hierarchy and handling, part 1
Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Compression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Compression.java b/src/main/java/org/apache/sysml/lops/Compression.java
index 65293ef..b29a235 100644
--- a/src/main/java/org/apache/sysml/lops/Compression.java
+++ b/src/main/java/org/apache/sysml/lops/Compression.java
@@ -38,10 +38,8 @@ public class Compression extends Lop
}
}
- public Compression(Lop input, DataType dt, ValueType vt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.Checkpoint, dt, vt);
+ public Compression(Lop input, DataType dt, ValueType vt, ExecType et) {
+ super(Lop.Type.Checkpoint, dt, vt);
this.addInput(input);
input.addOutput(this);
@@ -60,9 +58,7 @@ public class Compression extends Lop
}
@Override
- public String getInstructions(String input1, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( Lop.OPERAND_DELIMITOR );
@@ -71,7 +67,6 @@ public class Compression extends Lop
sb.append( getInputs().get(0).prepInputOperand(input1));
sb.append( OPERAND_DELIMITOR );
sb.append( prepOutputOperand(output));
-
return sb.toString();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/ConvolutionTransform.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/ConvolutionTransform.java b/src/main/java/org/apache/sysml/lops/ConvolutionTransform.java
index bfb4758..192adb5 100644
--- a/src/main/java/org/apache/sysml/lops/ConvolutionTransform.java
+++ b/src/main/java/org/apache/sysml/lops/ConvolutionTransform.java
@@ -175,7 +175,7 @@ public class ConvolutionTransform extends Lop
}
@Override
- public String getInstructions(String input, String bias, String output) throws LopsException {
+ public String getInstructions(String input, String bias, String output) {
if(operation == OperationTypes.BIAS_ADD || operation == OperationTypes.BIAS_MULTIPLY || operation == OperationTypes.RELU_BACKWARD) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
@@ -206,7 +206,7 @@ public class ConvolutionTransform extends Lop
}
@Override
- public String getInstructions(String input, String C, String HW, String output) throws LopsException {
+ public String getInstructions(String input, String C, String HW, String output) {
if(operation == OperationTypes.CHANNEL_SUMS) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
@@ -231,7 +231,7 @@ public class ConvolutionTransform extends Lop
}
@Override
- public String getInstructions(String[] inputs, String output) throws LopsException {
+ public String getInstructions(String[] inputs, String output) {
StringBuilder sb = new StringBuilder();
appendOpcode(sb);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Ctable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Ctable.java b/src/main/java/org/apache/sysml/lops/Ctable.java
index 8aac934..ff9c720 100644
--- a/src/main/java/org/apache/sysml/lops/Ctable.java
+++ b/src/main/java/org/apache/sysml/lops/Ctable.java
@@ -128,7 +128,7 @@ public class Ctable extends Lop
}
@Override
- public String getInstructions(String input1, String input2, String input3, String output) throws LopsException
+ public String getInstructions(String input1, String input2, String input3, String output)
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
@@ -194,7 +194,7 @@ public class Ctable extends Lop
}
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index) throws LopsException
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index)
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CumulativeOffsetBinary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CumulativeOffsetBinary.java b/src/main/java/org/apache/sysml/lops/CumulativeOffsetBinary.java
index c9ad84c..5d07c44 100644
--- a/src/main/java/org/apache/sysml/lops/CumulativeOffsetBinary.java
+++ b/src/main/java/org/apache/sysml/lops/CumulativeOffsetBinary.java
@@ -31,8 +31,7 @@ public class CumulativeOffsetBinary extends Lop
private OperationTypes _op;
private double _initValue = 0;
- public CumulativeOffsetBinary(Lop data, Lop offsets, DataType dt, ValueType vt, OperationTypes op, ExecType et)
- throws LopsException
+ public CumulativeOffsetBinary(Lop data, Lop offsets, DataType dt, ValueType vt, OperationTypes op, ExecType et)
{
super(Lop.Type.CumulativeOffsetBinary, dt, vt);
checkSupportedOperations(op);
@@ -42,7 +41,6 @@ public class CumulativeOffsetBinary extends Lop
}
public CumulativeOffsetBinary(Lop data, Lop offsets, DataType dt, ValueType vt, double init, OperationTypes op, ExecType et)
- throws LopsException
{
super(Lop.Type.CumulativeOffsetBinary, dt, vt);
checkSupportedOperations(op);
@@ -88,9 +86,7 @@ public class CumulativeOffsetBinary extends Lop
return "CumulativeOffsetBinary";
}
- private static void checkSupportedOperations(OperationTypes op)
- throws LopsException
- {
+ private static void checkSupportedOperations(OperationTypes op) {
//sanity check for supported aggregates
if( !(op == OperationTypes.KahanSum || op == OperationTypes.Product ||
op == OperationTypes.Min || op == OperationTypes.Max) )
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CumulativePartialAggregate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CumulativePartialAggregate.java b/src/main/java/org/apache/sysml/lops/CumulativePartialAggregate.java
index 3e0e6a3..015bcd0 100644
--- a/src/main/java/org/apache/sysml/lops/CumulativePartialAggregate.java
+++ b/src/main/java/org/apache/sysml/lops/CumulativePartialAggregate.java
@@ -30,9 +30,7 @@ public class CumulativePartialAggregate extends Lop
private OperationTypes _op;
- public CumulativePartialAggregate(Lop input, DataType dt, ValueType vt, OperationTypes op, ExecType et)
- throws LopsException
- {
+ public CumulativePartialAggregate(Lop input, DataType dt, ValueType vt, OperationTypes op, ExecType et) {
super(Lop.Type.CumulativePartialAggregate, dt, vt);
//sanity check for supported aggregates
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/CumulativeSplitAggregate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/CumulativeSplitAggregate.java b/src/main/java/org/apache/sysml/lops/CumulativeSplitAggregate.java
index 697b616..b999b45 100644
--- a/src/main/java/org/apache/sysml/lops/CumulativeSplitAggregate.java
+++ b/src/main/java/org/apache/sysml/lops/CumulativeSplitAggregate.java
@@ -28,9 +28,7 @@ public class CumulativeSplitAggregate extends Lop
{
private double _initValue = 0;
- public CumulativeSplitAggregate(Lop input, DataType dt, ValueType vt, double init)
- throws LopsException
- {
+ public CumulativeSplitAggregate(Lop input, DataType dt, ValueType vt, double init) {
super(Lop.Type.CumulativeSplitAggregate, dt, vt);
_initValue = init;
init(input, dt, vt, ExecType.MR);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Data.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Data.java b/src/main/java/org/apache/sysml/lops/Data.java
index 7f22038..f000bab 100644
--- a/src/main/java/org/apache/sysml/lops/Data.java
+++ b/src/main/java/org/apache/sysml/lops/Data.java
@@ -55,9 +55,8 @@ public class Data extends Lop
* @param vt value type
* @param literalValue literal value
* @return literal low-level operator
- * @throws LopsException if LopsException occurs
*/
- public static Data createLiteralLop(ValueType vt, String literalValue) throws LopsException {
+ public static Data createLiteralLop(ValueType vt, String literalValue) {
// All literals have default format type of TEXT
return new Data(OperationTypes.READ, null, null, null, literalValue, DataType.SCALAR, vt, false, FileFormatTypes.BINARY);
}
@@ -76,10 +75,9 @@ public class Data extends Lop
* @param vt value type
* @param isTransient true if transient
* @param fmt file format
- * @throws LopsException if LopsException occurs
*/
public Data(Data.OperationTypes op, Lop input, HashMap<String, Lop>
- inputParametersLops, String name, String literal, DataType dt, ValueType vt, boolean isTransient, FileFormatTypes fmt) throws LopsException
+ inputParametersLops, String name, String literal, DataType dt, ValueType vt, boolean isTransient, FileFormatTypes fmt)
{
super(Lop.Type.Data, dt, vt);
@@ -180,9 +178,8 @@ public class Data extends Lop
/**
* Method to set format types for input, output files.
* @param type file format
- * @throws LopsException if LopsException occurs
*/
- public void setFileFormatAndProperties(FileFormatTypes type) throws LopsException
+ public void setFileFormatAndProperties(FileFormatTypes type)
{
this.formatType = type ;
if(type == FileFormatTypes.BINARY)
@@ -238,8 +235,7 @@ public class Data extends Lop
return _inputParams.get(name);
}
- public Lop getNamedInputLop(String name, String defaultVal)
- throws LopsException {
+ public Lop getNamedInputLop(String name, String defaultVal) {
if( _inputParams.containsKey(name) )
return _inputParams.get(name);
else
@@ -254,7 +250,7 @@ public class Data extends Lop
return literal_var;
}
- public boolean getBooleanValue() throws LopsException {
+ public boolean getBooleanValue() {
if(literal_var) {
return Boolean.parseBoolean(getOutputParameters().getLabel());
}
@@ -262,7 +258,7 @@ public class Data extends Lop
throw new LopsException("Cannot obtain the value of a non-literal variable at compile time.");
}
- public double getDoubleValue() throws LopsException {
+ public double getDoubleValue() {
if(literal_var) {
return Double.parseDouble(getOutputParameters().getLabel());
}
@@ -270,7 +266,7 @@ public class Data extends Lop
throw new LopsException("Cannot obtain the value of a non-literal variable at compile time.");
}
- public long getLongValue() throws LopsException {
+ public long getLongValue() {
if(literal_var) {
ValueType vt = getValueType();
switch(vt) {
@@ -287,7 +283,7 @@ public class Data extends Lop
throw new LopsException("Can not obtain the value of a non-literal variable at compile time.");
}
- public String getStringValue() throws LopsException {
+ public String getStringValue() {
if(literal_var) {
return getOutputParameters().getLabel();
}
@@ -316,7 +312,7 @@ public class Data extends Lop
*
*/
@Override
- public String getInstructions(int input_index, int output_index) throws LopsException {
+ public String getInstructions(int input_index, int output_index) {
OutputParameters oparams = getOutputParameters();
@@ -381,8 +377,7 @@ public class Data extends Lop
*/
@Override
public String getInstructions(String input1, String input2)
- throws LopsException
- {
+ {
if ( getOutputParameters().getFile_name() == null && operation == OperationTypes.READ )
throw new LopsException(this.printErrorLocation() + "Data.getInstructions(): Exepecting a SCALAR data type, encountered " + getDataType());
@@ -493,19 +488,18 @@ public class Data extends Lop
/**
* Method to generate createvar instruction that updates symbol table with metadata, hdfsfile name, etc.
*
- * @throws LopsException if LopsException occurs
*/
@Override
- public String getInstructions() throws LopsException {
+ public String getInstructions() {
return getCreateVarInstructions(getOutputParameters().getFile_name(), getOutputParameters().getLabel());
}
@Override
- public String getInstructions(String outputFileName) throws LopsException {
+ public String getInstructions(String outputFileName) {
return getCreateVarInstructions(outputFileName, getOutputParameters().getLabel() );
}
- public String getCreateVarInstructions(String outputFileName, String outputLabel) throws LopsException {
+ public String getCreateVarInstructions(String outputFileName, String outputLabel) {
if ( getDataType() == DataType.MATRIX || getDataType() == DataType.FRAME ) {
if ( isTransient() )
@@ -576,9 +570,8 @@ public class Data extends Lop
* The set of properties that are attached for a READ operation is different from that for a WRITE operation.
*
* @return instruction with csv format properties appended
- * @throws LopsException if LopsException occurs
*/
- private String createVarCSVHelper() throws LopsException {
+ private String createVarCSVHelper() {
StringBuilder sb = new StringBuilder();
if ( operation == OperationTypes.READ ) {
Data headerLop = (Data) getNamedInputLop(DataExpression.DELIM_HAS_HEADER_ROW);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/DataGen.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/DataGen.java b/src/main/java/org/apache/sysml/lops/DataGen.java
index 51bfb5a..72dcd32 100644
--- a/src/main/java/org/apache/sysml/lops/DataGen.java
+++ b/src/main/java/org/apache/sysml/lops/DataGen.java
@@ -61,10 +61,9 @@ public class DataGen extends Lop
* @param dt Data type
* @param vt Value type
* @param et Execution type
- * @throws LopsException if LopsException occurs
*/
public DataGen(DataGenMethod mthd, DataIdentifier id, HashMap<String, Lop>
- inputParametersLops, String baseDir, DataType dt, ValueType vt, ExecType et) throws LopsException
+ inputParametersLops, String baseDir, DataType dt, ValueType vt, ExecType et)
{
super(Type.DataGen, dt, vt);
method = mthd;
@@ -117,8 +116,7 @@ public class DataGen extends Lop
* passed from piggybacking as the function argument <code>output</code>.
*/
@Override
- public String getInstructions(String output)
- throws LopsException
+ public String getInstructions(String output)
{
switch( method )
{
@@ -137,9 +135,7 @@ public class DataGen extends Lop
}
@Override
- public String getInstructions(int inputIndex, int outputIndex)
- throws LopsException
- {
+ public String getInstructions(int inputIndex, int outputIndex) {
switch(method) {
case RAND:
return getRandInstructionMR(inputIndex, outputIndex);
@@ -156,11 +152,9 @@ public class DataGen extends Lop
*
* @param output output operand
* @return cp instruction for rand
- * @throws LopsException if LopsException occurs
*/
private String getRandInstructionCPSpark(String output)
- throws LopsException
- {
+ {
//sanity checks
if ( method != DataGenMethod.RAND )
throw new LopsException("Invalid instruction generation for data generation method " + method);
@@ -239,7 +233,6 @@ public class DataGen extends Lop
}
private String getSInitInstructionCPSpark(String output)
- throws LopsException
{
if ( method != DataGenMethod.SINIT )
throw new LopsException("Invalid instruction generation for data generation method " + method);
@@ -287,7 +280,6 @@ public class DataGen extends Lop
}
private String getSampleInstructionCPSpark(String output)
- throws LopsException
{
if ( method != DataGenMethod.SAMPLE )
throw new LopsException("Invalid instruction generation for data generation method " + method);
@@ -335,9 +327,8 @@ public class DataGen extends Lop
*
* @param output output operand
* @return cp instruction for seq
- * @throws LopsException if LopsException occurs
*/
- private String getSeqInstructionCPSpark(String output) throws LopsException {
+ private String getSeqInstructionCPSpark(String output) {
if ( method != DataGenMethod.SEQ )
throw new LopsException("Invalid instruction generation for data generation method " + method);
@@ -393,17 +384,14 @@ public class DataGen extends Lop
* @param inputIndex input index
* @param outputIndex output index
* @return mr instruction for rand
- * @throws LopsException if LopsException occurs
*/
- private String getRandInstructionMR(int inputIndex, int outputIndex)
- throws LopsException
- {
+ private String getRandInstructionMR(int inputIndex, int outputIndex) {
//sanity checks
if( getInputs().size() != DataExpression.RAND_VALID_PARAM_NAMES.length) {
throw new LopsException(printErrorLocation() + "Invalid number of operands ("
+ getInputs().size() + ") for a Rand operation");
}
-
+
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( Lop.OPERAND_DELIMITOR );
@@ -472,9 +460,8 @@ public class DataGen extends Lop
* @param inputIndex input index
* @param outputIndex output index
* @return mr instruction for seq
- * @throws LopsException if LopsException occurs
*/
- private String getSeqInstructionMR(int inputIndex, int outputIndex) throws LopsException {
+ private String getSeqInstructionMR(int inputIndex, int outputIndex) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/DataPartition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/DataPartition.java b/src/main/java/org/apache/sysml/lops/DataPartition.java
index 81599db..8b3cd0a 100644
--- a/src/main/java/org/apache/sysml/lops/DataPartition.java
+++ b/src/main/java/org/apache/sysml/lops/DataPartition.java
@@ -38,9 +38,8 @@ public class DataPartition extends Lop
private PDataPartitionFormat _pformat = null;
public DataPartition(Lop input, DataType dt, ValueType vt, ExecType et, PDataPartitionFormat pformat)
- throws LopsException
{
- super(Lop.Type.DataPartition, dt, vt);
+ super(Lop.Type.DataPartition, dt, vt);
this.addInput(input);
input.addOutput(this);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/FunctionCallCP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/FunctionCallCP.java b/src/main/java/org/apache/sysml/lops/FunctionCallCP.java
index 3490b8d..ac58335 100644
--- a/src/main/java/org/apache/sysml/lops/FunctionCallCP.java
+++ b/src/main/java/org/apache/sysml/lops/FunctionCallCP.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import org.apache.sysml.hops.FunctionOp;
import org.apache.sysml.hops.Hop;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.lops.LopProperties.ExecLocation;
import org.apache.sysml.lops.LopProperties.ExecType;
import org.apache.sysml.lops.compile.JobType;
@@ -39,9 +38,7 @@ public class FunctionCallCP extends Lop
private String[] _outputs;
private ArrayList<Lop> _outputLops = null;
- public FunctionCallCP(ArrayList<Lop> inputs, String fnamespace, String fname, String[] outputs, ArrayList<Hop> outputHops, ExecType et)
- throws HopsException, LopsException
- {
+ public FunctionCallCP(ArrayList<Lop> inputs, String fnamespace, String fname, String[] outputs, ArrayList<Hop> outputHops, ExecType et) {
this(inputs, fnamespace, fname, outputs, et);
if(outputHops != null) {
_outputLops = new ArrayList<>();
@@ -107,7 +104,7 @@ public class FunctionCallCP extends Lop
* Builtin functions have their namespace set to DMLProgram.INTERNAL_NAMESPACE ("_internal").
*/
@Override
- public String getInstructions(String[] inputs, String[] outputs) throws LopsException
+ public String getInstructions(String[] inputs, String[] outputs)
{
// Handle internal builtin functions
if (_fnamespace.equalsIgnoreCase(DMLProgram.INTERNAL_NAMESPACE) ) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/FunctionCallCPSingle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/FunctionCallCPSingle.java b/src/main/java/org/apache/sysml/lops/FunctionCallCPSingle.java
index ef96ed5..b134f26 100644
--- a/src/main/java/org/apache/sysml/lops/FunctionCallCPSingle.java
+++ b/src/main/java/org/apache/sysml/lops/FunctionCallCPSingle.java
@@ -64,42 +64,42 @@ public class FunctionCallCPSingle extends Lop
}
@Override
- public String getInstructions(String input1, String output) throws LopsException {
+ public String getInstructions(String input1, String output) {
return getInstructions(new String[]{input1}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String output) {
return getInstructions(new String[]{input1, input2}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String output) {
return getInstructions(new String[]{input1, input2, input3}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String output) {
return getInstructions(new String[]{input1, input2, input3, input4}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) {
return getInstructions(new String[]{input1, input2, input3, input4, input5}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) {
return getInstructions(new String[]{input1, input2, input3, input4, input5, input6}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) {
return getInstructions(new String[]{input1, input2, input3, input4, input5, input6, input7}, new String[]{output});
}
@Override
- public String getInstructions(String[] inputs, String output) throws LopsException
+ public String getInstructions(String[] inputs, String output)
{
StringBuilder inst = new StringBuilder();
inst.append(getExecType());
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/GroupedAggregate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/GroupedAggregate.java b/src/main/java/org/apache/sysml/lops/GroupedAggregate.java
index b1fd486..b40c6d0 100644
--- a/src/main/java/org/apache/sysml/lops/GroupedAggregate.java
+++ b/src/main/java/org/apache/sysml/lops/GroupedAggregate.java
@@ -157,9 +157,7 @@ public class GroupedAggregate extends Lop
*
*/
@Override
- public String getInstructions(String output)
- throws LopsException
- {
+ public String getInstructions(String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/LeftIndex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/LeftIndex.java b/src/main/java/org/apache/sysml/lops/LeftIndex.java
index e841059..99595c0 100644
--- a/src/main/java/org/apache/sysml/lops/LeftIndex.java
+++ b/src/main/java/org/apache/sysml/lops/LeftIndex.java
@@ -39,16 +39,14 @@ public class LeftIndex extends Lop
private LixCacheType _type;
public LeftIndex(
- Lop lhsInput, Lop rhsInput, Lop rowL, Lop rowU, Lop colL, Lop colU, DataType dt, ValueType vt, ExecType et)
- throws LopsException {
+ Lop lhsInput, Lop rhsInput, Lop rowL, Lop rowU, Lop colL, Lop colU, DataType dt, ValueType vt, ExecType et) {
super(Lop.Type.LeftIndex, dt, vt);
_type = LixCacheType.NONE;
init(lhsInput, rhsInput, rowL, rowU, colL, colU, et);
}
public LeftIndex(
- Lop lhsInput, Lop rhsInput, Lop rowL, Lop rowU, Lop colL, Lop colU, DataType dt, ValueType vt, ExecType et, LixCacheType type)
- throws LopsException {
+ Lop lhsInput, Lop rhsInput, Lop rowL, Lop rowU, Lop colL, Lop colU, DataType dt, ValueType vt, ExecType et, LixCacheType type) {
super(Lop.Type.LeftIndex, dt, vt);
_type = type;
init(lhsInput, rhsInput, rowL, rowU, colL, colU, et);
@@ -65,9 +63,8 @@ public class LeftIndex extends Lop
* @param colL column lower lop
* @param colU column upper lop
* @param et execution type
- * @throws LopsException if LopsException occurs
*/
- private void init(Lop lhsMatrix, Lop rhsMatrix, Lop rowL, Lop rowU, Lop colL, Lop colU, ExecType et) throws LopsException {
+ private void init(Lop lhsMatrix, Lop rhsMatrix, Lop rowL, Lop rowU, Lop colL, Lop colU, ExecType et) {
/*
* A[i:j, k:l] = B;
* B -> rhsMatrix
@@ -110,8 +107,7 @@ public class LeftIndex extends Lop
}
@Override
- public String getInstructions(String lhsInput, String rhsInput, String rowl, String rowu, String coll, String colu, String output)
- throws LopsException
+ public String getInstructions(String lhsInput, String rhsInput, String rowl, String rowu, String coll, String colu, String output)
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Lop.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Lop.java b/src/main/java/org/apache/sysml/lops/Lop.java
index 8d79224..3d6a4f3 100644
--- a/src/main/java/org/apache/sysml/lops/Lop.java
+++ b/src/main/java/org/apache/sysml/lops/Lop.java
@@ -421,9 +421,8 @@ public abstract class Lop
*
* @param output output
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String output) throws LopsException {
+ public String getInstructions(String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -432,9 +431,8 @@ public abstract class Lop
* @param input1 input 1
* @param output output
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String input1, String output) throws LopsException {
+ public String getInstructions(String input1, String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -444,9 +442,8 @@ public abstract class Lop
* @param input2 input 2
* @param output output
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String input1, String input2, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -458,9 +455,8 @@ public abstract class Lop
* @param input3 input 3
* @param output output
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String input1, String input2, String input3, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -473,9 +469,8 @@ public abstract class Lop
* @param input4 input 4
* @param output output
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String input1, String input2, String input3, String input4, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -489,9 +484,8 @@ public abstract class Lop
* @param input5 input 5
* @param output output
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -505,26 +499,25 @@ public abstract class Lop
* @param input6 input 6
* @param output output
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
- public String getInstructions(String[] inputs, String outputs) throws LopsException {
+ public String getInstructions(String[] inputs, String outputs) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
- public String getInstructions(int output_index) throws LopsException {
+ public String getInstructions(int output_index) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass. Lop Type: " + this.getType());
}
- public String getInstructions(int input_index, int output_index) throws LopsException {
+ public String getInstructions(int input_index, int output_index) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass. Lop Type: " + this.getType());
}
@@ -534,9 +527,8 @@ public abstract class Lop
* @param input_index2 input index 2
* @param output_index output index
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(int input_index1, int input_index2, int output_index) throws LopsException {
+ public String getInstructions(int input_index1, int input_index2, int output_index) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -547,9 +539,8 @@ public abstract class Lop
* @param input_index3 input index 3
* @param output_index output index
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index) throws LopsException {
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -561,9 +552,8 @@ public abstract class Lop
* @param input_index4 input index 4
* @param output_index output index
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int output_index) throws LopsException {
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int output_index) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -576,9 +566,8 @@ public abstract class Lop
* @param input_index5 input index 5
* @param output_index output index
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int output_index) throws LopsException {
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int output_index) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -588,27 +577,24 @@ public abstract class Lop
* @param inputs array of inputs
* @param outputs array of outputs
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions(String[] inputs, String[] outputs) throws LopsException {
+ public String getInstructions(String[] inputs, String[] outputs) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
/** Method should be overridden if needed
*
* @return instructions as string
- * @throws LopsException if LopsException occurs
*/
- public String getInstructions() throws LopsException {
+ public String getInstructions() {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
/** Method should be overridden if needed
*
* @return simple instruction type
- * @throws LopsException if LopsException occurs
*/
- public SimpleInstType getSimpleInstructionType() throws LopsException {
+ public SimpleInstType getSimpleInstructionType() {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
@@ -645,7 +631,7 @@ public abstract class Lop
public String getInstructions(int input, int rowl, int rowu,
int coll, int colu, int leftRowDim,
- int leftColDim, int output) throws LopsException {
+ int leftColDim, int output) {
throw new LopsException(this.printErrorLocation() + "Should never be invoked in Baseclass");
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/MapMult.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/MapMult.java b/src/main/java/org/apache/sysml/lops/MapMult.java
index 7fb5a60..ce25483 100644
--- a/src/main/java/org/apache/sysml/lops/MapMult.java
+++ b/src/main/java/org/apache/sysml/lops/MapMult.java
@@ -68,12 +68,10 @@ public class MapMult extends Lop
* @param rightCache true if right cache, false if left cache
* @param partitioned true if partitioned, false if not partitioned
* @param emptyBlocks true if output empty blocks
- * @throws LopsException if LopsException occurs
*/
public MapMult(Lop input1, Lop input2, DataType dt, ValueType vt, boolean rightCache, boolean partitioned, boolean emptyBlocks )
- throws LopsException
{
- super(Lop.Type.MapMult, dt, vt);
+ super(Lop.Type.MapMult, dt, vt);
this.addInput(input1);
this.addInput(input2);
input1.addOutput(this);
@@ -106,12 +104,9 @@ public class MapMult extends Lop
* @param partitioned true if partitioned, false if not partitioned
* @param emptyBlocks true if output empty blocks
* @param aggtype spark aggregation type
- * @throws LopsException if LopsException occurs
*/
- public MapMult(Lop input1, Lop input2, DataType dt, ValueType vt, boolean rightCache, boolean partitioned, boolean emptyBlocks, SparkAggType aggtype)
- throws LopsException
- {
- super(Lop.Type.MapMult, dt, vt);
+ public MapMult(Lop input1, Lop input2, DataType dt, ValueType vt, boolean rightCache, boolean partitioned, boolean emptyBlocks, SparkAggType aggtype) {
+ super(Lop.Type.MapMult, dt, vt);
this.addInput(input1);
this.addInput(input2);
input1.addOutput(this);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/MapMultChain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/MapMultChain.java b/src/main/java/org/apache/sysml/lops/MapMultChain.java
index e19e522..bef1925 100644
--- a/src/main/java/org/apache/sysml/lops/MapMultChain.java
+++ b/src/main/java/org/apache/sysml/lops/MapMultChain.java
@@ -49,12 +49,9 @@ public class MapMultChain extends Lop
* @param dt data type
* @param vt value type
* @param et execution type
- * @throws LopsException if LopsException occurs
*/
- public MapMultChain(Lop input1, Lop input2, DataType dt, ValueType vt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.MapMultChain, dt, vt);
+ public MapMultChain(Lop input1, Lop input2, DataType dt, ValueType vt, ExecType et) {
+ super(Lop.Type.MapMultChain, dt, vt);
addInput(input1); //X
addInput(input2); //v
input1.addOutput(this);
@@ -75,12 +72,9 @@ public class MapMultChain extends Lop
* @param dt data type
* @param vt value type
* @param et execution type
- * @throws LopsException if LopsException occurs
*/
- public MapMultChain(Lop input1, Lop input2, Lop input3, ChainType chain, DataType dt, ValueType vt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.MapMultChain, dt, vt);
+ public MapMultChain(Lop input1, Lop input2, Lop input3, ChainType chain, DataType dt, ValueType vt, ExecType et) {
+ super(Lop.Type.MapMultChain, dt, vt);
addInput(input1); //X
addInput(input2); //w
addInput(input3); //v
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Nary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Nary.java b/src/main/java/org/apache/sysml/lops/Nary.java
index 7df863a..7541ffa 100644
--- a/src/main/java/org/apache/sysml/lops/Nary.java
+++ b/src/main/java/org/apache/sysml/lops/Nary.java
@@ -37,8 +37,7 @@ public class Nary extends Lop {
private OperationType operationType;
- public Nary(OperationType operationType, DataType dt, ValueType vt, Lop[] inputLops, ExecType et)
- throws LopsException
+ public Nary(OperationType operationType, DataType dt, ValueType vt, Lop[] inputLops, ExecType et)
{
super(Lop.Type.Nary, dt, vt);
this.operationType = operationType;
@@ -93,7 +92,7 @@ public class Nary extends Lop {
*
*/
@Override
- public String getInstructions(String[] inputs, String output) throws LopsException {
+ public String getInstructions(String[] inputs, String output) {
String opString = getOpcode();
StringBuilder sb = new StringBuilder();
@@ -114,7 +113,7 @@ public class Nary extends Lop {
return sb.toString();
}
- private String getOpcode() throws LopsException {
+ private String getOpcode() {
switch (operationType) {
case PRINTF:
case CBIND:
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/OutputParameters.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/OutputParameters.java b/src/main/java/org/apache/sysml/lops/OutputParameters.java
index bdabdad..c34157e 100644
--- a/src/main/java/org/apache/sysml/lops/OutputParameters.java
+++ b/src/main/java/org/apache/sysml/lops/OutputParameters.java
@@ -61,7 +61,7 @@ public class OutputParameters
_file_label = label;
}
- public void setDimensions(long rows, long cols, long rows_per_block, long cols_per_block, long nnz) throws HopsException {
+ public void setDimensions(long rows, long cols, long rows_per_block, long cols_per_block, long nnz) {
_num_rows = rows;
_num_cols = cols;
_nnz = nnz;
@@ -82,7 +82,7 @@ public class OutputParameters
}
}
- public void setDimensions(long rows, long cols, long rows_per_block, long cols_per_block, long nnz, UpdateType update) throws HopsException {
+ public void setDimensions(long rows, long cols, long rows_per_block, long cols_per_block, long nnz, UpdateType update) {
_updateType = update;
setDimensions(rows, cols, rows_per_block, cols_per_block, nnz);
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/PMMJ.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/PMMJ.java b/src/main/java/org/apache/sysml/lops/PMMJ.java
index 0f4e9c3..5c542a1 100644
--- a/src/main/java/org/apache/sysml/lops/PMMJ.java
+++ b/src/main/java/org/apache/sysml/lops/PMMJ.java
@@ -50,12 +50,9 @@ public class PMMJ extends Lop
* @param partitioned true if partitioned
* @param emptyBlocks true if output empty blocks
* @param et execution type
- * @throws LopsException if LopsException occurs
*/
- public PMMJ(Lop pminput, Lop rightinput, Lop nrow, DataType dt, ValueType vt, boolean partitioned, boolean emptyBlocks, ExecType et)
- throws LopsException
- {
- super(Lop.Type.PMMJ, dt, vt);
+ public PMMJ(Lop pminput, Lop rightinput, Lop nrow, DataType dt, ValueType vt, boolean partitioned, boolean emptyBlocks, ExecType et) {
+ super(Lop.Type.PMMJ, dt, vt);
addInput(pminput);
addInput(rightinput);
addInput(nrow);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/PMapMult.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/PMapMult.java b/src/main/java/org/apache/sysml/lops/PMapMult.java
index e6bf3ac..3ab62ee 100644
--- a/src/main/java/org/apache/sysml/lops/PMapMult.java
+++ b/src/main/java/org/apache/sysml/lops/PMapMult.java
@@ -30,10 +30,8 @@ public class PMapMult extends Lop
{
public static final String OPCODE = "pmapmm";
- public PMapMult(Lop input1, Lop input2, DataType dt, ValueType vt)
- throws LopsException
- {
- super(Lop.Type.MapMult, dt, vt);
+ public PMapMult(Lop input1, Lop input2, DataType dt, ValueType vt) {
+ super(Lop.Type.MapMult, dt, vt);
this.addInput(input1);
this.addInput(input2);
input1.addOutput(this);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/ParameterizedBuiltin.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/ParameterizedBuiltin.java b/src/main/java/org/apache/sysml/lops/ParameterizedBuiltin.java
index 1188f1b..1670412 100644
--- a/src/main/java/org/apache/sysml/lops/ParameterizedBuiltin.java
+++ b/src/main/java/org/apache/sysml/lops/ParameterizedBuiltin.java
@@ -22,7 +22,6 @@ package org.apache.sysml.lops;
import java.util.HashMap;
import java.util.Map.Entry;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.lops.LopProperties.ExecLocation;
import org.apache.sysml.lops.LopProperties.ExecType;
import org.apache.sysml.lops.compile.JobType;
@@ -49,15 +48,11 @@ public class ParameterizedBuiltin extends Lop
//cp-specific parameters
private int _numThreads = 1;
- public ParameterizedBuiltin(HashMap<String, Lop> paramLops, OperationTypes op, DataType dt, ValueType vt, ExecType et)
- throws HopsException
- {
+ public ParameterizedBuiltin(HashMap<String, Lop> paramLops, OperationTypes op, DataType dt, ValueType vt, ExecType et) {
this(paramLops, op, dt, vt, et, 1);
}
- public ParameterizedBuiltin(HashMap<String, Lop> paramLops, OperationTypes op, DataType dt, ValueType vt, ExecType et, int k)
- throws HopsException
- {
+ public ParameterizedBuiltin(HashMap<String, Lop> paramLops, OperationTypes op, DataType dt, ValueType vt, ExecType et, int k) {
super(Lop.Type.ParameterizedBuiltin, dt, vt);
_operation = op;
@@ -105,9 +100,7 @@ public class ParameterizedBuiltin extends Lop
lps.setProperties(inputs, et, eloc, breaksAlignment, aligner, definesMRJob);
}
- public ParameterizedBuiltin(HashMap<String, Lop> paramLops, OperationTypes op, DataType dt, ValueType vt, ExecType et, boolean bRmEmptyBC)
- throws HopsException
- {
+ public ParameterizedBuiltin(HashMap<String, Lop> paramLops, OperationTypes op, DataType dt, ValueType vt, ExecType et, boolean bRmEmptyBC) {
this(paramLops, op, dt, vt, et);
_bRmEmptyBC = bRmEmptyBC;
}
@@ -129,8 +122,7 @@ public class ParameterizedBuiltin extends Lop
}
@Override
- public String getInstructions(String output)
- throws LopsException
+ public String getInstructions(String output)
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
@@ -246,8 +238,7 @@ public class ParameterizedBuiltin extends Lop
}
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index)
- throws LopsException
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int output_index)
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
@@ -288,8 +279,7 @@ public class ParameterizedBuiltin extends Lop
}
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int output_index)
- throws LopsException
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int output_index)
{
int[] tmp = new int[]{input_index1, input_index2,
input_index3, input_index4, input_index5};
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/PartialAggregate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/PartialAggregate.java b/src/main/java/org/apache/sysml/lops/PartialAggregate.java
index c42e787..5afa805 100644
--- a/src/main/java/org/apache/sysml/lops/PartialAggregate.java
+++ b/src/main/java/org/apache/sysml/lops/PartialAggregate.java
@@ -72,7 +72,6 @@ public class PartialAggregate extends Lop
public PartialAggregate( Lop input, Aggregate.OperationTypes op,
PartialAggregate.DirectionTypes direct, DataType dt, ValueType vt)
- throws LopsException
{
super(Lop.Type.PartialAggregate, dt, vt);
init(input, op, direct, dt, vt, ExecType.MR);
@@ -80,7 +79,6 @@ public class PartialAggregate extends Lop
public PartialAggregate( Lop input, Aggregate.OperationTypes op,
PartialAggregate.DirectionTypes direct, DataType dt, ValueType vt, ExecType et, int k)
- throws LopsException
{
super(Lop.Type.PartialAggregate, dt, vt);
init(input, op, direct, dt, vt, et);
@@ -89,7 +87,6 @@ public class PartialAggregate extends Lop
public PartialAggregate( Lop input, Aggregate.OperationTypes op,
PartialAggregate.DirectionTypes direct, DataType dt, ValueType vt, SparkAggType aggtype, ExecType et)
- throws LopsException
{
super(Lop.Type.PartialAggregate, dt, vt);
init(input, op, direct, dt, vt, et);
@@ -160,17 +157,12 @@ public class PartialAggregate extends Lop
* dml.runtime.matrix.operator.AggregateOperator.java and dml.runtime.matrix)
*
* @return correct location
- * @throws LopsException if LopsException occurs
*/
- public CorrectionLocationType getCorrectionLocation()
- throws LopsException
- {
+ public CorrectionLocationType getCorrectionLocation() {
return getCorrectionLocation(operation, direction);
}
- public static CorrectionLocationType getCorrectionLocation(Aggregate.OperationTypes operation, DirectionTypes direction)
- throws LopsException
- {
+ public static CorrectionLocationType getCorrectionLocation(Aggregate.OperationTypes operation, DirectionTypes direction) {
CorrectionLocationType loc;
switch (operation) {
@@ -254,14 +246,13 @@ public class PartialAggregate extends Lop
}
public void setDimensionsBasedOnDirection(long dim1, long dim2,
- long rowsPerBlock, long colsPerBlock) throws LopsException
+ long rowsPerBlock, long colsPerBlock)
{
setDimensionsBasedOnDirection(this, dim1, dim2, rowsPerBlock, colsPerBlock, direction);
}
public static void setDimensionsBasedOnDirection(Lop lop, long dim1, long dim2,
- long rowsPerBlock, long colsPerBlock, DirectionTypes dir)
- throws LopsException
+ long rowsPerBlock, long colsPerBlock, DirectionTypes dir)
{
try {
if (dir == DirectionTypes.Row)
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/PickByCount.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/PickByCount.java b/src/main/java/org/apache/sysml/lops/PickByCount.java
index 513724b..fe775de 100644
--- a/src/main/java/org/apache/sysml/lops/PickByCount.java
+++ b/src/main/java/org/apache/sysml/lops/PickByCount.java
@@ -105,9 +105,7 @@ public class PickByCount extends Lop
* rangepick:::0:DOUBLE:::Var3:DOUBLE:::1:DOUBLE
*/
@Override
- public String getInstructions(int input_index1, int input_index2, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index1, int input_index2, int output_index) {
return getInstructions(""+input_index1, ""+input_index2, ""+output_index);
}
@@ -120,8 +118,7 @@ public class PickByCount extends Lop
* valuepick:::temp2:STRING:::Var1:DOUBLE:::Var2:DOUBLE
*/
@Override
- public String getInstructions(String input1, String input2, String output) throws LopsException
- {
+ public String getInstructions(String input1, String input2, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( Lop.OPERAND_DELIMITOR );
@@ -159,9 +156,7 @@ public class PickByCount extends Lop
* iqm:::input:::output
*/
@Override
- public String getInstructions(String input, String output)
- throws LopsException
- {
+ public String getInstructions(String input, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( Lop.OPERAND_DELIMITOR );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/ReBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/ReBlock.java b/src/main/java/org/apache/sysml/lops/ReBlock.java
index 15a2bf6..61f45c9 100644
--- a/src/main/java/org/apache/sysml/lops/ReBlock.java
+++ b/src/main/java/org/apache/sysml/lops/ReBlock.java
@@ -39,7 +39,7 @@ public class ReBlock extends Lop
private int _rows_per_block;
private int _cols_per_block;
- public ReBlock(Lop input, int rows_per_block, int cols_per_block, DataType dt, ValueType vt, boolean outputEmptyBlocks, ExecType et) throws LopsException
+ public ReBlock(Lop input, int rows_per_block, int cols_per_block, DataType dt, ValueType vt, boolean outputEmptyBlocks, ExecType et)
{
super(Lop.Type.ReBlock, dt, vt);
this.addInput(input);
@@ -102,7 +102,7 @@ public class ReBlock extends Lop
// This function is replicated in Dag.java
@SuppressWarnings("unused")
- private Format getChildFormat(Lop node) throws LopsException {
+ private Format getChildFormat(Lop node) {
if(node.getOutputParameters().getFile_name() != null
|| node.getOutputParameters().getLabel() != null)
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/RepMat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/RepMat.java b/src/main/java/org/apache/sysml/lops/RepMat.java
index b443c80..2303c87 100644
--- a/src/main/java/org/apache/sysml/lops/RepMat.java
+++ b/src/main/java/org/apache/sysml/lops/RepMat.java
@@ -40,12 +40,9 @@ public class RepMat extends Lop
* @param repCols ?
* @param dt data type
* @param vt value type
- * @throws LopsException if LopsException occurs
*/
- public RepMat(Lop input1, Lop input2, boolean repCols, DataType dt, ValueType vt)
- throws LopsException
- {
- super(Lop.Type.RepMat, dt, vt);
+ public RepMat(Lop input1, Lop input2, boolean repCols, DataType dt, ValueType vt) {
+ super(Lop.Type.RepMat, dt, vt);
this.addInput(input1);
this.addInput(input2);
input1.addOutput(this);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/RightIndex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/RightIndex.java b/src/main/java/org/apache/sysml/lops/RightIndex.java
index 812425a..595a5b9 100644
--- a/src/main/java/org/apache/sysml/lops/RightIndex.java
+++ b/src/main/java/org/apache/sysml/lops/RightIndex.java
@@ -38,7 +38,6 @@ public class RightIndex extends Lop
public RightIndex(Lop input, Lop rowL, Lop rowU, Lop colL, Lop colU, Lop rowDim, Lop colDim,
DataType dt, ValueType vt, ExecType et, boolean forleft)
- throws LopsException
{
super(Lop.Type.RightIndex, dt, vt);
init(input, rowL, rowU, colL, colU, rowDim, colDim, dt, vt, et, forleft);
@@ -46,7 +45,6 @@ public class RightIndex extends Lop
public RightIndex(Lop input, Lop rowL, Lop rowU, Lop colL, Lop colU, Lop rowDim, Lop colDim,
DataType dt, ValueType vt, ExecType et)
- throws LopsException
{
super(Lop.Type.RightIndex, dt, vt);
init(input, rowL, rowU, colL, colU, rowDim, colDim, dt, vt, et, false);
@@ -54,7 +52,6 @@ public class RightIndex extends Lop
public RightIndex(Lop input, Lop rowL, Lop rowU, Lop colL, Lop colU, Lop rowDim, Lop colDim,
DataType dt, ValueType vt, SparkAggType aggtype, ExecType et)
- throws LopsException
{
super(Lop.Type.RightIndex, dt, vt);
_aggtype = aggtype;
@@ -107,8 +104,7 @@ public class RightIndex extends Lop
}
@Override
- public String getInstructions(String input, String rowl, String rowu, String coll, String colu, String leftRowDim, String leftColDim, String output)
- throws LopsException {
+ public String getInstructions(String input, String rowl, String rowu, String coll, String colu, String leftRowDim, String leftColDim, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( OPERAND_DELIMITOR );
@@ -155,8 +151,7 @@ public class RightIndex extends Lop
}
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int input_index6, int input_index7, int output_index)
- throws LopsException {
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int input_index6, int input_index7, int output_index) {
/*
* Example: B = A[row_l:row_u, col_l:col_u]
* A - input matrix (input_index1)
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/SpoofFused.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/SpoofFused.java b/src/main/java/org/apache/sysml/lops/SpoofFused.java
index 3f0ec59..c4689c1 100644
--- a/src/main/java/org/apache/sysml/lops/SpoofFused.java
+++ b/src/main/java/org/apache/sysml/lops/SpoofFused.java
@@ -52,49 +52,47 @@ public class SpoofFused extends Lop
}
@Override
- public String getInstructions(String input1, String output) throws LopsException {
+ public String getInstructions(String input1, String output) {
return getInstructions(new String[]{input1}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String output) {
return getInstructions(new String[]{input1, input2}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String output) {
return getInstructions(new String[]{input1, input2, input3}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String output) {
return getInstructions(new String[]{input1, input2, input3, input4}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String output) {
return getInstructions(new String[]{input1, input2, input3, input4, input5}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String output) {
return getInstructions(new String[]{input1, input2, input3, input4, input5, input6}, new String[]{output});
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) throws LopsException {
+ public String getInstructions(String input1, String input2, String input3, String input4, String input5, String input6, String input7, String output) {
return getInstructions(new String[]{input1, input2, input3, input4, input5, input6, input7}, new String[]{output});
}
@Override
- public String getInstructions(String[] inputs, String output) throws LopsException {
+ public String getInstructions(String[] inputs, String output) {
return getInstructions(inputs, new String[]{output});
}
@Override
- public String getInstructions(String[] inputs, String[] outputs)
- throws LopsException
- {
+ public String getInstructions(String[] inputs, String[] outputs) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( OPERAND_DELIMITOR );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/TernaryAggregate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/TernaryAggregate.java b/src/main/java/org/apache/sysml/lops/TernaryAggregate.java
index 08600e4..18e0881 100644
--- a/src/main/java/org/apache/sysml/lops/TernaryAggregate.java
+++ b/src/main/java/org/apache/sysml/lops/TernaryAggregate.java
@@ -69,7 +69,7 @@ public class TernaryAggregate extends Lop
@Override
public String getInstructions(String input1, String input2, String input3, String output)
- throws LopsException
+
{
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Transform.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Transform.java b/src/main/java/org/apache/sysml/lops/Transform.java
index 07cc91e..1de2a9c 100644
--- a/src/main/java/org/apache/sysml/lops/Transform.java
+++ b/src/main/java/org/apache/sysml/lops/Transform.java
@@ -167,9 +167,7 @@ public class Transform extends Lop
//CP instructions
@Override
- public String getInstructions(String input1, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( OPERAND_DELIMITOR );
@@ -188,9 +186,7 @@ public class Transform extends Lop
}
@Override
- public String getInstructions(String input1, String input2, String input3, String input4, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String input3, String input4, String output) {
//only used for reshape
StringBuilder sb = new StringBuilder();
@@ -224,9 +220,7 @@ public class Transform extends Lop
//MR instructions
@Override
- public String getInstructions(int input_index, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index, int output_index) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( OPERAND_DELIMITOR );
@@ -240,9 +234,7 @@ public class Transform extends Lop
}
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int output_index)
- throws LopsException
- {
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int output_index) {
//only used for reshape
StringBuilder sb = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/UAggOuterChain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/UAggOuterChain.java b/src/main/java/org/apache/sysml/lops/UAggOuterChain.java
index bdd4e0c..8d5230e 100644
--- a/src/main/java/org/apache/sysml/lops/UAggOuterChain.java
+++ b/src/main/java/org/apache/sysml/lops/UAggOuterChain.java
@@ -55,12 +55,10 @@ public class UAggOuterChain extends Lop
* @param dt data type
* @param vt value type
* @param et execution type
- * @throws LopsException if LopsException occurs
*/
public UAggOuterChain(Lop input1, Lop input2, Aggregate.OperationTypes uaop, PartialAggregate.DirectionTypes uadir, Binary.OperationTypes bop, DataType dt, ValueType vt, ExecType et)
- throws LopsException
{
- super(Lop.Type.UaggOuterChain, dt, vt);
+ super(Lop.Type.UaggOuterChain, dt, vt);
addInput(input1);
addInput(input2);
input1.addOutput(this);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/Unary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/Unary.java b/src/main/java/org/apache/sysml/lops/Unary.java
index 880181c..7c1ceeb 100644
--- a/src/main/java/org/apache/sysml/lops/Unary.java
+++ b/src/main/java/org/apache/sysml/lops/Unary.java
@@ -113,19 +113,14 @@ public class Unary extends Lop
* @param vt value type
* @param et execution type
* @param numThreads number of threads
- * @throws LopsException if LopsException occurs
*/
- public Unary(Lop input1, OperationTypes op, DataType dt, ValueType vt, ExecType et, int numThreads)
- throws LopsException
- {
+ public Unary(Lop input1, OperationTypes op, DataType dt, ValueType vt, ExecType et, int numThreads) {
super(Lop.Type.UNARY, dt, vt);
init(input1, op, dt, vt, et);
_numThreads = numThreads;
}
- private void init(Lop input1, OperationTypes op, DataType dt, ValueType vt, ExecType et)
- throws LopsException
- {
+ private void init(Lop input1, OperationTypes op, DataType dt, ValueType vt, ExecType et) {
//sanity check
if ( (op == OperationTypes.INVERSE || op == OperationTypes.CHOLESKY)
&& (et == ExecType.SPARK || et == ExecType.MR) ) {
@@ -169,15 +164,11 @@ public class Unary extends Lop
return "Operation: " + operation + " " + "Label: N/A";
}
- private String getOpcode()
- throws LopsException
- {
+ private String getOpcode() {
return getOpcode(operation);
}
- public static String getOpcode(OperationTypes op)
- throws LopsException
- {
+ public static String getOpcode(OperationTypes op) {
switch (op) {
case NOT:
return "!";
@@ -342,9 +333,7 @@ public class Unary extends Lop
}
@Override
- public String getInstructions(String input1, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String output) {
//sanity check number of operands
if( getInputs().size() != 1 ) {
throw new LopsException(printErrorLocation() + "Invalid number of operands ("
@@ -371,14 +360,12 @@ public class Unary extends Lop
}
@Override
- public String getInstructions(int input_index, int output_index) throws LopsException {
+ public String getInstructions(int input_index, int output_index) {
return getInstructions(String.valueOf(input_index), String.valueOf(output_index));
}
@Override
- public String getInstructions(String input1, String input2, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
@@ -404,8 +391,7 @@ public class Unary extends Lop
}
@Override
- public String getInstructions(int inputIndex1, int inputIndex2,
- int outputIndex) throws LopsException {
+ public String getInstructions(int inputIndex1, int inputIndex2, int outputIndex) {
if (this.getInputs().size() == 2) {
// Unary operators with two inputs
// Determine the correct operation, depending on the scalar input
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/UnaryCP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/UnaryCP.java b/src/main/java/org/apache/sysml/lops/UnaryCP.java
index a444178..26e1731 100644
--- a/src/main/java/org/apache/sysml/lops/UnaryCP.java
+++ b/src/main/java/org/apache/sysml/lops/UnaryCP.java
@@ -85,7 +85,7 @@ public class UnaryCP extends Lop
}
- private String getOpCode() throws LopsException {
+ private String getOpCode() {
switch (operation) {
case NOT:
return "!";
@@ -188,8 +188,7 @@ public class UnaryCP extends Lop
}
@Override
- public String getInstructions(String input, String output)
- throws LopsException {
+ public String getInstructions(String input, String output) {
StringBuilder sb = new StringBuilder();
sb.append(getExecType());
sb.append( OPERAND_DELIMITOR );
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedCrossEntropy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedCrossEntropy.java b/src/main/java/org/apache/sysml/lops/WeightedCrossEntropy.java
index 5249eae..fafba3a 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedCrossEntropy.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedCrossEntropy.java
@@ -42,10 +42,8 @@ public class WeightedCrossEntropy extends Lop
private WCeMMType _wcemmType = null;
- public WeightedCrossEntropy(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WCeMMType wt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedCeMM, dt, vt);
+ public WeightedCrossEntropy(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WCeMMType wt, ExecType et) {
+ super(Lop.Type.WeightedCeMM, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedCrossEntropyR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedCrossEntropyR.java b/src/main/java/org/apache/sysml/lops/WeightedCrossEntropyR.java
index 228b9d7..d019883 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedCrossEntropyR.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedCrossEntropyR.java
@@ -36,10 +36,8 @@ public class WeightedCrossEntropyR extends Lop
private boolean _cacheU = false;
private boolean _cacheV = false;
- public WeightedCrossEntropyR(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WCeMMType wt, boolean cacheU, boolean cacheV, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedCeMM, dt, vt);
+ public WeightedCrossEntropyR(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WCeMMType wt, boolean cacheU, boolean cacheV, ExecType et) {
+ super(Lop.Type.WeightedCeMM, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
@@ -56,9 +54,7 @@ public class WeightedCrossEntropyR extends Lop
setupLopProperties(et);
}
- private void setupLopProperties( ExecType et )
- throws LopsException
- {
+ private void setupLopProperties( ExecType et ) {
if( et == ExecType.MR )
{
//setup MR parameters
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedDivMM.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedDivMM.java b/src/main/java/org/apache/sysml/lops/WeightedDivMM.java
index 758ef9e..48169e2 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedDivMM.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedDivMM.java
@@ -82,10 +82,8 @@ public class WeightedDivMM extends Lop
private WDivMMType _weightsType = null;
- public WeightedDivMM(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WDivMMType wt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedDivMM, dt, vt);
+ public WeightedDivMM(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WDivMMType wt, ExecType et) {
+ super(Lop.Type.WeightedDivMM, dt, vt);
addInput(input1); //W
addInput(input2); //U
addInput(input3); //V
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedDivMMR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedDivMMR.java b/src/main/java/org/apache/sysml/lops/WeightedDivMMR.java
index 648551b..bcda7e8 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedDivMMR.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedDivMMR.java
@@ -34,10 +34,8 @@ public class WeightedDivMMR extends Lop
private boolean _cacheU = false;
private boolean _cacheV = false;
- public WeightedDivMMR(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WDivMMType wt, boolean cacheU, boolean cacheV, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedDivMM, dt, vt);
+ public WeightedDivMMR(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WDivMMType wt, boolean cacheU, boolean cacheV, ExecType et) {
+ super(Lop.Type.WeightedDivMM, dt, vt);
addInput(input1); //W
addInput(input2); //U
addInput(input3); //V
@@ -53,9 +51,7 @@ public class WeightedDivMMR extends Lop
setupLopProperties(et);
}
- private void setupLopProperties( ExecType et )
- throws LopsException
- {
+ private void setupLopProperties( ExecType et ) {
if( et == ExecType.MR )
{
//setup MR parameters
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedSigmoid.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedSigmoid.java b/src/main/java/org/apache/sysml/lops/WeightedSigmoid.java
index 3dcc930..0618d2d 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedSigmoid.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedSigmoid.java
@@ -41,10 +41,8 @@ public class WeightedSigmoid extends Lop
private WSigmoidType _wsigmoidType = null;
- public WeightedSigmoid(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WSigmoidType wt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedSigmoid, dt, vt);
+ public WeightedSigmoid(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WSigmoidType wt, ExecType et) {
+ super(Lop.Type.WeightedSigmoid, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedSigmoidR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedSigmoidR.java b/src/main/java/org/apache/sysml/lops/WeightedSigmoidR.java
index 9778168..8df25f4 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedSigmoidR.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedSigmoidR.java
@@ -35,14 +35,12 @@ public class WeightedSigmoidR extends Lop
private boolean _cacheU = false;
private boolean _cacheV = false;
- public WeightedSigmoidR(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WSigmoidType wt, boolean cacheU, boolean cacheV, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedSigmoid, dt, vt);
+ public WeightedSigmoidR(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WSigmoidType wt, boolean cacheU, boolean cacheV, ExecType et) {
+ super(Lop.Type.WeightedSigmoid, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
- input1.addOutput(this);
+ input1.addOutput(this);
input2.addOutput(this);
input3.addOutput(this);
@@ -53,9 +51,7 @@ public class WeightedSigmoidR extends Lop
setupLopProperties(et);
}
- private void setupLopProperties( ExecType et )
- throws LopsException
- {
+ private void setupLopProperties( ExecType et ) {
if( et == ExecType.MR )
{
//setup MR parameters
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedSquaredLoss.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedSquaredLoss.java b/src/main/java/org/apache/sysml/lops/WeightedSquaredLoss.java
index 84de064..83c2c05 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedSquaredLoss.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedSquaredLoss.java
@@ -44,15 +44,13 @@ public class WeightedSquaredLoss extends Lop
private WeightsType _weightsType = null;
- public WeightedSquaredLoss(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WeightsType wt, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedSquaredLoss, dt, vt);
+ public WeightedSquaredLoss(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WeightsType wt, ExecType et) {
+ super(Lop.Type.WeightedSquaredLoss, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
addInput(input4); //W
- input1.addOutput(this);
+ input1.addOutput(this);
input2.addOutput(this);
input3.addOutput(this);
input4.addOutput(this);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedSquaredLossR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedSquaredLossR.java b/src/main/java/org/apache/sysml/lops/WeightedSquaredLossR.java
index 6d7127a..b3c1e29 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedSquaredLossR.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedSquaredLossR.java
@@ -34,10 +34,8 @@ public class WeightedSquaredLossR extends Lop
private boolean _cacheU = false;
private boolean _cacheV = false;
- public WeightedSquaredLossR(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WeightsType wt, boolean cacheU, boolean cacheV, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedSquaredLoss, dt, vt);
+ public WeightedSquaredLossR(Lop input1, Lop input2, Lop input3, Lop input4, DataType dt, ValueType vt, WeightsType wt, boolean cacheU, boolean cacheV, ExecType et) {
+ super(Lop.Type.WeightedSquaredLoss, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
@@ -54,9 +52,7 @@ public class WeightedSquaredLossR extends Lop
setupLopProperties(et);
}
- private void setupLopProperties( ExecType et )
- throws LopsException
- {
+ private void setupLopProperties( ExecType et ) {
if( et == ExecType.MR )
{
//setup MR parameters
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedUnaryMM.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedUnaryMM.java b/src/main/java/org/apache/sysml/lops/WeightedUnaryMM.java
index 8d120af..4b71226 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedUnaryMM.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedUnaryMM.java
@@ -40,14 +40,12 @@ public class WeightedUnaryMM extends Lop
private OperationTypes _uop = null;
private int _numThreads = 1;
- public WeightedUnaryMM(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WUMMType wt, OperationTypes op, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedUMM, dt, vt);
+ public WeightedUnaryMM(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WUMMType wt, OperationTypes op, ExecType et) {
+ super(Lop.Type.WeightedUMM, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
- input1.addOutput(this);
+ input1.addOutput(this);
input2.addOutput(this);
input3.addOutput(this);
@@ -86,9 +84,7 @@ public class WeightedUnaryMM extends Lop
}
@Override
- public String getInstructions(int input1, int input2, int input3, int output)
- throws LopsException
- {
+ public String getInstructions(int input1, int input2, int input3, int output) {
return getInstructions(
String.valueOf(input1),
String.valueOf(input2),
@@ -97,9 +93,7 @@ public class WeightedUnaryMM extends Lop
}
@Override
- public String getInstructions(String input1, String input2, String input3, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String input3, String output) {
StringBuilder sb = new StringBuilder();
sb.append(getExecType());
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/WeightedUnaryMMR.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/WeightedUnaryMMR.java b/src/main/java/org/apache/sysml/lops/WeightedUnaryMMR.java
index 0a91034..85d55cd 100644
--- a/src/main/java/org/apache/sysml/lops/WeightedUnaryMMR.java
+++ b/src/main/java/org/apache/sysml/lops/WeightedUnaryMMR.java
@@ -36,10 +36,8 @@ public class WeightedUnaryMMR extends Lop
private boolean _cacheU = false;
private boolean _cacheV = false;
- public WeightedUnaryMMR(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WUMMType wt, OperationTypes op, boolean cacheU, boolean cacheV, ExecType et)
- throws LopsException
- {
- super(Lop.Type.WeightedUMM, dt, vt);
+ public WeightedUnaryMMR(Lop input1, Lop input2, Lop input3, DataType dt, ValueType vt, WUMMType wt, OperationTypes op, boolean cacheU, boolean cacheV, ExecType et) {
+ super(Lop.Type.WeightedUMM, dt, vt);
addInput(input1); //X
addInput(input2); //U
addInput(input3); //V
@@ -55,9 +53,7 @@ public class WeightedUnaryMMR extends Lop
setupLopProperties(et);
}
- private void setupLopProperties( ExecType et )
- throws LopsException
- {
+ private void setupLopProperties( ExecType et ) {
if( et == ExecType.MR )
{
//setup MR parameters
@@ -85,9 +81,7 @@ public class WeightedUnaryMMR extends Lop
}
@Override
- public String getInstructions(int input1, int input2, int input3, int output)
- throws LopsException
- {
+ public String getInstructions(int input1, int input2, int input3, int output) {
return getInstructions(
String.valueOf(input1),
String.valueOf(input2),
@@ -96,9 +90,7 @@ public class WeightedUnaryMMR extends Lop
}
@Override
- public String getInstructions(String input1, String input2, String input3, String output)
- throws LopsException
- {
+ public String getInstructions(String input1, String input2, String input3, String output) {
StringBuilder sb = new StringBuilder();
sb.append(getExecType());
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/ZeroOut.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/lops/ZeroOut.java b/src/main/java/org/apache/sysml/lops/ZeroOut.java
index 20bc766..8db436a 100644
--- a/src/main/java/org/apache/sysml/lops/ZeroOut.java
+++ b/src/main/java/org/apache/sysml/lops/ZeroOut.java
@@ -60,9 +60,8 @@ public class ZeroOut extends Lop
}
}
- public ZeroOut(
- Lop input, Lop rowL, Lop rowU, Lop colL, Lop colU, long rowDim, long colDim, DataType dt, ValueType vt, ExecType et)
- throws LopsException {
+ public ZeroOut(Lop input, Lop rowL, Lop rowU, Lop colL, Lop colU, long rowDim,
+ long colDim, DataType dt, ValueType vt, ExecType et) {
super(Lop.Type.ZeroOut, dt, vt);
init(input, rowL, rowU, colL, colU, rowDim, colDim, dt, vt, et);
}
@@ -72,9 +71,7 @@ public class ZeroOut extends Lop
}
@Override
- public String getInstructions(String input, String rowl, String rowu, String coll, String colu, String output)
- throws LopsException
- {
+ public String getInstructions(String input, String rowl, String rowu, String coll, String colu, String output) {
StringBuilder sb = new StringBuilder();
sb.append( getExecType() );
sb.append( OPERAND_DELIMITOR );
@@ -101,25 +98,11 @@ public class ZeroOut extends Lop
}
@Override
- public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int output_index)
- throws LopsException {
- /*
- * Example: B = A[row_l:row_u, col_l:col_u]
- * A - input matrix (input_index1)
- * row_l - lower bound in row dimension
- * row_u - upper bound in row dimension
- * col_l - lower bound in column dimension
- * col_u - upper bound in column dimension
- *
- * Since row_l,row_u,col_l,col_u are scalars, values for input_index(2,3,4,5)
- * will be equal to -1. They should be ignored and the scalar value labels must
- * be derived from input lops.
- */
-
+ public String getInstructions(int input_index1, int input_index2, int input_index3, int input_index4, int input_index5, int output_index) {
return getInstructions(
- String.valueOf(input_index1), String.valueOf(input_index2),
- String.valueOf(input_index3), String.valueOf(input_index4),
- String.valueOf(input_index5), String.valueOf(output_index));
+ String.valueOf(input_index1), String.valueOf(input_index2),
+ String.valueOf(input_index3), String.valueOf(input_index4),
+ String.valueOf(input_index5), String.valueOf(output_index));
}
@Override
[10/10] systemml git commit: [SYSTEMML-2191] Cleanup exception
hierarchy and handling, part 1
Posted by mb...@apache.org.
[SYSTEMML-2191] Cleanup exception hierarchy and handling, part 1
This patch converts the entire DMLException hierarchy to runtime
exceptions to ease the APIs and internal handling, removes unnecessary
exceptions such as the CacheException, and removes unnecessary throws
clauses and their useless java doc.
Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/215a1cc6
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/215a1cc6
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/215a1cc6
Branch: refs/heads/master
Commit: 215a1cc6b36ed1f6db5bf1e77b19c7928150ddec
Parents: 2b74a79
Author: Matthias Boehm <mb...@gmail.com>
Authored: Fri Mar 23 22:16:20 2018 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Fri Mar 23 22:18:28 2018 -0700
----------------------------------------------------------------------
.../java/org/apache/sysml/api/DMLException.java | 37 ++-
.../java/org/apache/sysml/api/DMLScript.java | 22 +-
.../apache/sysml/api/ScriptExecutorUtils.java | 9 +-
.../api/mlcontext/MLContextConversionUtil.java | 260 +++++++++----------
.../sysml/api/mlcontext/MLContextUtil.java | 21 +-
.../sysml/api/mlcontext/ScriptExecutor.java | 6 +-
.../java/org/apache/sysml/conf/DMLConfig.java | 21 +-
.../sysml/debug/DMLDebuggerFunctions.java | 6 +-
.../java/org/apache/sysml/debug/DebugState.java | 3 +-
.../java/org/apache/sysml/hops/AggBinaryOp.java | 106 +++-----
.../java/org/apache/sysml/hops/AggUnaryOp.java | 12 +-
.../java/org/apache/sysml/hops/BinaryOp.java | 33 +--
.../org/apache/sysml/hops/ConvolutionOp.java | 12 +-
.../java/org/apache/sysml/hops/DataGenOp.java | 9 +-
src/main/java/org/apache/sysml/hops/DataOp.java | 6 +-
.../java/org/apache/sysml/hops/FunctionOp.java | 5 +-
src/main/java/org/apache/sysml/hops/Hop.java | 24 +-
.../org/apache/sysml/hops/HopsException.java | 6 +-
.../java/org/apache/sysml/hops/IndexingOp.java | 10 +-
.../org/apache/sysml/hops/LeftIndexingOp.java | 10 +-
.../java/org/apache/sysml/hops/LiteralOp.java | 11 +-
src/main/java/org/apache/sysml/hops/NaryOp.java | 12 +-
.../org/apache/sysml/hops/OptimizerUtils.java | 13 +-
.../sysml/hops/ParameterizedBuiltinOp.java | 10 +-
.../org/apache/sysml/hops/QuaternaryOp.java | 35 +--
.../java/org/apache/sysml/hops/ReorgOp.java | 8 +-
.../java/org/apache/sysml/hops/TernaryOp.java | 32 +--
.../java/org/apache/sysml/hops/UnaryOp.java | 19 +-
.../sysml/hops/codegen/SpoofCompiler.java | 34 +--
.../apache/sysml/hops/codegen/SpoofFusedOp.java | 8 +-
.../sysml/hops/cost/CostEstimationWrapper.java | 4 +-
.../apache/sysml/hops/cost/CostEstimator.java | 27 +-
.../hops/cost/CostEstimatorStaticRuntime.java | 32 +--
.../sysml/hops/ipa/FunctionCallGraph.java | 4 +-
.../sysml/hops/ipa/FunctionCallSizeInfo.java | 12 +-
.../java/org/apache/sysml/hops/ipa/IPAPass.java | 5 +-
.../hops/ipa/IPAPassApplyStaticHopRewrites.java | 4 +-
.../ipa/IPAPassFlagFunctionsRecompileOnce.java | 1 -
.../sysml/hops/ipa/IPAPassInlineFunctions.java | 2 -
.../ipa/IPAPassPropagateReplaceLiterals.java | 10 +-
.../ipa/IPAPassRemoveConstantBinaryOps.java | 9 +-
.../IPAPassRemoveUnnecessaryCheckpoints.java | 17 +-
.../hops/ipa/IPAPassRemoveUnusedFunctions.java | 4 +-
.../sysml/hops/ipa/InterProceduralAnalysis.java | 48 +---
.../hops/recompile/LiteralReplacement.java | 22 +-
.../apache/sysml/hops/recompile/Recompiler.java | 61 +----
.../sysml/hops/rewrite/HopDagValidator.java | 4 +-
.../sysml/hops/rewrite/HopRewriteRule.java | 11 +-
.../sysml/hops/rewrite/HopRewriteUtils.java | 106 ++------
.../sysml/hops/rewrite/ProgramRewriter.java | 28 +-
.../RewriteAlgebraicSimplificationDynamic.java | 66 +----
.../RewriteAlgebraicSimplificationStatic.java | 37 +--
.../rewrite/RewriteBlockSizeAndReblock.java | 3 -
.../RewriteCommonSubexpressionElimination.java | 8 +-
.../hops/rewrite/RewriteCompressedReblock.java | 16 +-
.../hops/rewrite/RewriteConstantFolding.java | 38 +--
...RewriteElementwiseMultChainOptimization.java | 5 +-
.../rewrite/RewriteForLoopVectorization.java | 9 +-
.../rewrite/RewriteIndexingVectorization.java | 24 +-
.../RewriteInjectSparkLoopCheckpointing.java | 5 +-
.../RewriteInjectSparkPReadCheckpointing.java | 10 +-
.../RewriteMarkLoopVariablesUpdateInPlace.java | 6 +-
.../RewriteMatrixMultChainOptimization.java | 10 +-
.../hops/rewrite/RewriteMergeBlockSequence.java | 12 +-
.../RewriteRemoveDanglingParentReferences.java | 13 +-
.../rewrite/RewriteRemoveEmptyBasicBlocks.java | 8 +-
.../RewriteRemovePersistentReadWrite.java | 17 +-
.../rewrite/RewriteRemoveReadAfterWrite.java | 11 +-
.../RewriteRemoveUnnecessaryBranches.java | 5 +-
.../rewrite/RewriteRemoveUnnecessaryCasts.java | 14 +-
.../RewriteSplitDagDataDependentOperators.java | 4 +-
.../rewrite/RewriteSplitDagUnknownCSVRead.java | 5 +-
.../RewriteTransientWriteParentHandling.java | 14 +-
.../hops/rewrite/StatementBlockRewriteRule.java | 9 +-
.../java/org/apache/sysml/lops/Aggregate.java | 3 +-
src/main/java/org/apache/sysml/lops/Append.java | 4 +-
.../java/org/apache/sysml/lops/AppendG.java | 8 +-
.../org/apache/sysml/lops/AppendGAlignedSP.java | 1 -
.../java/org/apache/sysml/lops/AppendM.java | 8 +-
.../java/org/apache/sysml/lops/AppendR.java | 8 +-
src/main/java/org/apache/sysml/lops/Binary.java | 6 +-
.../java/org/apache/sysml/lops/BinaryM.java | 23 +-
.../org/apache/sysml/lops/BinaryScalar.java | 3 +-
.../org/apache/sysml/lops/BinaryUAggChain.java | 7 +-
.../java/org/apache/sysml/lops/CSVReBlock.java | 8 +-
.../java/org/apache/sysml/lops/Checkpoint.java | 11 +-
.../java/org/apache/sysml/lops/CoVariance.java | 10 +-
.../org/apache/sysml/lops/CombineBinary.java | 4 +-
.../org/apache/sysml/lops/CombineTernary.java | 3 +-
.../org/apache/sysml/lops/CombineUnary.java | 4 +-
.../java/org/apache/sysml/lops/Compression.java | 11 +-
.../apache/sysml/lops/ConvolutionTransform.java | 6 +-
src/main/java/org/apache/sysml/lops/Ctable.java | 4 +-
.../sysml/lops/CumulativeOffsetBinary.java | 8 +-
.../sysml/lops/CumulativePartialAggregate.java | 4 +-
.../sysml/lops/CumulativeSplitAggregate.java | 4 +-
src/main/java/org/apache/sysml/lops/Data.java | 35 +--
.../java/org/apache/sysml/lops/DataGen.java | 29 +--
.../org/apache/sysml/lops/DataPartition.java | 3 +-
.../org/apache/sysml/lops/FunctionCallCP.java | 7 +-
.../apache/sysml/lops/FunctionCallCPSingle.java | 16 +-
.../org/apache/sysml/lops/GroupedAggregate.java | 4 +-
.../java/org/apache/sysml/lops/LeftIndex.java | 12 +-
src/main/java/org/apache/sysml/lops/Lop.java | 52 ++--
.../java/org/apache/sysml/lops/MapMult.java | 11 +-
.../org/apache/sysml/lops/MapMultChain.java | 14 +-
src/main/java/org/apache/sysml/lops/Nary.java | 7 +-
.../org/apache/sysml/lops/OutputParameters.java | 4 +-
src/main/java/org/apache/sysml/lops/PMMJ.java | 7 +-
.../java/org/apache/sysml/lops/PMapMult.java | 6 +-
.../apache/sysml/lops/ParameterizedBuiltin.java | 22 +-
.../org/apache/sysml/lops/PartialAggregate.java | 17 +-
.../java/org/apache/sysml/lops/PickByCount.java | 11 +-
.../java/org/apache/sysml/lops/ReBlock.java | 4 +-
src/main/java/org/apache/sysml/lops/RepMat.java | 7 +-
.../java/org/apache/sysml/lops/RightIndex.java | 9 +-
.../java/org/apache/sysml/lops/SpoofFused.java | 20 +-
.../org/apache/sysml/lops/TernaryAggregate.java | 2 +-
.../java/org/apache/sysml/lops/Transform.java | 16 +-
.../org/apache/sysml/lops/UAggOuterChain.java | 4 +-
src/main/java/org/apache/sysml/lops/Unary.java | 30 +--
.../java/org/apache/sysml/lops/UnaryCP.java | 5 +-
.../apache/sysml/lops/WeightedCrossEntropy.java | 6 +-
.../sysml/lops/WeightedCrossEntropyR.java | 10 +-
.../org/apache/sysml/lops/WeightedDivMM.java | 6 +-
.../org/apache/sysml/lops/WeightedDivMMR.java | 10 +-
.../org/apache/sysml/lops/WeightedSigmoid.java | 6 +-
.../org/apache/sysml/lops/WeightedSigmoidR.java | 12 +-
.../apache/sysml/lops/WeightedSquaredLoss.java | 8 +-
.../apache/sysml/lops/WeightedSquaredLossR.java | 10 +-
.../org/apache/sysml/lops/WeightedUnaryMM.java | 16 +-
.../org/apache/sysml/lops/WeightedUnaryMMR.java | 18 +-
.../java/org/apache/sysml/lops/ZeroOut.java | 31 +--
.../java/org/apache/sysml/lops/compile/Dag.java | 91 ++-----
.../org/apache/sysml/lops/compile/JobType.java | 5 +-
.../apache/sysml/lops/runtime/RunMRJobs.java | 17 +-
.../sysml/parser/AssignmentStatement.java | 6 +-
.../apache/sysml/parser/BinaryExpression.java | 9 +-
.../apache/sysml/parser/BooleanExpression.java | 4 +-
.../apache/sysml/parser/BooleanIdentifier.java | 2 +-
.../sysml/parser/BuiltinFunctionExpression.java | 68 ++---
.../apache/sysml/parser/ConstIdentifier.java | 4 +-
.../org/apache/sysml/parser/DMLProgram.java | 10 +-
.../org/apache/sysml/parser/DMLTranslator.java | 154 ++++-------
.../org/apache/sysml/parser/DataExpression.java | 27 +-
.../org/apache/sysml/parser/DataIdentifier.java | 5 +-
.../apache/sysml/parser/DoubleIdentifier.java | 2 +-
.../org/apache/sysml/parser/Expression.java | 31 +--
.../org/apache/sysml/parser/ExpressionList.java | 2 +-
.../sysml/parser/ExternalFunctionStatement.java | 7 +-
.../org/apache/sysml/parser/ForStatement.java | 6 +-
.../apache/sysml/parser/ForStatementBlock.java | 17 +-
.../sysml/parser/FunctionCallIdentifier.java | 6 +-
.../apache/sysml/parser/FunctionStatement.java | 6 +-
.../sysml/parser/FunctionStatementBlock.java | 11 +-
.../org/apache/sysml/parser/Identifier.java | 1 -
.../org/apache/sysml/parser/IfStatement.java | 8 +-
.../apache/sysml/parser/IfStatementBlock.java | 15 +-
.../apache/sysml/parser/ImportStatement.java | 2 +-
.../apache/sysml/parser/IndexedIdentifier.java | 7 +-
.../org/apache/sysml/parser/IntIdentifier.java | 2 +-
.../apache/sysml/parser/IterablePredicate.java | 7 +-
.../sysml/parser/LiveVariableAnalysis.java | 6 +-
.../sysml/parser/MultiAssignmentStatement.java | 3 +-
.../apache/sysml/parser/OutputStatement.java | 14 +-
.../sysml/parser/ParForStatementBlock.java | 34 +--
.../ParameterizedBuiltinFunctionExpression.java | 35 +--
.../org/apache/sysml/parser/ParserWrapper.java | 3 +-
.../org/apache/sysml/parser/PathStatement.java | 2 +-
.../org/apache/sysml/parser/PrintStatement.java | 13 +-
.../sysml/parser/RelationalExpression.java | 13 +-
.../java/org/apache/sysml/parser/Statement.java | 10 +-
.../org/apache/sysml/parser/StatementBlock.java | 35 +--
.../apache/sysml/parser/StringIdentifier.java | 6 +-
.../org/apache/sysml/parser/WhileStatement.java | 8 +-
.../sysml/parser/WhileStatementBlock.java | 13 +-
.../sysml/parser/dml/DMLParserWrapper.java | 6 +-
.../sysml/parser/pydml/PyDMLParserWrapper.java | 6 +-
.../controlprogram/ParForProgramBlock.java | 2 -
.../controlprogram/caching/CacheException.java | 50 ----
.../controlprogram/caching/CacheableData.java | 193 ++++++--------
.../controlprogram/caching/FrameObject.java | 4 +-
.../controlprogram/caching/MatrixObject.java | 27 +-
.../parfor/ResultMergeLocalFile.java | 3 +-
.../parfor/opt/OptTreePlanChecker.java | 1 -
.../parfor/opt/ProgramRecompiler.java | 3 -
.../instructions/cp/ScalarObjectFactory.java | 3 +-
.../ParameterizedBuiltinCPFileInstruction.java | 10 +-
.../instructions/gpu/context/GPUObject.java | 47 ++--
.../org/apache/sysml/udf/lib/CumSumProd.java | 92 +++----
.../apache/sysml/udf/lib/MultiInputCbind.java | 127 +++++----
.../apache/sysml/udf/lib/SGDNesterovUpdate.java | 3 -
.../java/org/apache/sysml/utils/Explain.java | 45 +---
.../org/apache/sysml/utils/MLContextProxy.java | 5 +-
.../org/apache/sysml/yarn/DMLYarnClient.java | 3 +-
.../sysml/yarn/ropt/GridEnumerationMemory.java | 8 +-
.../apache/sysml/yarn/ropt/ResourceConfig.java | 25 +-
.../sysml/yarn/ropt/ResourceOptimizer.java | 10 +-
.../yarn/ropt/ResourceOptimizerCPMigration.java | 246 +-----------------
199 files changed, 1101 insertions(+), 2740 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/api/DMLException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/DMLException.java b/src/main/java/org/apache/sysml/api/DMLException.java
index 7da5aef..b585c11 100644
--- a/src/main/java/org/apache/sysml/api/DMLException.java
+++ b/src/main/java/org/apache/sysml/api/DMLException.java
@@ -22,26 +22,25 @@ package org.apache.sysml.api;
/**
* <p>Exception occurring in the DML framework.</p>
*/
-public class DMLException extends Exception
+public class DMLException extends RuntimeException
{
-
- public static String ERROR_MSG_DELIMITER = " : ";
-
+ public static final String ERROR_MSG_DELIMITER = " : ";
+
private static final long serialVersionUID = 1L;
- public DMLException() {
- super();
- }
-
- public DMLException(String message) {
- super(message);
- }
-
- public DMLException(Throwable cause) {
- super(cause);
- }
-
- public DMLException(String message, Throwable cause) {
- super(message, cause);
- }
+ public DMLException() {
+ super();
+ }
+
+ public DMLException(String message) {
+ super(message);
+ }
+
+ public DMLException(Throwable cause) {
+ super(cause);
+ }
+
+ public DMLException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/api/DMLScript.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/DMLScript.java b/src/main/java/org/apache/sysml/api/DMLScript.java
index 7e5e1f3..36a23a0 100644
--- a/src/main/java/org/apache/sysml/api/DMLScript.java
+++ b/src/main/java/org/apache/sysml/api/DMLScript.java
@@ -60,12 +60,9 @@ import org.apache.sysml.conf.CompilerConfig;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.conf.DMLConfig;
import org.apache.sysml.debug.DMLDebugger;
-import org.apache.sysml.debug.DMLDebuggerException;
import org.apache.sysml.debug.DMLDebuggerProgramInfo;
-import org.apache.sysml.hops.HopsException;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.lops.Lop;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.parser.DMLProgram;
import org.apache.sysml.parser.DMLTranslator;
import org.apache.sysml.parser.LanguageException;
@@ -456,7 +453,6 @@ public class DMLScript
* @param args arguments
* @return true if success, false otherwise
* @throws DMLException if DMLException occurs
- * @throws ParseException if ParseException occurs
*/
public static boolean executeScript( Configuration conf, String[] args )
throws DMLException
@@ -565,10 +561,9 @@ public class DMLScript
* @param scriptOrFilename script or filename
* @return a string representation of the script
* @throws IOException if error
- * @throws LanguageException if error
*/
protected static String readDMLScript( boolean isFile, String scriptOrFilename )
- throws IOException, LanguageException
+ throws IOException
{
String dmlScriptStr;
@@ -663,15 +658,10 @@ public class DMLScript
* @param argVals map of argument values
* @param allArgs arguments
* @param scriptType type of script (DML or PyDML)
- * @throws ParseException if ParseException occurs
* @throws IOException if IOException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
- * @throws LanguageException if LanguageException occurs
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
private static void execute(String dmlScriptStr, String fnameOptConfig, Map<String,String> argVals, String[] allArgs, ScriptType scriptType)
- throws ParseException, IOException, DMLRuntimeException, LanguageException, HopsException, LopsException
+ throws IOException
{
SCRIPT_TYPE = scriptType;
@@ -774,16 +764,10 @@ public class DMLScript
* @param fnameOptConfig Full path of configuration file for SystemML
* @param argVals Key-value pairs defining arguments of DML script
* @param scriptType type of script (DML or PyDML)
- * @throws ParseException if ParseException occurs
* @throws IOException if IOException occurs
- * @throws DMLRuntimeException if DMLRuntimeException occurs
- * @throws DMLDebuggerException if DMLDebuggerException occurs
- * @throws LanguageException if LanguageException occurs
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
private static void launchDebugger(String dmlScriptStr, String fnameOptConfig, Map<String,String> argVals, ScriptType scriptType)
- throws ParseException, IOException, DMLRuntimeException, DMLDebuggerException, LanguageException, HopsException, LopsException
+ throws IOException
{
DMLDebuggerProgramInfo dbprog = new DMLDebuggerProgramInfo();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/api/ScriptExecutorUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/ScriptExecutorUtils.java b/src/main/java/org/apache/sysml/api/ScriptExecutorUtils.java
index d6258a5..d587f48 100644
--- a/src/main/java/org/apache/sysml/api/ScriptExecutorUtils.java
+++ b/src/main/java/org/apache/sysml/api/ScriptExecutorUtils.java
@@ -44,10 +44,8 @@ public class ScriptExecutorUtils {
* script executor
* @param statisticsMaxHeavyHitters
* maximum number of statistics to print
- * @throws DMLRuntimeException
- * if exception occurs
*/
- public static void executeRuntimeProgram(ScriptExecutor se, int statisticsMaxHeavyHitters) throws DMLRuntimeException {
+ public static void executeRuntimeProgram(ScriptExecutor se, int statisticsMaxHeavyHitters) {
Program prog = se.getRuntimeProgram();
ExecutionContext ec = se.getExecutionContext();
DMLConfig config = se.getConfig();
@@ -67,11 +65,8 @@ public class ScriptExecutorUtils {
* dml configuration
* @param statisticsMaxHeavyHitters
* maximum number of statistics to print
- * @throws DMLRuntimeException
- * if error occurs
*/
- public static void executeRuntimeProgram(Program rtprog, ExecutionContext ec, DMLConfig dmlconf, int statisticsMaxHeavyHitters)
- throws DMLRuntimeException {
+ public static void executeRuntimeProgram(Program rtprog, ExecutionContext ec, DMLConfig dmlconf, int statisticsMaxHeavyHitters) {
// Whether extra statistics useful for developers and others interested
// in digging into performance problems are recorded and displayed
DMLScript.FINEGRAINED_STATISTICS = DMLScript.STATISTICS && dmlconf.getBooleanValue(DMLConfig.EXTRA_FINEGRAINED_STATS);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/api/mlcontext/MLContextConversionUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/mlcontext/MLContextConversionUtil.java b/src/main/java/org/apache/sysml/api/mlcontext/MLContextConversionUtil.java
index 02b07c0..5d2478f 100644
--- a/src/main/java/org/apache/sysml/api/mlcontext/MLContextConversionUtil.java
+++ b/src/main/java/org/apache/sysml/api/mlcontext/MLContextConversionUtil.java
@@ -44,7 +44,6 @@ import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.parser.Expression.ValueType;
import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.controlprogram.caching.CacheException;
import org.apache.sysml.runtime.controlprogram.caching.FrameObject;
import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
import org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext;
@@ -954,58 +953,54 @@ public class MLContextConversionUtil {
* @return the {@code MatrixObject} converted to a {@code List<String>}
*/
public static List<String> matrixObjectToListStringCSV(MatrixObject matrixObject) {
- try {
- MatrixBlock mb = matrixObject.acquireRead();
-
- int rows = mb.getNumRows();
- int cols = mb.getNumColumns();
- List<String> list = new ArrayList<>();
-
- if ( !mb.isEmptyBlock(false) ) {
- if (mb.isInSparseFormat()) {
- Iterator<IJV> iter = mb.getSparseBlockIterator();
- int prevCellRow = -1;
- StringBuilder sb = null;
- while (iter.hasNext()) {
- IJV cell = iter.next();
- int i = cell.getI();
- double v = cell.getV();
- if (i > prevCellRow) {
- if (sb == null) {
- sb = new StringBuilder();
- } else {
- list.add(sb.toString());
- sb = new StringBuilder();
- }
- sb.append(v);
- prevCellRow = i;
- } else if (i == prevCellRow) {
- sb.append(",");
- sb.append(v);
+ MatrixBlock mb = matrixObject.acquireRead();
+
+ int rows = mb.getNumRows();
+ int cols = mb.getNumColumns();
+ List<String> list = new ArrayList<>();
+
+ if ( !mb.isEmptyBlock(false) ) {
+ if (mb.isInSparseFormat()) {
+ Iterator<IJV> iter = mb.getSparseBlockIterator();
+ int prevCellRow = -1;
+ StringBuilder sb = null;
+ while (iter.hasNext()) {
+ IJV cell = iter.next();
+ int i = cell.getI();
+ double v = cell.getV();
+ if (i > prevCellRow) {
+ if (sb == null) {
+ sb = new StringBuilder();
+ } else {
+ list.add(sb.toString());
+ sb = new StringBuilder();
}
+ sb.append(v);
+ prevCellRow = i;
+ } else if (i == prevCellRow) {
+ sb.append(",");
+ sb.append(v);
}
- if (sb != null) {
- list.add(sb.toString());
- }
- } else {
- for (int i = 0; i < rows; i++) {
- StringBuilder sb = new StringBuilder();
- for (int j = 0; j < cols; j++) {
- if (j > 0) {
- sb.append(",");
- }
- sb.append(mb.getValueDenseUnsafe(i, j));
+ }
+ if (sb != null) {
+ list.add(sb.toString());
+ }
+ } else {
+ for (int i = 0; i < rows; i++) {
+ StringBuilder sb = new StringBuilder();
+ for (int j = 0; j < cols; j++) {
+ if (j > 0) {
+ sb.append(",");
}
- list.add(sb.toString());
+ sb.append(mb.getValueDenseUnsafe(i, j));
}
+ list.add(sb.toString());
}
}
-
- matrixObject.release();
- return list;
- } catch (CacheException e) {
- throw new MLContextException("Cache exception while converting matrix object to List<String> CSV format", e);
}
+
+ matrixObject.release();
+ return list;
}
/**
@@ -1018,31 +1013,27 @@ public class MLContextConversionUtil {
* @return the {@code FrameObject} converted to a {@code List<String>}
*/
public static List<String> frameObjectToListStringCSV(FrameObject frameObject, String delimiter) {
- try {
- FrameBlock fb = frameObject.acquireRead();
+ FrameBlock fb = frameObject.acquireRead();
- int rows = fb.getNumRows();
- int cols = fb.getNumColumns();
- List<String> list = new ArrayList<>();
+ int rows = fb.getNumRows();
+ int cols = fb.getNumColumns();
+ List<String> list = new ArrayList<>();
- for (int i = 0; i < rows; i++) {
- StringBuilder sb = new StringBuilder();
- for (int j = 0; j < cols; j++) {
- if (j > 0) {
- sb.append(delimiter);
- }
- if (fb.get(i, j) != null) {
- sb.append(fb.get(i, j));
- }
+ for (int i = 0; i < rows; i++) {
+ StringBuilder sb = new StringBuilder();
+ for (int j = 0; j < cols; j++) {
+ if (j > 0) {
+ sb.append(delimiter);
+ }
+ if (fb.get(i, j) != null) {
+ sb.append(fb.get(i, j));
}
- list.add(sb.toString());
}
-
- frameObject.release();
- return list;
- } catch (CacheException e) {
- throw new MLContextException("Cache exception while converting frame object to List<String> CSV format", e);
+ list.add(sb.toString());
}
+
+ frameObject.release();
+ return list;
}
/**
@@ -1053,50 +1044,45 @@ public class MLContextConversionUtil {
* @return the {@code MatrixObject} converted to a {@code List<String>}
*/
public static List<String> matrixObjectToListStringIJV(MatrixObject matrixObject) {
- try {
- MatrixBlock mb = matrixObject.acquireRead();
-
- int rows = mb.getNumRows();
- int cols = mb.getNumColumns();
- List<String> list = new ArrayList<>();
-
- if (mb.getNonZeros() > 0) {
- if (mb.isInSparseFormat()) {
- Iterator<IJV> iter = mb.getSparseBlockIterator();
- StringBuilder sb = null;
- while (iter.hasNext()) {
- IJV cell = iter.next();
+ MatrixBlock mb = matrixObject.acquireRead();
+
+ int rows = mb.getNumRows();
+ int cols = mb.getNumColumns();
+ List<String> list = new ArrayList<>();
+
+ if (mb.getNonZeros() > 0) {
+ if (mb.isInSparseFormat()) {
+ Iterator<IJV> iter = mb.getSparseBlockIterator();
+ StringBuilder sb = null;
+ while (iter.hasNext()) {
+ IJV cell = iter.next();
+ sb = new StringBuilder();
+ sb.append(cell.getI() + 1);
+ sb.append(" ");
+ sb.append(cell.getJ() + 1);
+ sb.append(" ");
+ sb.append(cell.getV());
+ list.add(sb.toString());
+ }
+ } else {
+ StringBuilder sb = null;
+ for (int i = 0; i < rows; i++) {
+ sb = new StringBuilder();
+ for (int j = 0; j < cols; j++) {
sb = new StringBuilder();
- sb.append(cell.getI() + 1);
+ sb.append(i + 1);
sb.append(" ");
- sb.append(cell.getJ() + 1);
+ sb.append(j + 1);
sb.append(" ");
- sb.append(cell.getV());
+ sb.append(mb.getValueDenseUnsafe(i, j));
list.add(sb.toString());
}
- } else {
- StringBuilder sb = null;
- for (int i = 0; i < rows; i++) {
- sb = new StringBuilder();
- for (int j = 0; j < cols; j++) {
- sb = new StringBuilder();
- sb.append(i + 1);
- sb.append(" ");
- sb.append(j + 1);
- sb.append(" ");
- sb.append(mb.getValueDenseUnsafe(i, j));
- list.add(sb.toString());
- }
- }
}
}
-
- matrixObject.release();
- return list;
- } catch (CacheException e) {
- throw new MLContextException("Cache exception while converting matrix object to List<String> IJV format",
- e);
}
+
+ matrixObject.release();
+ return list;
}
/**
@@ -1107,34 +1093,30 @@ public class MLContextConversionUtil {
* @return the {@code FrameObject} converted to a {@code List<String>}
*/
public static List<String> frameObjectToListStringIJV(FrameObject frameObject) {
- try {
- FrameBlock fb = frameObject.acquireRead();
-
- int rows = fb.getNumRows();
- int cols = fb.getNumColumns();
- List<String> list = new ArrayList<>();
-
- StringBuilder sb = null;
- for (int i = 0; i < rows; i++) {
- sb = new StringBuilder();
- for (int j = 0; j < cols; j++) {
- if (fb.get(i, j) != null) {
- sb = new StringBuilder();
- sb.append(i + 1);
- sb.append(" ");
- sb.append(j + 1);
- sb.append(" ");
- sb.append(fb.get(i, j));
- list.add(sb.toString());
- }
+ FrameBlock fb = frameObject.acquireRead();
+
+ int rows = fb.getNumRows();
+ int cols = fb.getNumColumns();
+ List<String> list = new ArrayList<>();
+
+ StringBuilder sb = null;
+ for (int i = 0; i < rows; i++) {
+ sb = new StringBuilder();
+ for (int j = 0; j < cols; j++) {
+ if (fb.get(i, j) != null) {
+ sb = new StringBuilder();
+ sb.append(i + 1);
+ sb.append(" ");
+ sb.append(j + 1);
+ sb.append(" ");
+ sb.append(fb.get(i, j));
+ list.add(sb.toString());
}
}
-
- frameObject.release();
- return list;
- } catch (CacheException e) {
- throw new MLContextException("Cache exception while converting frame object to List<String> IJV format", e);
}
+
+ frameObject.release();
+ return list;
}
/**
@@ -1145,14 +1127,10 @@ public class MLContextConversionUtil {
* @return the {@code MatrixObject} converted to a {@code double[][]}
*/
public static double[][] matrixObjectTo2DDoubleArray(MatrixObject matrixObject) {
- try {
- MatrixBlock mb = matrixObject.acquireRead();
- double[][] matrix = DataConverter.convertToDoubleMatrix(mb);
- matrixObject.release();
- return matrix;
- } catch (CacheException e) {
- throw new MLContextException("Cache exception while converting matrix object to double matrix", e);
- }
+ MatrixBlock mb = matrixObject.acquireRead();
+ double[][] matrix = DataConverter.convertToDoubleMatrix(mb);
+ matrixObject.release();
+ return matrix;
}
/**
@@ -1257,14 +1235,10 @@ public class MLContextConversionUtil {
* @return the {@code FrameObject} converted to a {@code String[][]}
*/
public static String[][] frameObjectTo2DStringArray(FrameObject frameObject) {
- try {
- FrameBlock fb = frameObject.acquireRead();
- String[][] frame = DataConverter.convertToStringFrame(fb);
- frameObject.release();
- return frame;
- } catch (CacheException e) {
- throw new MLContextException("CacheException while converting frame object to 2D string array", e);
- }
+ FrameBlock fb = frameObject.acquireRead();
+ String[][] frame = DataConverter.convertToStringFrame(fb);
+ frameObject.release();
+ return frame;
}
/**
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/api/mlcontext/MLContextUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/mlcontext/MLContextUtil.java b/src/main/java/org/apache/sysml/api/mlcontext/MLContextUtil.java
index af99ab1..dcf4595 100644
--- a/src/main/java/org/apache/sysml/api/mlcontext/MLContextUtil.java
+++ b/src/main/java/org/apache/sysml/api/mlcontext/MLContextUtil.java
@@ -54,11 +54,8 @@ import org.apache.sysml.conf.CompilerConfig;
import org.apache.sysml.conf.CompilerConfig.ConfigType;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.conf.DMLConfig;
-import org.apache.sysml.hops.HopsException;
-import org.apache.sysml.parser.LanguageException;
import org.apache.sysml.parser.ParseException;
import org.apache.sysml.parser.Statement;
-import org.apache.sysml.runtime.DMLRuntimeException;
import org.apache.sysml.runtime.controlprogram.ForProgramBlock;
import org.apache.sysml.runtime.controlprogram.FunctionProgramBlock;
import org.apache.sysml.runtime.controlprogram.IfProgramBlock;
@@ -1181,15 +1178,8 @@ public final class MLContextUtil {
* If false, the dot graph will be created without subgraphs for
* statement blocks.
* @return hop DAG in dot format
- * @throws LanguageException
- * if error occurs
- * @throws DMLRuntimeException
- * if error occurs
- * @throws HopsException
- * if error occurs
*/
- public static String getHopDAG(MLContext mlCtx, Script script, ArrayList<Integer> lines, boolean performHOPRewrites,
- boolean withSubgraph) throws HopsException, DMLRuntimeException, LanguageException {
+ public static String getHopDAG(MLContext mlCtx, Script script, ArrayList<Integer> lines, boolean performHOPRewrites, boolean withSubgraph) {
return getHopDAG(mlCtx, script, lines, null, performHOPRewrites, withSubgraph);
}
@@ -1213,16 +1203,9 @@ public final class MLContextUtil {
* If false, the dot graph will be created without subgraphs for
* statement blocks.
* @return hop DAG in dot format
- * @throws LanguageException
- * if error occurs
- * @throws DMLRuntimeException
- * if error occurs
- * @throws HopsException
- * if error occurs
*/
public static String getHopDAG(MLContext mlCtx, Script script, ArrayList<Integer> lines, SparkConf newConf,
- boolean performHOPRewrites, boolean withSubgraph)
- throws HopsException, DMLRuntimeException, LanguageException {
+ boolean performHOPRewrites, boolean withSubgraph) {
SparkConf oldConf = mlCtx.getSparkSession().sparkContext().getConf();
SparkExecutionContext.SparkClusterConfig systemmlConf = SparkExecutionContext.getSparkClusterConfig();
long oldMaxMemory = InfrastructureAnalyzer.getLocalMaxMemory();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java b/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
index 1fa9e4e..26b744b 100644
--- a/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
+++ b/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
@@ -548,11 +548,7 @@ public class ScriptExecutor {
protected void validateScript() {
try {
dmlTranslator.validateParseTree(dmlProgram);
- } catch (LanguageException e) {
- throw new MLContextException("Exception occurred while validating script", e);
- } catch (ParseException e) {
- throw new MLContextException("Exception occurred while validating script", e);
- } catch (IOException e) {
+ } catch (LanguageException | ParseException e) {
throw new MLContextException("Exception occurred while validating script", e);
}
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/conf/DMLConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/conf/DMLConfig.java b/src/main/java/org/apache/sysml/conf/DMLConfig.java
index 62e1bd0..fb0237f 100644
--- a/src/main/java/org/apache/sysml/conf/DMLConfig.java
+++ b/src/main/java/org/apache/sysml/conf/DMLConfig.java
@@ -147,13 +147,13 @@ public class DMLConfig
}
public DMLConfig(String fileName)
- throws ParseException, FileNotFoundException
+ throws FileNotFoundException
{
this( fileName, false );
}
public DMLConfig(String fileName, boolean silent)
- throws ParseException, FileNotFoundException
+ throws FileNotFoundException
{
_fileName = fileName;
try {
@@ -279,9 +279,8 @@ public class DMLConfig
* Method to update the key value
* @param paramName parameter name
* @param paramValue parameter value
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- public void setTextValue(String paramName, String paramValue) throws DMLRuntimeException {
+ public void setTextValue(String paramName, String paramValue) {
if(_xmlRoot != null) {
NodeList list = _xmlRoot.getElementsByTagName(paramName);
if (list != null && list.getLength() > 0) {
@@ -336,11 +335,9 @@ public class DMLConfig
}
public synchronized String serializeDMLConfig()
- throws DMLRuntimeException
{
String ret = null;
- try
- {
+ try {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
//transformer.setOutputProperty(OutputKeys.INDENT, "yes");
@@ -349,17 +346,14 @@ public class DMLConfig
transformer.transform(source, result);
ret = result.getWriter().toString();
}
- catch(Exception ex)
- {
+ catch(Exception ex) {
throw new DMLRuntimeException("Unable to serialize DML config.", ex);
}
return ret;
}
- public static DMLConfig parseDMLConfig( String content )
- throws DMLRuntimeException
- {
+ public static DMLConfig parseDMLConfig( String content ) {
DMLConfig ret = null;
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
@@ -383,11 +377,10 @@ public class DMLConfig
*
* @param configPath User-defined path of the configuration file.
* @return dml configuration
- * @throws ParseException if ParseException occurs
* @throws FileNotFoundException if FileNotFoundException occurs
*/
public static DMLConfig readConfigurationFile(String configPath)
- throws ParseException, FileNotFoundException
+ throws FileNotFoundException
{
// Always start with the internal defaults
DMLConfig config = new DMLConfig();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/debug/DMLDebuggerFunctions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/debug/DMLDebuggerFunctions.java b/src/main/java/org/apache/sysml/debug/DMLDebuggerFunctions.java
index 3b75d4b..d32d0e5 100644
--- a/src/main/java/org/apache/sysml/debug/DMLDebuggerFunctions.java
+++ b/src/main/java/org/apache/sysml/debug/DMLDebuggerFunctions.java
@@ -29,7 +29,6 @@ import org.apache.commons.lang.math.IntRange;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.parser.Expression.DataType;
-import org.apache.sysml.runtime.DMLRuntimeException;
import org.apache.sysml.runtime.controlprogram.LocalVariableMap;
import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
import org.apache.sysml.runtime.instructions.Instruction;
@@ -278,7 +277,7 @@ public class DMLDebuggerFunctions {
System.out.println("Symbol table for current frame is empty");
}
- public void print(LocalVariableMap variables, String varname, String displayFunction, int rowIndex, int colIndex) throws DMLRuntimeException {
+ public void print(LocalVariableMap variables, String varname, String displayFunction, int rowIndex, int colIndex) {
if (varname == null) {
System.err.println("No matrix variable name entered.");
return;
@@ -357,9 +356,8 @@ public class DMLDebuggerFunctions {
* Print DML matrix variable in current frame (if existing)
* @param variables Current frame variables
* @param varname Variable name
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- public void printMatrixVariable(LocalVariableMap variables, String varname) throws DMLRuntimeException {
+ public void printMatrixVariable(LocalVariableMap variables, String varname) {
if (varname == null) {
System.err.println("No matrix variable name entered.");
return;
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/debug/DebugState.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/debug/DebugState.java b/src/main/java/org/apache/sysml/debug/DebugState.java
index ed1bea3..567b3bd 100644
--- a/src/main/java/org/apache/sysml/debug/DebugState.java
+++ b/src/main/java/org/apache/sysml/debug/DebugState.java
@@ -58,9 +58,8 @@ public class DebugState
/**
* Getter for current frame's program counter
* @return Current frame program counter
- * @throws DMLRuntimeException if DMLRuntimeException occurs
*/
- public DMLProgramCounter getPC() throws DMLRuntimeException {
+ public DMLProgramCounter getPC() {
if(!DMLScript.ENABLE_DEBUG_MODE) {
System.err.println("Error: This functionality (getPC) is available only in debug mode");
//// Fatal error to avoid unintentional bugs
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/AggBinaryOp.java b/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
index 241dd86..3c5f157 100644
--- a/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/AggBinaryOp.java
@@ -29,7 +29,6 @@ import org.apache.sysml.lops.DataPartition;
import org.apache.sysml.lops.Group;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.MMCJ;
import org.apache.sysml.lops.MMCJ.MMCJType;
import org.apache.sysml.lops.MMRJ;
@@ -117,7 +116,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() == 2, this, "should have arity 2 but has arity %d", _input.size());
}
@@ -177,7 +176,6 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
*/
@Override
public Lop constructLops()
- throws HopsException, LopsException
{
//return already created lops
if( getLops() != null )
@@ -434,8 +432,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
@Override
protected ExecType optFindExecType()
- throws HopsException
- {
+ {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
@@ -489,7 +486,6 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
}
private boolean isApplicableForTransitiveSparkExecType(boolean left)
- throws HopsException
{
int index = left ? 0 : 1;
return !(getInput().get(index) instanceof DataOp && ((DataOp)getInput().get(index)).requiresCheckpoint())
@@ -587,21 +583,16 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
// CP Lops generation
/////////////////////////
- private void constructCPLopsTSMM( MMTSJType mmtsj, ExecType et )
- throws HopsException, LopsException
- {
+ private void constructCPLopsTSMM( MMTSJType mmtsj, ExecType et ) {
int k = OptimizerUtils.getConstrainedNumThreads(_maxNumThreads);
-
Lop matmultCP = new MMTSJ(getInput().get(mmtsj.isLeft()?1:0).constructLops(),
- getDataType(), getValueType(), et, mmtsj, false, k);
-
+ getDataType(), getValueType(), et, mmtsj, false, k);
matmultCP.getOutputParameters().setDimensions(getDim1(), getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
setLineNumbers( matmultCP );
setLops(matmultCP);
}
- private void constructCPLopsMMChain( ChainType chain )
- throws LopsException, HopsException
+ private void constructCPLopsMMChain( ChainType chain )
{
MapMultChain mapmmchain = null;
if( chain == ChainType.XtXv ) {
@@ -632,12 +623,8 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
* NOTE: exists for consistency since removeEmtpy might be scheduled to MR
* but matrix mult on small output might be scheduled to CP. Hence, we
* need to handle directly passed selection vectors in CP as well.
- *
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
private void constructCPLopsPMM()
- throws HopsException, LopsException
{
Hop pmInput = getInput().get(0);
Hop rightInput = getInput().get(1);
@@ -663,7 +650,6 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
}
private void constructCPLopsMM(ExecType et)
- throws HopsException, LopsException
{
Lop matmultCP = null;
@@ -701,7 +687,6 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
}
private Lop constructCPLopsMMWithLeftTransposeRewrite()
- throws HopsException, LopsException
{
Hop X = getInput().get(0).getInput().get(0); //guaranteed to exists
Hop Y = getInput().get(1);
@@ -730,9 +715,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
// Spark Lops generation
/////////////////////////
- private void constructSparkLopsTSMM(MMTSJType mmtsj, boolean multiPass)
- throws HopsException, LopsException
- {
+ private void constructSparkLopsTSMM(MMTSJType mmtsj, boolean multiPass) {
Hop input = getInput().get(mmtsj.isLeft()?1:0);
MMTSJ tsmm = new MMTSJ(input.constructLops(), getDataType(),
getValueType(), ExecType.SPARK, mmtsj, multiPass);
@@ -741,8 +724,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
setLops(tsmm);
}
- private void constructSparkLopsMapMM(MMultMethod method)
- throws LopsException, HopsException
+ private void constructSparkLopsMapMM(MMultMethod method)
{
Lop mapmult = null;
if( isLeftTransposeRewriteApplicable(false, false) )
@@ -767,8 +749,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
setLops(mapmult);
}
- private Lop constructSparkLopsMapMMWithLeftTransposeRewrite()
- throws HopsException, LopsException
+ private Lop constructSparkLopsMapMMWithLeftTransposeRewrite()
{
Hop X = getInput().get(0).getInput().get(0); //guaranteed to exists
Hop Y = getInput().get(1);
@@ -794,9 +775,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
return out;
}
- private void constructSparkLopsMapMMChain(ChainType chain)
- throws LopsException, HopsException
- {
+ private void constructSparkLopsMapMMChain(ChainType chain) {
MapMultChain mapmmchain = null;
if( chain == ChainType.XtXv ) {
Hop hX = getInput().get(0).getInput().get(0);
@@ -816,9 +795,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
setLops(mapmmchain);
}
- private void constructSparkLopsPMapMM()
- throws LopsException, HopsException
- {
+ private void constructSparkLopsPMapMM() {
PMapMult pmapmult = new PMapMult(
getInput().get(0).constructLops(),
getInput().get(1).constructLops(),
@@ -828,9 +805,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
setLops(pmapmult);
}
- private void constructSparkLopsCPMM()
- throws HopsException, LopsException
- {
+ private void constructSparkLopsCPMM() {
if( isLeftTransposeRewriteApplicable(false, false) )
{
setLops( constructSparkLopsCPMMWithLeftTransposeRewrite() );
@@ -847,9 +822,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
}
}
- private Lop constructSparkLopsCPMMWithLeftTransposeRewrite()
- throws HopsException, LopsException
- {
+ private Lop constructSparkLopsCPMMWithLeftTransposeRewrite() {
SparkAggType aggtype = getSparkMMAggregationType(true);
Hop X = getInput().get(0).getInput().get(0); //guaranteed to exists
@@ -872,19 +845,15 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
return out;
}
- private void constructSparkLopsRMM()
- throws LopsException, HopsException
- {
+ private void constructSparkLopsRMM() {
Lop rmm = new MMRJ(getInput().get(0).constructLops(),getInput().get(1).constructLops(),
- getDataType(), getValueType(), ExecType.SPARK);
+ getDataType(), getValueType(), ExecType.SPARK);
setOutputDimensions(rmm);
setLineNumbers( rmm );
setLops(rmm);
}
- private void constructSparkLopsPMM()
- throws HopsException, LopsException
- {
+ private void constructSparkLopsPMM() {
//PMM has two potential modes (a) w/ full permutation matrix input, and
//(b) w/ already condensed input vector of target row positions.
@@ -894,7 +863,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
Lop lpmInput = pmInput.constructLops();
Hop nrow = null;
double mestPM = OptimizerUtils.estimateSize(pmInput.getDim1(), 1);
- ExecType etVect = (mestPM>OptimizerUtils.getLocalMemBudget())?ExecType.MR:ExecType.CP;
+ ExecType etVect = (mestPM>OptimizerUtils.getLocalMemBudget())?ExecType.MR:ExecType.CP;
//a) full permutation matrix input (potentially without empty block materialized)
if( pmInput.getDim2() != 1 ) //not a vector
@@ -939,12 +908,10 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
setLineNumbers(pmm);
setLops(pmm);
- HopRewriteUtils.removeChildReference(pmInput, nrow);
+ HopRewriteUtils.removeChildReference(pmInput, nrow);
}
- private void constructSparkLopsZIPMM()
- throws HopsException, LopsException
- {
+ private void constructSparkLopsZIPMM() {
//zipmm applies to t(X)%*%y if ncol(X)<=blocksize and it prevents
//unnecessary reshuffling by keeping the original indexes (and partitioning)
//joining the datasets, and internally doing the necessary transpose operations
@@ -965,8 +932,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
// MR Lops generation
/////////////////////////
- private void constructMRLopsMapMM(MMultMethod method)
- throws HopsException, LopsException
+ private void constructMRLopsMapMM(MMultMethod method)
{
if( method == MMultMethod.MAPMM_R && isLeftTransposeRewriteApplicable(false, true) )
{
@@ -1002,7 +968,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
rightInput.getOutputParameters().setDimensions(input.getDim1(), input.getDim2(), getRowsInBlock(), getColsInBlock(), input.getNnz());
setLineNumbers(rightInput);
}
- }
+ }
//core matrix mult
MapMult mapmult = new MapMult( leftInput, rightInput, getDataType(), getValueType(),
@@ -1027,11 +993,10 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
else {
setLops(mapmult);
}
- }
+ }
}
- private Lop constructMRLopsMapMMWithLeftTransposeRewrite()
- throws HopsException, LopsException
+ private Lop constructMRLopsMapMMWithLeftTransposeRewrite()
{
Hop X = getInput().get(0).getInput().get(0); //guaranteed to exists
Hop Y = getInput().get(1);
@@ -1087,8 +1052,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
return out;
}
- private void constructMRLopsMapMMChain( ChainType chainType )
- throws HopsException, LopsException
+ private void constructMRLopsMapMMChain( ChainType chainType )
{
Lop mapmult = null;
@@ -1140,8 +1104,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
setLops(agg1);
}
- private void constructMRLopsCPMM()
- throws HopsException, LopsException
+ private void constructMRLopsCPMM()
{
if( isLeftTransposeRewriteApplicable(false, false) )
{
@@ -1172,9 +1135,7 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
}
}
- private Lop constructMRLopsCPMMWithLeftTransposeRewrite()
- throws HopsException, LopsException
- {
+ private Lop constructMRLopsCPMMWithLeftTransposeRewrite() {
Hop X = getInput().get(0).getInput().get(0); //guaranteed to exists
Hop Y = getInput().get(1);
@@ -1208,36 +1169,27 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
return out;
}
- private void constructMRLopsRMM()
- throws HopsException, LopsException
- {
+ private void constructMRLopsRMM() {
MMRJ rmm = new MMRJ(getInput().get(0).constructLops(), getInput().get(1).constructLops(),
- getDataType(), getValueType(), ExecType.MR);
-
+ getDataType(), getValueType(), ExecType.MR);
setOutputDimensions(rmm);
setLineNumbers(rmm);
setLops(rmm);
}
- private void constructMRLopsTSMM(MMTSJType mmtsj)
- throws HopsException, LopsException
- {
+ private void constructMRLopsTSMM(MMTSJType mmtsj) {
Hop input = getInput().get(mmtsj.isLeft()?1:0);
-
MMTSJ tsmm = new MMTSJ(input.constructLops(), getDataType(), getValueType(), ExecType.MR, mmtsj);
tsmm.getOutputParameters().setDimensions(getDim1(), getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
setLineNumbers(tsmm);
-
Aggregate agg1 = new Aggregate(tsmm, HopsAgg2Lops.get(outerOp), getDataType(), getValueType(), ExecType.MR);
agg1.getOutputParameters().setDimensions(getDim1(), getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
agg1.setupCorrectionLocation(CorrectionLocationType.NONE); // aggregation uses kahanSum but the inputs do not have correction values
setLineNumbers(agg1);
-
setLops(agg1);
- }
+ }
private void constructMRLopsPMM()
- throws HopsException, LopsException
{
//PMM has two potential modes (a) w/ full permutation matrix input, and
//(b) w/ already condensed input vector of target row positions.
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/AggUnaryOp.java b/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
index 79c1610..136d2d6 100644
--- a/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/AggUnaryOp.java
@@ -29,7 +29,6 @@ import org.apache.sysml.lops.Binary;
import org.apache.sysml.lops.ConvolutionTransform;
import org.apache.sysml.lops.Group;
import org.apache.sysml.lops.Lop;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.PartialAggregate;
import org.apache.sysml.lops.PartialAggregate.DirectionTypes;
import org.apache.sysml.lops.TernaryAggregate;
@@ -74,7 +73,7 @@ public class AggUnaryOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() == 1, this, "should have arity 1 but has arity %d", _input.size());
}
@@ -148,8 +147,7 @@ public class AggUnaryOp extends Hop implements MultiThreadedHop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -473,14 +471,14 @@ public class AggUnaryOp extends Hop implements MultiThreadedHop
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
//forced / memory-based / threshold-based decision
- if( _etypeForced != null )
+ if( _etypeForced != null )
{
_etype = _etypeForced;
}
@@ -547,7 +545,6 @@ public class AggUnaryOp extends Hop implements MultiThreadedHop
}
private boolean isTernaryAggregateRewriteApplicable()
- throws HopsException
{
boolean ret = false;
@@ -701,7 +698,6 @@ public class AggUnaryOp extends Hop implements MultiThreadedHop
}
private Lop constructLopsTernaryAggregateRewrite(ExecType et)
- throws HopsException, LopsException
{
BinaryOp input1 = (BinaryOp)getInput().get(0);
Hop input11 = input1.getInput().get(0);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/BinaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/BinaryOp.java b/src/main/java/org/apache/sysml/hops/BinaryOp.java
index 279d14d..35d40c5 100644
--- a/src/main/java/org/apache/sysml/hops/BinaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/BinaryOp.java
@@ -43,7 +43,6 @@ import org.apache.sysml.lops.DataPartition;
import org.apache.sysml.lops.Group;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.PartialAggregate;
import org.apache.sysml.lops.PickByCount;
import org.apache.sysml.lops.RepMat;
@@ -112,7 +111,7 @@ public class BinaryOp extends Hop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() == 2, this, "should have arity 2 but has arity %d", _input.size());
}
@@ -184,8 +183,7 @@ public class BinaryOp extends Hop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -231,7 +229,7 @@ public class BinaryOp extends Hop
return getLops();
}
- private void constructLopsIQM(ExecType et) throws HopsException, LopsException {
+ private void constructLopsIQM(ExecType et) {
if ( et == ExecType.MR ) {
CombineBinary combine = CombineBinary.constructCombineLop(
OperationTypes.PreSort, (Lop) getInput().get(0)
@@ -329,7 +327,7 @@ public class BinaryOp extends Hop
}
}
- private void constructLopsMedian(ExecType et) throws HopsException, LopsException {
+ private void constructLopsMedian(ExecType et) {
if ( et == ExecType.MR ) {
CombineBinary combine = CombineBinary
.constructCombineLop(
@@ -400,7 +398,6 @@ public class BinaryOp extends Hop
}
private void constructLopsCentralMoment(ExecType et)
- throws HopsException, LopsException
{
// The output data type is a SCALAR if central moment
// gets computed in CP/SPARK, and it will be MATRIX otherwise.
@@ -427,9 +424,7 @@ public class BinaryOp extends Hop
}
}
- private void constructLopsCovariance(ExecType et)
- throws LopsException, HopsException
- {
+ private void constructLopsCovariance(ExecType et) {
if ( et == ExecType.MR ) {
// combineBinary -> CoVariance -> CastAsScalar
CombineBinary combine = CombineBinary.constructCombineLop(
@@ -469,7 +464,7 @@ public class BinaryOp extends Hop
}
}
- private void constructLopsQuantile(ExecType et) throws HopsException, LopsException {
+ private void constructLopsQuantile(ExecType et) {
// 1st arguments needs to be a 1-dimensional matrix
// For QUANTILE: 2nd argument is scalar or 1-dimensional matrix
// For INTERQUANTILE: 2nd argument is always a scalar
@@ -540,7 +535,6 @@ public class BinaryOp extends Hop
}
private void constructLopsAppend(ExecType et)
- throws HopsException, LopsException
{
DataType dt1 = getInput().get(0).getDataType();
DataType dt2 = getInput().get(1).getDataType();
@@ -593,7 +587,6 @@ public class BinaryOp extends Hop
}
private void constructLopsBinaryDefault()
- throws HopsException, LopsException
{
/* Default behavior for BinaryOp */
// it depends on input data types
@@ -995,7 +988,7 @@ public class BinaryOp extends Hop
}
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
@@ -1088,11 +1081,8 @@ public class BinaryOp extends Hop
* @param cbind true if cbind
* @param current current high-level operator
* @return low-level operator
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
- public static Lop constructMRAppendLop( Hop left, Hop right, DataType dt, ValueType vt, boolean cbind, Hop current )
- throws HopsException, LopsException
+ public static Lop constructMRAppendLop( Hop left, Hop right, DataType dt, ValueType vt, boolean cbind, Hop current )
{
Lop ret = null;
@@ -1178,7 +1168,6 @@ public class BinaryOp extends Hop
}
public static Lop constructSPAppendLop( Hop left, Hop right, DataType dt, ValueType vt, boolean cbind, Hop current )
- throws HopsException, LopsException
{
Lop ret = null;
@@ -1234,12 +1223,8 @@ public class BinaryOp extends Hop
* @param cbind ?
* @param current ?
* @return low-level operator
- * @throws HopsException if HopsException occurs
- * @throws LopsException if LopsException occurs
*/
- public static Lop constructAppendLopChain( Hop left, Hop right1, Hop right2, DataType dt, ValueType vt, boolean cbind, Hop current )
- throws HopsException, LopsException
- {
+ public static Lop constructAppendLopChain( Hop left, Hop right1, Hop right2, DataType dt, ValueType vt, boolean cbind, Hop current ) {
long m1_dim1 = left.getDim1();
long m1_dim2 = left.getDim2();
long m2_dim1 = right1.getDim1();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ConvolutionOp.java b/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
index 410a83a..c137462 100644
--- a/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
+++ b/src/main/java/org/apache/sysml/hops/ConvolutionOp.java
@@ -26,7 +26,6 @@ import org.apache.sysml.lops.ConvolutionTransform;
import org.apache.sysml.lops.ConvolutionTransform.OperationTypes;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.parser.Expression.ValueType;
import org.apache.sysml.runtime.DMLRuntimeException;
@@ -81,7 +80,7 @@ public class ConvolutionOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() >= 1, this, "should have at least one input but has %d inputs", _input.size());
}
@@ -107,7 +106,6 @@ public class ConvolutionOp extends Hop implements MultiThreadedHop
@Override
public Lop constructLops()
- throws HopsException, LopsException
{
//return already created lops
if( getLops() != null )
@@ -213,10 +211,8 @@ public class ConvolutionOp extends Hop implements MultiThreadedHop
* If corresponding output lop is not found or if this is not a max_pool_backward operation, this function returns null
*
* @return output lop of max_pool/avg_pool operation with same parameters as this hop
- * @throws HopsException if error
- * @throws LopsException if error
*/
- private Lop getMaxPoolOutputLop() throws HopsException, LopsException {
+ private Lop getMaxPoolOutputLop() {
if(op == ConvOp.MAX_POOLING_BACKWARD || op == ConvOp.AVG_POOLING_BACKWARD) {
ConvOp opType = (op == ConvOp.MAX_POOLING_BACKWARD) ? ConvOp.MAX_POOLING : ConvOp.AVG_POOLING;
Hop inputImage = getInput().get(0);
@@ -232,7 +228,7 @@ public class ConvolutionOp extends Hop implements MultiThreadedHop
return null;
}
- public Lop constructConvolutionLops(ExecType et, ArrayList<Hop> inputs) throws HopsException, LopsException {
+ public Lop constructConvolutionLops(ExecType et, ArrayList<Hop> inputs) {
if(inputs.size() != getNumExpectedInputs())
throw new HopsException("Incorrect number of inputs for " + op.name());
@@ -533,7 +529,7 @@ public class ConvolutionOp extends Hop implements MultiThreadedHop
}
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/DataGenOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/DataGenOp.java b/src/main/java/org/apache/sysml/hops/DataGenOp.java
index 6980cd3..3e271d5 100644
--- a/src/main/java/org/apache/sysml/hops/DataGenOp.java
+++ b/src/main/java/org/apache/sysml/hops/DataGenOp.java
@@ -29,7 +29,6 @@ import org.apache.sysml.hops.rewrite.HopRewriteUtils;
import org.apache.sysml.hops.Hop.MultiThreadedHop;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.DataGen;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.LopProperties.ExecType;
import org.apache.sysml.parser.DataIdentifier;
import org.apache.sysml.parser.DataExpression;
@@ -119,7 +118,7 @@ public class DataGenOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
int sz = _input.size();
int pz = _paramIndexMap.size();
HopsException.check(sz == pz, this, "has %d inputs but %d parameters", sz, pz);
@@ -151,7 +150,6 @@ public class DataGenOp extends Hop implements MultiThreadedHop
@Override
public Lop constructLops()
- throws HopsException, LopsException
{
//return already created lops
if( getLops() != null )
@@ -274,13 +272,12 @@ public class DataGenOp extends Hop implements MultiThreadedHop
}
@Override
- protected ExecType optFindExecType() throws HopsException {
-
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
- if( _etypeForced != null )
+ if( _etypeForced != null )
_etype = _etypeForced;
else
{
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/DataOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/DataOp.java b/src/main/java/org/apache/sysml/hops/DataOp.java
index 2495997..fd3665f 100644
--- a/src/main/java/org/apache/sysml/hops/DataOp.java
+++ b/src/main/java/org/apache/sysml/hops/DataOp.java
@@ -188,7 +188,7 @@ public class DataOp extends Hop
/** Check for N (READ) or N+1 (WRITE) inputs. */
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
int sz = _input.size();
int pz = _paramIndexMap.size();
switch (_dataop) {
@@ -247,8 +247,7 @@ public class DataOp extends Hop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -441,7 +440,6 @@ public class DataOp extends Hop
@Override
protected ExecType optFindExecType()
- throws HopsException
{
//MB: find exec type has two meanings here: (1) for write it means the actual
//exec type, while (2) for read it affects the recompilation decision as needed
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/FunctionOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/FunctionOp.java b/src/main/java/org/apache/sysml/hops/FunctionOp.java
index 49000e2..3631f00 100644
--- a/src/main/java/org/apache/sysml/hops/FunctionOp.java
+++ b/src/main/java/org/apache/sysml/hops/FunctionOp.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import org.apache.sysml.lops.FunctionCallCP;
import org.apache.sysml.lops.FunctionCallCPSingle;
import org.apache.sysml.lops.Lop;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.LopProperties.ExecType;
import org.apache.sysml.parser.DMLProgram;
import org.apache.sysml.parser.Expression.DataType;
@@ -84,7 +83,7 @@ public class FunctionOp extends Hop
/** FunctionOps may have any number of inputs. */
@Override
- public void checkArity() throws HopsException {}
+ public void checkArity() {}
public String getFunctionKey() {
return DMLProgram.constructFunctionKey(
@@ -221,7 +220,6 @@ public class FunctionOp extends Hop
@Override
public Lop constructLops()
- throws HopsException, LopsException
{
//return already created lops
if( getLops() != null )
@@ -253,7 +251,6 @@ public class FunctionOp extends Hop
@Override
protected ExecType optFindExecType()
- throws HopsException
{
checkAndSetForcedPlatform();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/Hop.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/Hop.java b/src/main/java/org/apache/sysml/hops/Hop.java
index 0ced336..8d799f9 100644
--- a/src/main/java/org/apache/sysml/hops/Hop.java
+++ b/src/main/java/org/apache/sysml/hops/Hop.java
@@ -151,9 +151,8 @@ public abstract class Hop implements ParseInfo
*
* Parameterized Hops (such as DataOp) can check that the number of parameters matches the number of inputs.
*
- * @throws HopsException if this Hop has an illegal number of inputs (a kind of Illegal State)
*/
- public abstract void checkArity() throws HopsException;
+ public abstract void checkArity();
public ExecType getExecType()
{
@@ -282,9 +281,7 @@ public abstract class Hop implements ParseInfo
return _requiresCompression;
}
- public void constructAndSetLopsDataFlowProperties()
- throws HopsException
- {
+ public void constructAndSetLopsDataFlowProperties() {
//Step 1: construct reblock lop if required (output of hop)
constructAndSetReblockLopIfRequired();
@@ -296,7 +293,6 @@ public abstract class Hop implements ParseInfo
}
private void constructAndSetReblockLopIfRequired()
- throws HopsException
{
//determine execution type
ExecType et = ExecType.CP;
@@ -337,9 +333,7 @@ public abstract class Hop implements ParseInfo
}
}
- private void constructAndSetCheckpointLopIfRequired()
- throws HopsException
- {
+ private void constructAndSetCheckpointLopIfRequired() {
//determine execution type
ExecType et = ExecType.CP;
if( OptimizerUtils.isSparkExecutionMode()
@@ -397,7 +391,6 @@ public abstract class Hop implements ParseInfo
}
private void constructAndSetCompressionLopIfRequired()
- throws HopsException
{
//determine execution type
ExecType et = ExecType.CP;
@@ -435,7 +428,6 @@ public abstract class Hop implements ParseInfo
}
public static Lop createOffsetLop( Hop hop, boolean repCols )
- throws HopsException, LopsException
{
Lop offset = null;
@@ -819,11 +811,9 @@ public abstract class Hop implements ParseInfo
return _updateType;
}
- public abstract Lop constructLops()
- throws HopsException, LopsException;
+ public abstract Lop constructLops();
- protected abstract ExecType optFindExecType()
- throws HopsException;
+ protected abstract ExecType optFindExecType();
public abstract String getOpString();
@@ -1000,9 +990,7 @@ public abstract class Hop implements ParseInfo
return OptimizerUtils.getSparsity(_dim1, _dim2, _nnz);
}
- protected void setOutputDimensions(Lop lop)
- throws HopsException
- {
+ protected void setOutputDimensions(Lop lop) {
lop.getOutputParameters().setDimensions(
getDim1(), getDim2(), getRowsInBlock(), getColsInBlock(), getNnz(), getUpdateType());
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/HopsException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/HopsException.java b/src/main/java/org/apache/sysml/hops/HopsException.java
index 17d9a09..7979da1 100644
--- a/src/main/java/org/apache/sysml/hops/HopsException.java
+++ b/src/main/java/org/apache/sysml/hops/HopsException.java
@@ -50,9 +50,8 @@ public class HopsException extends DMLException
* @param condition Condition to test
* @param message Message to print if the condition fails
* @param objects Objects to print with the message, as per String.format
- * @throws HopsException Thrown if condition is false
*/
- public static void check(boolean condition, String message, Object... objects) throws HopsException {
+ public static void check(boolean condition, String message, Object... objects) {
if (!condition)
throw new HopsException(String.format(message, objects));
}
@@ -62,9 +61,8 @@ public class HopsException extends DMLException
* @param hop Hop to print as a cause of the problem, if the condition fails
* @param message Message to print if the condition fails
* @param objects Objects to print with the message, as per String.format
- * @throws HopsException Thrown if condition is false
*/
- public static void check(boolean condition, Hop hop, String message, Object... objects) throws HopsException {
+ public static void check(boolean condition, Hop hop, String message, Object... objects) {
if (!condition)
throw new HopsException(String.format(hop.getOpString()+" id="+hop.getHopID()+" "+message, objects));
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/IndexingOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/IndexingOp.java b/src/main/java/org/apache/sysml/hops/IndexingOp.java
index 0b8509a..c265d59 100644
--- a/src/main/java/org/apache/sysml/hops/IndexingOp.java
+++ b/src/main/java/org/apache/sysml/hops/IndexingOp.java
@@ -26,7 +26,6 @@ import org.apache.sysml.lops.Aggregate;
import org.apache.sysml.lops.Data;
import org.apache.sysml.lops.Group;
import org.apache.sysml.lops.Lop;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.RightIndex;
import org.apache.sysml.lops.LopProperties.ExecType;
import org.apache.sysml.parser.Expression.DataType;
@@ -76,7 +75,7 @@ public class IndexingOp extends Hop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() == 5, this, "should have 5 inputs but has %d inputs", _input.size());
}
@@ -116,8 +115,7 @@ public class IndexingOp extends Hop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -362,13 +360,13 @@ public class IndexingOp extends Hop
}
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
- if( _etypeForced != null )
+ if( _etypeForced != null )
{
_etype = _etypeForced;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java b/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
index 2ca90ab..ba355e2 100644
--- a/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
+++ b/src/main/java/org/apache/sysml/hops/LeftIndexingOp.java
@@ -25,7 +25,6 @@ import org.apache.sysml.lops.Group;
import org.apache.sysml.lops.LeftIndex;
import org.apache.sysml.lops.LeftIndex.LixCacheType;
import org.apache.sysml.lops.Lop;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.RightIndex;
import org.apache.sysml.lops.UnaryCP;
import org.apache.sysml.lops.ZeroOut;
@@ -78,7 +77,7 @@ public class LeftIndexingOp extends Hop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.size() == 6, this, "should have 6 inputs but has %d inputs", 6);
}
@@ -105,8 +104,7 @@ public class LeftIndexingOp extends Hop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -361,13 +359,13 @@ public class LeftIndexingOp extends Hop
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
- if( _etypeForced != null )
+ if( _etypeForced != null )
{
_etype = _etypeForced;
}
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/LiteralOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/LiteralOp.java b/src/main/java/org/apache/sysml/hops/LiteralOp.java
index d385d6b..6747708 100644
--- a/src/main/java/org/apache/sysml/hops/LiteralOp.java
+++ b/src/main/java/org/apache/sysml/hops/LiteralOp.java
@@ -70,7 +70,7 @@ public class LiteralOp extends Hop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
HopsException.check(_input.isEmpty(), this, "should have 0 inputs but has %d inputs", _input.size());
}
@@ -81,8 +81,7 @@ public class LiteralOp extends Hop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -187,7 +186,7 @@ public class LiteralOp extends Hop
}
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
// Since a Literal hop does not represent any computation,
// this function is not applicable.
return null;
@@ -214,7 +213,7 @@ public class LiteralOp extends Hop
}
}
- public double getDoubleValue() throws HopsException {
+ public double getDoubleValue() {
switch( getValueType() ) {
case INT:
return value_long;
@@ -229,7 +228,7 @@ public class LiteralOp extends Hop
}
}
- public boolean getBooleanValue() throws HopsException {
+ public boolean getBooleanValue() {
switch( getValueType() ) {
case INT:
return (value_long != 0);
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/NaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/NaryOp.java b/src/main/java/org/apache/sysml/hops/NaryOp.java
index 1a6da2e..4b950de 100644
--- a/src/main/java/org/apache/sysml/hops/NaryOp.java
+++ b/src/main/java/org/apache/sysml/hops/NaryOp.java
@@ -22,7 +22,6 @@ package org.apache.sysml.hops;
import org.apache.sysml.hops.rewrite.HopRewriteUtils;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.Nary;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.parser.Expression.ValueType;
@@ -53,14 +52,11 @@ public class NaryOp extends Hop {
* the operation type (such as PRINTF)
* @param inputs
* a variable number of input Hops
- * @throws HopsException
- * thrown if a HopsException occurs
*/
public NaryOp(String name, DataType dataType, ValueType valueType,
- OpOpN op, Hop... inputs) throws HopsException {
+ OpOpN op, Hop... inputs) {
super(name, dataType, valueType);
_op = op;
-
for (int i = 0; i < inputs.length; i++) {
getInput().add(i, inputs[i]);
inputs[i].getParent().add(this);
@@ -69,7 +65,7 @@ public class NaryOp extends Hop {
/** MultipleOp may have any number of inputs. */
@Override
- public void checkArity() throws HopsException {}
+ public void checkArity() {}
public OpOpN getOp() {
return _op;
@@ -89,7 +85,7 @@ public class NaryOp extends Hop {
* Construct the corresponding Lops for this Hop
*/
@Override
- public Lop constructLops() throws HopsException, LopsException {
+ public Lop constructLops() {
// reuse existing lop
if (getLops() != null)
return getLops();
@@ -131,7 +127,7 @@ public class NaryOp extends Hop {
}
@Override
- protected ExecType optFindExecType() throws HopsException {
+ protected ExecType optFindExecType() {
checkAndSetForcedPlatform();
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/OptimizerUtils.java b/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
index 274abad..e9fe24e 100644
--- a/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
+++ b/src/main/java/org/apache/sysml/hops/OptimizerUtils.java
@@ -919,9 +919,7 @@ public class OptimizerUtils
+ Dag.getNextUniqueFilenameSuffix();
}
- public static boolean allowsToFilterEmptyBlockOutputs( Hop hop )
- throws HopsException
- {
+ public static boolean allowsToFilterEmptyBlockOutputs( Hop hop ) {
boolean ret = true;
for( Hop p : hop.getParent() ) {
p.optFindExecType(); //ensure exec type evaluated
@@ -1206,10 +1204,8 @@ public class OptimizerUtils
* @param root the root high-level operator
* @param valMemo ?
* @return size expression
- * @throws HopsException if HopsException occurs
*/
public static long rEvalSimpleLongExpression( Hop root, HashMap<Long, Long> valMemo )
- throws HopsException
{
long ret = Long.MAX_VALUE;
@@ -1223,7 +1219,6 @@ public class OptimizerUtils
}
public static long rEvalSimpleLongExpression( Hop root, HashMap<Long, Long> valMemo, LocalVariableMap vars )
- throws HopsException
{
long ret = Long.MAX_VALUE;
@@ -1237,7 +1232,6 @@ public class OptimizerUtils
}
public static double rEvalSimpleDoubleExpression( Hop root, HashMap<Long, Double> valMemo )
- throws HopsException
{
//memoization (prevent redundant computation of common subexpr)
if( valMemo.containsKey(root.getHopID()) )
@@ -1263,7 +1257,6 @@ public class OptimizerUtils
}
public static double rEvalSimpleDoubleExpression( Hop root, HashMap<Long, Double> valMemo, LocalVariableMap vars )
- throws HopsException
{
//memoization (prevent redundant computation of common subexpr)
if( valMemo.containsKey(root.getHopID()) )
@@ -1292,7 +1285,6 @@ public class OptimizerUtils
}
protected static double rEvalSimpleUnaryDoubleExpression( Hop root, HashMap<Long, Double> valMemo )
- throws HopsException
{
//memoization (prevent redundant computation of common subexpr)
if( valMemo.containsKey(root.getHopID()) )
@@ -1331,7 +1323,6 @@ public class OptimizerUtils
}
protected static double rEvalSimpleUnaryDoubleExpression( Hop root, HashMap<Long, Double> valMemo, LocalVariableMap vars )
- throws HopsException
{
//memoization (prevent redundant computation of common subexpr)
if( valMemo.containsKey(root.getHopID()) )
@@ -1370,7 +1361,6 @@ public class OptimizerUtils
}
protected static double rEvalSimpleBinaryDoubleExpression( Hop root, HashMap<Long, Double> valMemo )
- throws HopsException
{
//memoization (prevent redundant computation of common subexpr)
if( valMemo.containsKey(root.getHopID()) )
@@ -1406,7 +1396,6 @@ public class OptimizerUtils
}
protected static double rEvalSimpleBinaryDoubleExpression( Hop root, HashMap<Long, Double> valMemo, LocalVariableMap vars )
- throws HopsException
{
//memoization (prevent redundant computation of common subexpr)
if( valMemo.containsKey(root.getHopID()) )
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java b/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
index a1cea17..35ed54b 100644
--- a/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
+++ b/src/main/java/org/apache/sysml/hops/ParameterizedBuiltinOp.java
@@ -33,7 +33,6 @@ import org.apache.sysml.lops.GroupedAggregate;
import org.apache.sysml.lops.GroupedAggregateM;
import org.apache.sysml.lops.Lop;
import org.apache.sysml.lops.LopProperties.ExecType;
-import org.apache.sysml.lops.LopsException;
import org.apache.sysml.lops.PMMJ;
import org.apache.sysml.lops.PartialAggregate.CorrectionLocationType;
import org.apache.sysml.lops.ParameterizedBuiltin;
@@ -109,7 +108,7 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
}
@Override
- public void checkArity() throws HopsException {
+ public void checkArity() {
int sz = _input.size();
int pz = _paramIndexMap.size();
HopsException.check(sz == pz, this, "has %d inputs but %d parameters", sz, pz);
@@ -158,8 +157,7 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
@Override
public Lop constructLops()
- throws HopsException, LopsException
- {
+ {
//return already created lops
if( getLops() != null )
return getLops();
@@ -213,7 +211,6 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
}
private void constructLopsGroupedAggregate(HashMap<String, Lop> inputlops, ExecType et)
- throws HopsException, LopsException
{
//reset reblock requirement (see MR aggregate / construct lops)
setRequiresReblock( false );
@@ -403,7 +400,6 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
}
private void constructLopsRemoveEmpty(HashMap<String, Lop> inputlops, ExecType et)
- throws HopsException, LopsException
{
Hop targetHop = getTargetHop();
Hop marginHop = getParameterHop("margin");
@@ -749,7 +745,6 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
}
private void constructLopsRExpand(HashMap<String, Lop> inputlops, ExecType et)
- throws HopsException, LopsException
{
if( et == ExecType.CP || et == ExecType.SPARK )
{
@@ -1040,7 +1035,6 @@ public class ParameterizedBuiltinOp extends Hop implements MultiThreadedHop
@Override
protected ExecType optFindExecType()
- throws HopsException
{
checkAndSetForcedPlatform();