You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by lr...@apache.org on 2015/11/19 21:47:04 UTC

[22/50] [abbrv] incubator-systemml git commit: [SYSML-351] Enable unit tests in package functions.append to run in parallel

[SYSML-351] Enable unit tests in package functions.append to run in parallel

This applies the same pattern of changes made in SYSML-313 to package
com.ibm.bi.dml.test.integration.functions.append as described in document
attached to SYSML-286.

The package functions.append contains two relatively long tests
(AppendMatrix and AppendChain). When run as a suite, the set takes ~25 minutes
but when run in parallel ~15 minutes as mentioned in the 'Addtional Packages'
section of the document. Note the pom.xml change to disable the corresponding
Suite class will be handled in a separate PR to help minimize merge conflicts
as a few other PRs to be submitted to migrate other long-running packages.


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

Branch: refs/heads/master
Commit: dfca928ad5ae29f4a407d0f8671239bd600fd4b1
Parents: 81c3104
Author: Glenn Weidner <gw...@us.ibm.com>
Authored: Tue Nov 3 09:49:05 2015 -0300
Committer: Luciano Resende <lr...@apache.org>
Committed: Tue Nov 3 09:49:05 2015 -0300

----------------------------------------------------------------------
 .../functions/append/AppendChainTest.java          | 17 ++++++++---------
 .../functions/append/AppendMatrixTest.java         | 14 +++++++-------
 .../functions/append/AppendVectorTest.java         | 14 +++++++-------
 .../functions/append/StringAppendTest.java         | 10 +++++-----
 4 files changed, 27 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/dfca928a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendChainTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendChainTest.java b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendChainTest.java
index 91c06c7..c128b8a 100644
--- a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendChainTest.java
+++ b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendChainTest.java
@@ -35,6 +35,7 @@ public class AppendChainTest extends AutomatedTestBase
 	
 	private final static String TEST_NAME = "AppendChainTest";
 	private final static String TEST_DIR = "functions/append/";
+	private final static String TEST_CLASS_DIR = TEST_DIR + AppendChainTest.class.getSimpleName() + "/";
 
 	private final static double epsilon=0.0000000001;
 	private final static int min=1;
@@ -53,7 +54,7 @@ public class AppendChainTest extends AutomatedTestBase
 	@Override
 	public void setUp() {
 		TestUtils.clearAssertionInformation();
-		addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_DIR, TEST_NAME, 
+		addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME, 
 				new String[] {"C"}));
 	}
 
