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/02/15 06:09:42 UTC

systemml git commit: [SYSTEMML-2110] New tests for codegen relu backward operations

Repository: systemml
Updated Branches:
  refs/heads/master c821722db -> ddaf166fb


[SYSTEMML-2110] New tests for codegen relu backward operations

Closes #726.


Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/ddaf166f
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/ddaf166f
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/ddaf166f

Branch: refs/heads/master
Commit: ddaf166fb68adb107b6f4cbb064b75588e5cd80e
Parents: c821722
Author: Janardhan Pulivarthi <j1...@protonmail.com>
Authored: Wed Feb 14 22:07:05 2018 -0800
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Wed Feb 14 22:07:06 2018 -0800

----------------------------------------------------------------------
 .../functions/codegen/CellwiseTmplTest.java     | 20 ++++++++++--
 .../functions/codegen/RowAggTmplTest.java       | 18 ++++++++++-
 .../scripts/functions/codegen/cellwisetmpl21.R  | 32 +++++++++++++++++++
 .../functions/codegen/cellwisetmpl21.dml        | 28 +++++++++++++++++
 .../scripts/functions/codegen/rowAggPattern40.R | 33 ++++++++++++++++++++
 .../functions/codegen/rowAggPattern40.dml       | 28 +++++++++++++++++
 6 files changed, 156 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/ddaf166f/src/test/java/org/apache/sysml/test/integration/functions/codegen/CellwiseTmplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/codegen/CellwiseTmplTest.java b/src/test/java/org/apache/sysml/test/integration/functions/codegen/CellwiseTmplTest.java
index d6c56b7..f9b4a4a 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/codegen/CellwiseTmplTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/codegen/CellwiseTmplTest.java
@@ -56,6 +56,7 @@ public class CellwiseTmplTest extends AutomatedTestBase
 	private static final String TEST_NAME18 = TEST_NAME+18; //sum(ifelse(X,Y,Z))
 	private static final String TEST_NAME19 = TEST_NAME+19; //sum(ifelse(true,Y,Z))+sum(ifelse(false,Y,Z))
 	private static final String TEST_NAME20 = TEST_NAME+20; //bitwAnd() operation
+	private static final String TEST_NAME21 = TEST_NAME+21; //relu operation, (X>0)*dout
 	
 	private static final String TEST_DIR = "functions/codegen/";
 	private static final String TEST_CLASS_DIR = TEST_DIR + CellwiseTmplTest.class.getSimpleName() + "/";
