Repository: systemml
Updated Branches:
  refs/heads/master ce9e42fef -> 82e42957f


[MINOR] Cleanup jmlc build lite jar tests, incl remove temp files

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

Branch: refs/heads/master
Commit: 82e42957f7e1a2e3d7a9c1e4f6685b52db61c9b4
Parents: ce9e42f
Author: Matthias Boehm <[email protected]>
Authored: Thu Jan 18 11:51:30 2018 -0800
Committer: Matthias Boehm <[email protected]>
Committed: Thu Jan 18 11:51:30 2018 -0800

----------------------------------------------------------------------
 A.csv                                           |   3 -
 A.csv.mtd                                       |  12 ----
 B.csv                                           |   3 -
 B.csv.mtd                                       |  12 ----
 functions/jmlc/temp/m.binary                    | Bin 255 -> 0 bytes
 functions/jmlc/temp/m.binary.mtd                |  12 ----
 functions/jmlc/temp/m.csv                       |   4 --
 functions/jmlc/temp/m.csv.mtd                   |  12 ----
 functions/jmlc/temp/m.mm                        |   8 ---
 functions/jmlc/temp/m.txt                       |   6 --
 functions/jmlc/temp/m.txt.mtd                   |  10 ---
 functions/jmlc/temp/scoring-example.dml         |  12 ----
 functions/jmlc/temp/x.csv                       |   2 -
 functions/jmlc/temp/x.csv.mtd                   |  12 ----
 .../sysml/utils/lite/BuildLiteExecution.java    |  65 ++++++++-----------
 .../functions/jmlc/BuildLiteJarTest.java        |   7 +-
 16 files changed, 34 insertions(+), 146 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/A.csv