@@ -130,7 +131,7 @@ public class AppendChainTest extends AutomatedTestBase
 	 */
 	public void commonAppendTest(RUNTIME_PLATFORM platform, int rows, int cols1, int cols2, int cols3, boolean sparse)
 	{
-		TestConfiguration config = getTestConfiguration(TEST_NAME);
+		TestConfiguration config = getAndLoadTestConfiguration(TEST_NAME);
 	    
 		RUNTIME_PLATFORM prevPlfm=rtplatform;
 		boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG;
@@ -140,8 +141,6 @@ public class AppendChainTest extends AutomatedTestBase
 		    rtplatform = platform;
 		    if( rtplatform == RUNTIME_PLATFORM.SPARK )
 				DMLScript.USE_LOCAL_SPARK_CONFIG = true;
-	
-		    loadTestConfiguration(config);
 			
 	        config.addVariable("rows", rows);
 	        config.addVariable("cols", cols1);
@@ -149,17 +148,17 @@ public class AppendChainTest extends AutomatedTestBase
 			//This is for running the junit test the new way, i.e., construct the arguments directly
 			String RI_HOME = SCRIPT_DIR + TEST_DIR;
 			fullDMLScriptName = RI_HOME + TEST_NAME + ".dml";
-			programArgs = new String[]{"-args",  RI_HOME + INPUT_DIR + "A" , 
+			programArgs = new String[]{"-args",  input("A"), 
 					                             Long.toString(rows), 
 					                             Long.toString(cols1),
-								                 RI_HOME + INPUT_DIR + "B1" ,
+								                 input("B1"),
 								                 Long.toString(cols2),
-								                 RI_HOME + INPUT_DIR + "B2" ,
+								                 input("B2"),
 								                 Long.toString(cols3),
-		                                         RI_HOME + OUTPUT_DIR + "C" };
+		                                         output("C") };
 			fullRScriptName = RI_HOME + TEST_NAME + ".R";
 			rCmd = "Rscript" + " " + fullRScriptName + " " + 
-			       RI_HOME + INPUT_DIR + " "+ RI_HOME + EXPECTED_DIR;
+			       inputDir() + " "+ expectedDir();
 	
 			double sparsity = sparse ? sparsity2 : sparsity1; 
 			double sparsity2 = 1-sparsity;

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/dfca928a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendMatrixTest.java b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendMatrixTest.java
index 4a31170..b65fdd1 100644
--- a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendMatrixTest.java
+++ b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendMatrixTest.java
@@ -39,6 +39,7 @@ public class AppendMatrixTest extends AutomatedTestBase
 	
 	private final static String TEST_NAME = "AppendMatrixTest";
 	private final static String TEST_DIR = "functions/append/";
+	private final static String TEST_CLASS_DIR = TEST_DIR + AppendMatrixTest.class.getSimpleName() + "/";
 
 	private final static double epsilon=0.0000000001;
 	private final static int min=1;
@@ -66,7 +67,7 @@ public class AppendMatrixTest extends AutomatedTestBase
 	@Override
 	public void setUp() {
 		TestUtils.clearAssertionInformation();
-		addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_DIR, TEST_NAME, 
+		addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME, 
 				new String[] {"C"}));
 	}
 
@@ -212,7 +213,7 @@ public class AppendMatrixTest extends AutomatedTestBase
 	 */
 	public void commonAppendTest(RUNTIME_PLATFORM platform, int rows, int cols1, int cols2, boolean sparse, AppendMethod forcedAppendMethod)
 	{
-		TestConfiguration config = getTestConfiguration(TEST_NAME);
+		TestConfiguration config = getAndLoadTestConfiguration(TEST_NAME);
 	    
 		RUNTIME_PLATFORM prevPlfm=rtplatform;
 		
@@ -234,18 +235,17 @@ public class AppendMatrixTest extends AutomatedTestBase
 			/* This is for running the junit test the new way, i.e., construct the arguments directly */
 			String RI_HOME = SCRIPT_DIR + TEST_DIR;
 			fullDMLScriptName = RI_HOME + TEST_NAME + ".dml";
-			programArgs = new String[]{"-args",  RI_HOME + INPUT_DIR + "A" , 
+			programArgs = new String[]{"-args",  input("A"), 
 					                             Long.toString(rows), 
 					                             Long.toString(cols1),
-								                 RI_HOME + INPUT_DIR + "B" ,
+								                 input("B"),
 								                 Long.toString(cols2),
-		                                         RI_HOME + OUTPUT_DIR + "C" };
+		                                         output("C") };
 			fullRScriptName = RI_HOME + TEST_NAME + ".R";
 			rCmd = "Rscript" + " " + fullRScriptName + " " + 
-			       RI_HOME + INPUT_DIR + " "+ RI_HOME + EXPECTED_DIR;
+			       inputDir() + " " + expectedDir();
 	
 			Random rand=new Random(System.currentTimeMillis());
-			loadTestConfiguration(config);
 			double[][] A = getRandomMatrix(rows, cols1, min, max, sparsity, System.currentTimeMillis());
 	        writeInputMatrix("A", A, true);
 	        sparsity=rand.nextDouble();

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/dfca928a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendVectorTest.java b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendVectorTest.java
index 5067822..0610d10 100644
--- a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendVectorTest.java
+++ b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/AppendVectorTest.java
@@ -38,6 +38,7 @@ public class AppendVectorTest extends AutomatedTestBase
 	
 	private final static String TEST_NAME = "AppendVectorTest";
 	private final static String TEST_DIR = "functions/append/";
+	private final static String TEST_CLASS_DIR = TEST_DIR + AppendVectorTest.class.getSimpleName() + "/";
 
 	private final static double epsilon=0.0000000001;
 	private final static int rows1 = 1279;
@@ -49,7 +50,7 @@ public class AppendVectorTest extends AutomatedTestBase
 	
 	@Override
 	public void setUp() {
-		addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_DIR, TEST_NAME, 
+		addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME, 
 				new String[] {"C"}));
 	}
 	