@@ -68,7 +69,7 @@ public class CellwiseTmplTest extends AutomatedTestBase
 	@Override
 	public void setUp() {
 		TestUtils.clearAssertionInformation();
-		for( int i=1; i<=20; i++ ) {
+		for( int i=1; i<=21; i++ ) {
 			addTestConfiguration( TEST_NAME+i, new TestConfiguration(
 					TEST_CLASS_DIR, TEST_NAME+i, new String[] {String.valueOf(i)}) );
 		}
@@ -350,7 +351,22 @@ public class CellwiseTmplTest extends AutomatedTestBase
 	public void testCodegenCellwiseRewrite20_sp() {
 		testCodegenIntegration( TEST_NAME20, true, ExecType.SPARK );
 	}
-	
+
+	@Test
+	public void testCodegenCellwiseRewrite21() {
+		testCodegenIntegration( TEST_NAME21, true, ExecType.CP );
+	}
+
+	@Test
+	public void testCodegenCellwise21() {
+		testCodegenIntegration( TEST_NAME21, false, ExecType.CP );
+	}
+
+	@Test
+	public void testCodegenCellwiseRewrite21_sp() {
+		testCodegenIntegration( TEST_NAME21, true, ExecType.SPARK );
+	}
+
 	private void testCodegenIntegration( String testname, boolean rewrites, ExecType instType )
 	{
 		boolean oldRewrites = OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION;

http://git-wip-us.apache.org/repos/asf/systemml/blob/ddaf166f/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowAggTmplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowAggTmplTest.java b/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowAggTmplTest.java
index 79308e6..6cb853d 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowAggTmplTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowAggTmplTest.java
@@ -76,6 +76,7 @@ public class RowAggTmplTest extends AutomatedTestBase
 	private static final String TEST_NAME37 = TEST_NAME+"37"; //sprop(X/rowSums)
 	private static final String TEST_NAME38 = TEST_NAME+"38"; //sigmoid(X/rowSums)
 	private static final String TEST_NAME39 = TEST_NAME+"39"; //BitwAnd operation
+	private static final String TEST_NAME40 = TEST_NAME+"40"; //relu operation -> (X>0)* dout
 	
 	private static final String TEST_DIR = "functions/codegen/";
 	private static final String TEST_CLASS_DIR = TEST_DIR + RowAggTmplTest.class.getSimpleName() + "/";
@@ -87,7 +88,7 @@ public class RowAggTmplTest extends AutomatedTestBase
 	@Override
 	public void setUp() {
 		TestUtils.clearAssertionInformation();
-		for(int i=1; i<=39; i++)
+		for(int i=1; i<=40; i++)
 			addTestConfiguration( TEST_NAME+i, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME+i, new String[] { String.valueOf(i) }) );
 	}
 	
@@ -676,6 +677,21 @@ public class RowAggTmplTest extends AutomatedTestBase
 		testCodegenIntegration( TEST_NAME39, false, ExecType.SPARK );
 	}
 
+	@Test
+	public void testCodegenRowAggRewrite40CP() {
+		testCodegenIntegration( TEST_NAME40, true, ExecType.CP );
+	}
+
+	@Test
+	public void testCodegenRowAgg40CP() {
+		testCodegenIntegration( TEST_NAME40, false, ExecType.CP );
+	}
+
+	@Test
+	public void testCodegenRowAgg40SP() {
+		testCodegenIntegration( TEST_NAME40, false, ExecType.SPARK );
+	}
+
 	private void testCodegenIntegration( String testname, boolean rewrites, ExecType instType )
 	{
 		boolean oldFlag = OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION;

http://git-wip-us.apache.org/repos/asf/systemml/blob/ddaf166f/src/test/scripts/functions/codegen/cellwisetmpl21.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/cellwisetmpl21.R b/src/test/scripts/functions/codegen/cellwisetmpl21.R
new file mode 100644
index 0000000..f1ec8e4
--- /dev/null
+++ b/src/test/scripts/functions/codegen/cellwisetmpl21.R
@@ -0,0 +1,32 @@
+#-------------------------------------------------------------
+#
+# 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 = matrix(seq(7, 1006), 500, 2, byrow=TRUE);
+
+R1 = (X/3) %% 0.6;
+R2 = (X/3) %/% 0.6;
+R = (R1 > 0) * R2
+
+writeMM(as(R,"CsparseMatrix"), paste(args[2], "S", sep=""));

http://git-wip-us.apache.org/repos/asf/systemml/blob/ddaf166f/src/test/scripts/functions/codegen/cellwisetmpl21.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/cellwisetmpl21.dml b/src/test/scripts/functions/codegen/cellwisetmpl21.dml
new file mode 100644
index 0000000..3c91d16
--- /dev/null
+++ b/src/test/scripts/functions/codegen/cellwisetmpl21.dml
@@ -0,0 +1,28 @@
+#-------------------------------------------------------------
+#
+# 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 = matrix(seq(7, 1006), 500, 2);
+
+R1 = (X/3) %% 0.6;
+R2 = (X/3) %/% 0.6;
+R = (R1 > 0) * R2;
+
+write(R, $1)

http://git-wip-us.apache.org/repos/asf/systemml/blob/ddaf166f/src/test/scripts/functions/codegen/rowAggPattern40.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowAggPattern40.R b/src/test/scripts/functions/codegen/rowAggPattern40.R
new file mode 100644
index 0000000..694d5d8
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowAggPattern40.R
@@ -0,0 +1,33 @@
+#-------------------------------------------------------------
+#
+# 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")
+library("matrixStats")
+
+X = matrix(seq(1, 6000)/600, 300, 20, byrow=TRUE);
+
+Y = X/(rowSums(X)%*%matrix(1,1,ncol(X)))
+
+R = (X>0) * Y;
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "S", sep=""));

http://git-wip-us.apache.org/repos/asf/systemml/blob/ddaf166f/src/test/scripts/functions/codegen/rowAggPattern40.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowAggPattern40.dml b/src/test/scripts/functions/codegen/rowAggPattern40.dml
new file mode 100644
index 0000000..0138ecf
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowAggPattern40.dml
@@ -0,0 +1,28 @@
+#-------------------------------------------------------------
+#
+# 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 = matrix(seq(1, 6000)/600, 300, 20);
+
+Y = X/rowSums(X)
+
+R = (X>0) * Y;
+
+write(R, $1)