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 2017/07/15 04:15:32 UTC

[06/23] systemml git commit: Add tests for sum(A*A*A).

Add tests for sum(A*A*A).

Reduced number of rows and columns in order to decrease test time.


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

Branch: refs/heads/master
Commit: edbac3b6c4361799da32cef89c8ee4e29e187c9d
Parents: f005d94
Author: Dylan Hutchison <dh...@cs.washington.edu>
Authored: Fri Jun 9 22:23:02 2017 -0700
Committer: Dylan Hutchison <dh...@cs.washington.edu>
Committed: Sun Jun 18 17:43:26 2017 -0700

----------------------------------------------------------------------
 .../ternary/ABATernaryAggregateTest.java        | 159 ++++++++++++++++++-
 .../functions/ternary/AAATernaryAggregateC.R    |  31 ++++
 .../functions/ternary/AAATernaryAggregateC.dml  |  28 ++++
 .../functions/ternary/AAATernaryAggregateRC.R   |  32 ++++
 .../functions/ternary/AAATernaryAggregateRC.dml |  29 ++++
 .../functions/ternary/ABATernaryAggregateC.dml  |   1 -
 6 files changed, 274 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/edbac3b6/src/test/java/org/apache/sysml/test/integration/functions/ternary/ABATernaryAggregateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/ternary/ABATernaryAggregateTest.java b/src/test/java/org/apache/sysml/test/integration/functions/ternary/ABATernaryAggregateTest.java
index 198e9f4..1829bf0 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/ternary/ABATernaryAggregateTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/ternary/ABATernaryAggregateTest.java
@@ -42,13 +42,15 @@ public class ABATernaryAggregateTest extends AutomatedTestBase
 {
 	private final static String TEST_NAME1 = "ABATernaryAggregateRC";
 	private final static String TEST_NAME2 = "ABATernaryAggregateC";
+	private final static String TEST_NAME3 = "AAATernaryAggregateRC";
+	private final static String TEST_NAME4 = "AAATernaryAggregateC";
 	
 	private final static String TEST_DIR = "functions/ternary/";
 	private final static String TEST_CLASS_DIR = TEST_DIR + ABATernaryAggregateTest.class.getSimpleName() + "/";
 	private final static double eps = 1e-8;
 	
-	private final static int rows = 1111;
-	private final static int cols = 1011;
+	private final static int rows = 111;
+	private final static int cols = 101;
 	
 	private final static double sparsity1 = 0.7;
 	private final static double sparsity2 = 0.3;
@@ -57,7 +59,9 @@ public class ABATernaryAggregateTest extends AutomatedTestBase
 	public void setUp() {
 		TestUtils.clearAssertionInformation();
 		addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "R" }) ); 
-		addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "R" }) ); 
+		addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "R" }) );
+		addTestConfiguration(TEST_NAME3, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME3, new String[] { "R" }) );
+		addTestConfiguration(TEST_NAME4, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME4, new String[] { "R" }) );
 	}
 
 	@Test
@@ -201,6 +205,151 @@ public class ABATernaryAggregateTest extends AutomatedTestBase
 	public void testTernaryAggregateCSparseMatrixCPNoRewrite() {
 		runTernaryAggregateTest(TEST_NAME2, true, false, false, ExecType.CP);
 	}
+
+
+	// another set of tests for the case of sum(A*A*A)
+
+	@Test
+	public void testTernaryAggregateRCDenseVectorCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, true, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseVectorCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, true, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateRCDenseMatrixCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, false, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseMatrixCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, false, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateRCDenseVectorSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, true, true, ExecType.SPARK);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseVectorSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, true, true, ExecType.SPARK);
+	}
+
+	@Test
+	public void testTernaryAggregateRCDenseMatrixSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, false, true, ExecType.SPARK);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseMatrixSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, false, true, ExecType.SPARK);
+	}
+
+	@Test
+	public void testTernaryAggregateRCDenseVectorMR_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, true, true, ExecType.MR);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseVectorMR_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, true, true, ExecType.MR);
+	}
+
+	@Test
+	public void testTernaryAggregateRCDenseMatrixMR_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, false, true, ExecType.MR);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseMatrixMR_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, false, true, ExecType.MR);
+	}
+
+	@Test
+	public void testTernaryAggregateCDenseVectorCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, false, true, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCSparseVectorCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, true, true, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCDenseMatrixCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, false, false, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCSparseMatrixCP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, true, false, true, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCDenseVectorSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, false, true, true, ExecType.SPARK);
+	}
+
+	@Test
+	public void testTernaryAggregateCSparseVectorSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, true, true, true, ExecType.SPARK);
+	}
+
+	@Test
+	public void testTernaryAggregateCDenseMatrixSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, false, false, true, ExecType.SPARK);
+	}
+
+	@Test
+	public void testTernaryAggregateCSparseMatrixSP_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, true, false, true, ExecType.SPARK);
+	}
+
+	//additional tests to check default without rewrites
+
+	@Test
+	public void testTernaryAggregateRCDenseVectorCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, true, false, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseVectorCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, true, false, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateRCDenseMatrixCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, false, false, false, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateRCSparseMatrixCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME3, true, false, false, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCDenseVectorCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, false, true, false, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCSparseVectorCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, true, true, false, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCDenseMatrixCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, false, false, false, ExecType.CP);
+	}
+
+	@Test
+	public void testTernaryAggregateCSparseMatrixCPNoRewrite_AAA() {
+		runTernaryAggregateTest(TEST_NAME4, true, false, false, ExecType.CP);
+	}
 	
 	
 	