----------------------------------------------------------------------
diff --git a/A.csv b/A.csv
deleted file mode 100644
index e214f8a..0000000
--- a/A.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-0.0146817556045713,0.5112049868172497
-1.8844105118944472,1.575721197916694
-0.31179904293595984,1.9060943669721677

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/A.csv.mtd
----------------------------------------------------------------------
diff --git a/A.csv.mtd b/A.csv.mtd
deleted file mode 100644
index 268160d..0000000
--- a/A.csv.mtd
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "data_type": "matrix",
-    "value_type": "double",
-    "rows": 3,
-    "cols": 2,
-    "nnz": 6,
-    "format": "csv",
-    "header": false,
-    "sep": ",",
-    "author": "mboehm",
-    "created": "2018-01-16 16:09:58 PST"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/B.csv
----------------------------------------------------------------------
diff --git a/B.csv b/B.csv
deleted file mode 100644
index 58a7cea..0000000
--- a/B.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-0.0146817556045713,0.5112049868172497,1.0,0,1.0,2.5258867424218208
-1.8844105118944472,1.575721197916694,1.0,1.0,1.8844105118944472,7.344542221705589
-0.31179904293595984,1.9060943669721677,1.0,2.0,2.0,7.217893409908127

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/B.csv.mtd
----------------------------------------------------------------------
diff --git a/B.csv.mtd b/B.csv.mtd
deleted file mode 100644
index 961e590..0000000
--- a/B.csv.mtd
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "data_type": "matrix",
-    "value_type": "double",
-    "rows": 3,
-    "cols": 6,
-    "nnz": 17,
-    "format": "csv",
-    "header": false,
-    "sep": ",",
-    "author": "mboehm",
-    "created": "2018-01-16 16:09:58 PST"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/m.binary
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/m.binary b/functions/jmlc/temp/m.binary
deleted file mode 100644
index 4455f9e..0000000
Binary files a/functions/jmlc/temp/m.binary and /dev/null differ

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/m.binary.mtd
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/m.binary.mtd b/functions/jmlc/temp/m.binary.mtd
deleted file mode 100644
index 31f6d06..0000000
--- a/functions/jmlc/temp/m.binary.mtd
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "data_type": "matrix",
-    "value_type": "double",
-    "rows": 4,
-    "cols": 3,
-    "rows_in_block": 1000,
-    "cols_in_block": 1000,
-    "nnz": 6,
-    "format": "binary",
-    "author": "mboehm",
-    "created": "2018-01-16 16:10:56 PST"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/m.csv
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/m.csv b/functions/jmlc/temp/m.csv
deleted file mode 100644
index 37aea08..0000000
--- a/functions/jmlc/temp/m.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-1.0,2.0,3.0
-0,0,0
-7.0,8.0,9.0
-0,0,0

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/m.csv.mtd
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/m.csv.mtd b/functions/jmlc/temp/m.csv.mtd
deleted file mode 100644
index 2dce672..0000000
--- a/functions/jmlc/temp/m.csv.mtd
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "data_type": "matrix",
-    "value_type": "double",
-    "rows": 4,
-    "cols": 3,
-    "nnz": 6,
-    "format": "csv",
-    "header": false,
-    "sep": ",",
-    "author": "mboehm",
-    "created": "2018-01-16 16:10:56 PST"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/m.mm
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/m.mm b/functions/jmlc/temp/m.mm
deleted file mode 100644
index f7ae3bf..0000000
--- a/functions/jmlc/temp/m.mm
+++ /dev/null
@@ -1,8 +0,0 @@
-%%MatrixMarket matrix coordinate real general
-4 3 6
-1 1 1.0
-1 2 2.0
-1 3 3.0
-3 1 7.0
-3 2 8.0
-3 3 9.0

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/m.txt
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/m.txt b/functions/jmlc/temp/m.txt
deleted file mode 100644
index e11b21c..0000000
--- a/functions/jmlc/temp/m.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-1 1 1.0
-1 2 2.0
-1 3 3.0
-3 1 7.0
-3 2 8.0
-3 3 9.0

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/m.txt.mtd
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/m.txt.mtd b/functions/jmlc/temp/m.txt.mtd
deleted file mode 100644
index ed6376f..0000000
--- a/functions/jmlc/temp/m.txt.mtd
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-    "data_type": "matrix",
-    "value_type": "double",
-    "rows": 4,
-    "cols": 3,
-    "nnz": 6,
-    "format": "text",
-    "author": "mboehm",
-    "created": "2018-01-16 16:10:56 PST"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/scoring-example.dml
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/scoring-example.dml 
b/functions/jmlc/temp/scoring-example.dml
deleted file mode 100644
index d45d95d..0000000
--- a/functions/jmlc/temp/scoring-example.dml
+++ /dev/null
@@ -1,12 +0,0 @@
-X = read("./tmp/X", rows=-1, cols=-1);
-W = read("./tmp/W", rows=-1, cols=-1);
-
-numRows = nrow(X);
-numCols = ncol(X);
-b = W[numCols+1,]
-scores = X %*% W[1:numCols,] + b;
-predicted_y = rowIndexMax(scores);
-
-print('pred:' + toString(predicted_y))
-
-write(predicted_y, "./tmp", format="text");

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/x.csv
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/x.csv b/functions/jmlc/temp/x.csv
deleted file mode 100644
index e055049..0000000
--- a/functions/jmlc/temp/x.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-1.0,2.0
-3.0,4.0

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/functions/jmlc/temp/x.csv.mtd
----------------------------------------------------------------------
diff --git a/functions/jmlc/temp/x.csv.mtd b/functions/jmlc/temp/x.csv.mtd
deleted file mode 100644
index a350176..0000000
--- a/functions/jmlc/temp/x.csv.mtd
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "data_type": "matrix",
-    "value_type": "double",
-    "rows": 2,
-    "cols": 2,
-    "nnz": 4,
-    "format": "csv",
-    "header": false,
-    "sep": ",",
-    "author": "mboehm",
-    "created": "2018-01-16 16:10:56 PST"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/src/main/java/org/apache/sysml/utils/lite/BuildLiteExecution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/utils/lite/BuildLiteExecution.java 
b/src/main/java/org/apache/sysml/utils/lite/BuildLiteExecution.java
index d687a1d..7b0d349 100644
--- a/src/main/java/org/apache/sysml/utils/lite/BuildLiteExecution.java
+++ b/src/main/java/org/apache/sysml/utils/lite/BuildLiteExecution.java
@@ -44,10 +44,19 @@ import org.apache.sysml.runtime.util.DataConverter;
  * the execution of that code.
  *
  */