@@ -86,7 +87,7 @@ public class AppendVectorTest extends AutomatedTestBase
 	
 	public void commonAppendTest(RUNTIME_PLATFORM platform, int rows, int cols)
 	{
-		TestConfiguration config = getTestConfiguration(TEST_NAME);
+		TestConfiguration config = getAndLoadTestConfiguration(TEST_NAME);
 	    
 		RUNTIME_PLATFORM prevPlfm=rtplatform;
 		
@@ -102,16 +103,15 @@ public class AppendVectorTest extends AutomatedTestBase
 			/* This is for running the junit test the new way, i.e., construct the arguments directly */
 			String RI_HOME = SCRIPT_DIR + TEST_DIR;
 			fullDMLScriptName = RI_HOME + TEST_NAME + ".dml";
-			programArgs = new String[]{"-explain", "-args",  RI_HOME + INPUT_DIR + "A" , 
+			programArgs = new String[]{"-explain", "-args",  input("A"), 
 					Long.toString(rows), Long.toString(cols),
-								RI_HOME + INPUT_DIR + "B" ,
-		                         RI_HOME + OUTPUT_DIR + "C" };
+								input("B"),
+		                        output("C") };
 			fullRScriptName = RI_HOME + TEST_NAME + ".R";
 			rCmd = "Rscript" + " " + fullRScriptName + " " + 
-			       RI_HOME + INPUT_DIR + " "+ RI_HOME + EXPECTED_DIR;
+			       inputDir() + " "+ expectedDir();
 	
 			Random rand=new Random(System.currentTimeMillis());
-			loadTestConfiguration(config);
 			double sparsity=rand.nextDouble();
 			double[][] A = getRandomMatrix(rows, cols, min, max, sparsity, System.currentTimeMillis());
 	        writeInputMatrix("A", A, true);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/dfca928a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/StringAppendTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/StringAppendTest.java b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/StringAppendTest.java
index df7e193..d4f3f6f 100644
--- a/src/test/java/com/ibm/bi/dml/test/integration/functions/append/StringAppendTest.java
+++ b/src/test/java/com/ibm/bi/dml/test/integration/functions/append/StringAppendTest.java
@@ -35,12 +35,13 @@ public class StringAppendTest extends AutomatedTestBase
 	private final static String TEST_NAME2 = "loop_string_append";
 		
 	private final static String TEST_DIR = "functions/append/";
+	private final static String TEST_CLASS_DIR = TEST_DIR + StringAppendTest.class.getSimpleName() + "/";
 
 	@Override
 	public void setUp() {
 		TestUtils.clearAssertionInformation();
-		addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_DIR, TEST_NAME1, new String[] {"S"}));
-		addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_DIR, TEST_NAME2, new String[] {"S"}));
+		addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] {"S"}));
+		addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] {"S"}));
 	}
 
 	@Test
@@ -118,13 +119,12 @@ public class StringAppendTest extends AutomatedTestBase
 		
 		try
 		{
-			TestConfiguration config = getTestConfiguration(TEST_NAME);			
-			loadTestConfiguration(config);
+			getAndLoadTestConfiguration(TEST_NAME);			
 			
 			String RI_HOME = SCRIPT_DIR + TEST_DIR;
 			fullDMLScriptName = RI_HOME + TEST_NAME + ".dml";
 			programArgs = new String[]{"-args",  Integer.toString(iters),
-					                             RI_HOME + OUTPUT_DIR + "C" };
+					                             output("C") };
 			
 			runTest(true, exceptionExpected, DMLException.class, 0);
 		}