@@ -230,7 +379,7 @@ public class ABATernaryAggregateTest extends AutomatedTestBase
 
 			String HOME = SCRIPT_DIR + TEST_DIR;
 			fullDMLScriptName = HOME + testname + ".dml";
-			programArgs = new String[]{"-explain","hops","-stats","-args", input("A"), output("R")};
+			programArgs = new String[]{"-explain","-stats","-args", input("A"), output("R")};
 			
 			fullRScriptName = HOME + testname + ".R";
 			rCmd = "Rscript" + " " + fullRScriptName + " " + 
@@ -254,7 +403,7 @@ public class ABATernaryAggregateTest extends AutomatedTestBase
 			//check for rewritten patterns in statistics output
 			if( rewrites && et != ExecType.MR ) {
 				String opcode = ((et == ExecType.SPARK) ? Instruction.SP_INST_PREFIX : "") + 
-					(((testname.equals(TEST_NAME1) || vectors ) ? "tak+*" : "tack+*"));
+					(((testname.equals(TEST_NAME1) || testname.equals(TEST_NAME3) || vectors ) ? "tak+*" : "tack+*"));
 				Assert.assertTrue(Statistics.getCPHeavyHitterOpCodes().contains(opcode));
 			}
 		}

http://git-wip-us.apache.org/repos/asf/systemml/blob/edbac3b6/src/test/scripts/functions/ternary/AAATernaryAggregateC.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/ternary/AAATernaryAggregateC.R b/src/test/scripts/functions/ternary/AAATernaryAggregateC.R
new file mode 100644
index 0000000..a096c2b
--- /dev/null
+++ b/src/test/scripts/functions/ternary/AAATernaryAggregateC.R
@@ -0,0 +1,31 @@
+#-------------------------------------------------------------
+#
+# 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")
+
+A = as.matrix(readMM(paste(args[1], "A.mtx", sep="")))
+
+R = t(as.matrix(colSums(A * A * A)));
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/systemml/blob/edbac3b6/src/test/scripts/functions/ternary/AAATernaryAggregateC.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/ternary/AAATernaryAggregateC.dml b/src/test/scripts/functions/ternary/AAATernaryAggregateC.dml
new file mode 100644
index 0000000..b576a4d
--- /dev/null
+++ b/src/test/scripts/functions/ternary/AAATernaryAggregateC.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.
+#
+#-------------------------------------------------------------
+
+A = read($1);
+
+if(1==1){}
+
+R = colSums(A * A * A);
+
+write(R, $2);

http://git-wip-us.apache.org/repos/asf/systemml/blob/edbac3b6/src/test/scripts/functions/ternary/AAATernaryAggregateRC.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/ternary/AAATernaryAggregateRC.R b/src/test/scripts/functions/ternary/AAATernaryAggregateRC.R
new file mode 100644
index 0000000..776ddd0
--- /dev/null
+++ b/src/test/scripts/functions/ternary/AAATernaryAggregateRC.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")
+
+A = as.matrix(readMM(paste(args[1], "A.mtx", sep="")))
+
+s = sum(A * A * A);
+R = as.matrix(s);
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/systemml/blob/edbac3b6/src/test/scripts/functions/ternary/AAATernaryAggregateRC.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/ternary/AAATernaryAggregateRC.dml b/src/test/scripts/functions/ternary/AAATernaryAggregateRC.dml
new file mode 100644
index 0000000..7283703
--- /dev/null
+++ b/src/test/scripts/functions/ternary/AAATernaryAggregateRC.dml
@@ -0,0 +1,29 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+A = read($1);
+
+if(1==1){}
+
+s = sum(A * A * A);
+R = as.matrix(s);
+
+write(R, $2);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/systemml/blob/edbac3b6/src/test/scripts/functions/ternary/ABATernaryAggregateC.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/ternary/ABATernaryAggregateC.dml b/src/test/scripts/functions/ternary/ABATernaryAggregateC.dml
index 78285af..737b409 100644
--- a/src/test/scripts/functions/ternary/ABATernaryAggregateC.dml
+++ b/src/test/scripts/functions/ternary/ABATernaryAggregateC.dml
@@ -21,7 +21,6 @@
 
 A = read($1);
 B = A * 2;
-C = A * 3;
 
 if(1==1){}