-public class BuildLiteExecution {
-
+public class BuildLiteExecution 
+{
        private static Logger log = Logger.getLogger(BuildLiteExecution.class);
        private static final String ROOT = "functions/jmlc/temp/";
+       private static String _rootPrefix = null;
+       
+       public static void setRootPrefix(String prefix) {
+               _rootPrefix = prefix;
+       }
+       
+       public static String getRoot() {
+               return (_rootPrefix != null) ? _rootPrefix + ROOT : ROOT;
+       }
        
        public static void main(String[] args) throws Exception {
 
@@ -79,7 +88,6 @@ public class BuildLiteExecution {
        }
 
        public static void jmlcScoringExample() throws Exception {
-               /* @formatter:off */
                String scriptString =
                "X = read(\"./tmp/X\", rows=-1, cols=-1);\n" +
                "W = read(\"./tmp/W\", rows=-1, cols=-1);\n" +
@@ -93,15 +101,15 @@ public class BuildLiteExecution {
                "print('pred:' + toString(predicted_y))\n" +
                "\n" +
                "write(predicted_y, \"./tmp\", format=\"text\");\n";
-               /* @formatter:on */
 
-               File file = new File(ROOT+"scoring-example.dml");
+               File file = new File(getRoot()+"scoring-example.dml");
+               System.out.println(file.toString());
                FileUtils.writeStringToFile(file, scriptString);
 
                Connection conn = getConfiguredConnection();
-               String dml = conn.readScript(ROOT+"scoring-example.dml");
-               PreparedScript script = conn.prepareScript(dml, new String[] { 
"W", "X" }, new String[] { "predicted_y" },
-                               false);
+               String dml = conn.readScript(getRoot()+"scoring-example.dml");
+               PreparedScript script = conn.prepareScript(dml,
+                       new String[] { "W", "X" }, new String[] { "predicted_y" 
}, false);
 
                double[][] mtx = matrix(4, 3, new double[] { 1, 2, 3, 4, 5, 6, 
7, 8, 9 });
                double[][] result = null;
@@ -132,8 +140,8 @@ public class BuildLiteExecution {
                Map<String, String> m = new HashMap<>();
                m.put("$CONSOLE_OUTPUT", "TRUE");
 
-               PreparedScript script = conn.prepareScript(dml, m, new String[] 
{ "A", "K" }, new String[] { "baseStats" },
-                               false);
+               PreparedScript script = conn.prepareScript(dml,
+                       m, new String[] { "A", "K" }, new String[] { 
"baseStats" }, false);
 
                double[][] data = new double[100][4];
                for (int i = 0; i < 100; i++) {
@@ -159,18 +167,16 @@ public class BuildLiteExecution {
        public static void jmlcWriteMatrix() throws Exception {
                Connection conn = getConfiguredConnection();
                PreparedScript script = conn.prepareScript(
-                               "x=matrix('1 2 3 
4',rows=2,cols=2);write(x,'"+ROOT+"x.csv',format='csv');", new String[] {},
+                               "x=matrix('1 2 3 
4',rows=2,cols=2);write(x,'"+getRoot()+"x.csv',format='csv');", new String[] {},
                                new String[] {}, false);
                script.executeScript();
 
-               /* @formatter:off */
                String scriptString =
                "m = matrix('1 2 3 0 0 0 7 8 9 0 0 0', rows=4, cols=3)\n" +
-               "write(m, '"+ROOT+"m.txt', format='text')\n" +
-               "write(m, '"+ROOT+"m.mm', format='mm')\n" +
-               "write(m, '"+ROOT+"m.csv', format='csv')\n" +
-               "write(m, '"+ROOT+"m.binary', format='binary')\n";
-               /* @formatter:on */
+               "write(m, '"+getRoot()+"m.txt', format='text')\n" +
+               "write(m, '"+getRoot()+"m.mm', format='mm')\n" +
+               "write(m, '"+getRoot()+"m.csv', format='csv')\n" +
+               "write(m, '"+getRoot()+"m.binary', format='binary')\n";
 
                script = conn.prepareScript(scriptString, new String[] {}, new 
String[] {}, false);
                script.executeScript();
@@ -180,12 +186,11 @@ public class BuildLiteExecution {
 
        public static void jmlcReadMatrix() throws Exception {
                Connection conn = getConfiguredConnection();
-               PreparedScript script = 
conn.prepareScript("x=read('"+ROOT+"x.csv',format='csv');y=x*2;print(toString(y));",
+               PreparedScript script = 
conn.prepareScript("x=read('"+getRoot()+"x.csv',format='csv');y=x*2;print(toString(y));",
                                new String[] {}, new String[] {}, false);
                script.executeScript();
-
-               /* @formatter:off */
-               String scriptString = "m = 
read('"+ROOT+"m.csv',format='csv')\n" +
+               
+               String scriptString = "m = 
read('"+getRoot()+"m.csv',format='csv')\n" +
                "print(toString(m))\n" +
                "print('min:' + min(m))\n" +
                "print('max:' + max(m))\n" +
@@ -198,17 +203,6 @@ public class BuildLiteExecution {
                "for (i in 1:ncol(mColSums)) {\n" +
                "    print('col ' + i + ' sum:' + as.scalar(mColSums[1,i]))\n" +
                "}\n";
-               
-               // note: the following can be set to work using the following 
setting
-               // in the Connection class: 
cconf.set(ConfigType.IGNORE_READ_WRITE_METADATA, false);
-               
-               // "m2=read('"+ROOT+"m.txt', format='text')\n" +
-               // "m3=read('"+ROOT+"m.mm', format='mm')\n" +
-               // "m4=read('"+ROOT+"m.binary', format='binary')\n" +
-               // "print('m2:'+toString(m2))\n" +
-               // "print('m3:'+toString(m3))\n" +
-               // "print('m4:'+toString(m4))\n";
-               /* @formatter:on */
 
                script = conn.prepareScript(scriptString, new String[] {}, new 
String[] {}, false);
                script.executeScript();
@@ -218,7 +212,6 @@ public class BuildLiteExecution {
 
        public static void jmlcBasics() throws Exception {
 
-               /* @formatter:off */
                String dml =
                "A = matrix(\"1 2 3 4 5 6\", rows=3, cols=2)\n"+
                "print(toString(A))\n"+
@@ -274,9 +267,8 @@ public class BuildLiteExecution {
                "\n"+
                "A = rand(rows=3, cols=2, min=0, max=2) # random 3x2 matrix 
with values 0 to 2\n"+
                "B = doSomething(A)\n"+
-               "write(A, \"A.csv\", format=\"csv\")\n"+
-               "write(B, \"B.csv\", format=\"csv\")\n";
-               /* @formatter:on */
+               "write(A, \""+getRoot()+"A.csv\", format=\"csv\")\n"+
+               "write(B, \""+getRoot()+"B.csv\", format=\"csv\")\n";
 
                Connection conn = getConfiguredConnection();
                PreparedScript script = conn.prepareScript(dml, new String[] 
{}, new String[] {}, false);
@@ -705,5 +697,4 @@ public class BuildLiteExecution {
                                ConfigType.PARALLEL_CP_MATRIX_OPERATIONS);
                return conn;
        }
-
 }

http://git-wip-us.apache.org/repos/asf/systemml/blob/82e42957/src/test/java/org/apache/sysml/test/integration/functions/jmlc/BuildLiteJarTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/sysml/test/integration/functions/jmlc/BuildLiteJarTest.java
 
b/src/test/java/org/apache/sysml/test/integration/functions/jmlc/BuildLiteJarTest.java
index 620435e..758ef8c 100644
--- 
a/src/test/java/org/apache/sysml/test/integration/functions/jmlc/BuildLiteJarTest.java
+++ 
b/src/test/java/org/apache/sysml/test/integration/functions/jmlc/BuildLiteJarTest.java
@@ -27,7 +27,7 @@ public class BuildLiteJarTest extends AutomatedTestBase
 {
        @Override
        public void setUp() {
-               //do nothing
+               BuildLiteExecution.setRootPrefix(baseDirectory);
        }
        
        @Test
@@ -80,4 +80,9 @@ public class BuildLiteJarTest extends AutomatedTestBase
        public void testJMLCTests() throws Exception {
                BuildLiteExecution.jmlcTests();
        }
+       
+       @Override
+       public void tearDown() {
+               BuildLiteExecution.setRootPrefix(null);
+       }
 }

Reply via email to