Repository: systemml
Updated Branches:
  refs/heads/master c022f1a5a -> 54f5ea975


[MINOR] Fixes bug causing stats output to be cleared in JMLC

Closes #843.


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

Branch: refs/heads/master
Commit: 54f5ea975f5e5a209d7b016c52c10e61bf02af7e
Parents: c022f1a
Author: Anthony Thomas <[email protected]>
Authored: Mon Nov 12 18:56:31 2018 +0530
Committer: Niketan Pansare <[email protected]>
Committed: Mon Nov 12 18:57:34 2018 +0530

----------------------------------------------------------------------
 docs/jmlc.md                                              | 10 +++++-----
 .../java/org/apache/sysml/api/jmlc/PreparedScript.java    |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/54f5ea97/docs/jmlc.md
----------------------------------------------------------------------
diff --git a/docs/jmlc.md b/docs/jmlc.md
index 08d1688..e0d72ea 100644
--- a/docs/jmlc.md
+++ b/docs/jmlc.md
@@ -53,7 +53,7 @@ dependent on the nature of the business use case being 
addressed.
 
 JMLC can be configured to gather runtime statistics, as in the MLContext API, 
by calling Connection's `setStatistics()`
 method with a value of `true`. JMLC can also be configured to gather 
statistics on the memory used by matrices and
-frames in the DML script. To enable collection of memory statistics, call 
Connection's `gatherMemStats()` method
+frames in the DML script. To enable collection of memory statistics, call 
PreparedScript's `gatherMemStats()` method
 with a value of `true`. When finegrained statistics are enabled in 
`SystemML.conf`, JMLC will also report the variables
 in the DML script which used the most memory. An example showing how to enable 
statistics in JMLC is presented in the
 section below.
@@ -122,10 +122,6 @@ the resulting `"predicted_y"` matrix. We repeat this 
process. When done, we clos
  
         // obtain connection to SystemML
         Connection conn = new Connection();
-
-        // turn on gathering of runtime statistics and memory use
-        conn.setStatistics(true);
-        conn.gatherMemStats(true);
  
         // read in and precompile DML script, registering inputs and outputs
         String dml = conn.readScript("scoring-example.dml");
@@ -135,6 +131,10 @@ the resulting `"predicted_y"` matrix. We repeat this 
process. When done, we clos
         String plan = script.explain();
         System.out.println(plan);
 
+        // turn on gathering of runtime statistics and memory use
+        script.setStatistics(true);
+        script.gatherMemStats(true);
+
         double[][] mtx = matrix(4, 3, new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 
});
         double[][] result = null;
  

http://git-wip-us.apache.org/repos/asf/systemml/blob/54f5ea97/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java 
b/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java
index edbd5bf..701af30 100644
--- a/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java
+++ b/src/main/java/org/apache/sysml/api/jmlc/PreparedScript.java
@@ -454,6 +454,10 @@ public class PreparedScript implements ConfigurableAPI
                //add reused variables
                _vars.putAll(_inVarReuse);
 
+               // clear thread local configurations (left over from previous 
run)
+               ConfigurationManager.clearLocalConfigs();
+               ConfigurationManager.resetStatistics();
+
                //set thread-local configurations
                ConfigurationManager.setLocalConfig(_dmlconf);
                ConfigurationManager.setLocalConfig(_cconf);
@@ -475,10 +479,6 @@ public class PreparedScript implements ConfigurableAPI
                                rvars.addResult(ovar, tmpVar);
                }
 
-               // clear prior thread local configurations (for subsequent run)
-               ConfigurationManager.clearLocalConfigs();
-               ConfigurationManager.resetStatistics();
-
                return rvars;
        }
        

Reply via email to