You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by na...@apache.org on 2017/07/07 18:23:32 UTC

systemml git commit: Write output of systemml run from perf test scripts

Repository: systemml
Updated Branches:
  refs/heads/master c5a330d7d -> 152eba1a7


Write output of systemml run from perf test scripts

Closes #561


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

Branch: refs/heads/master
Commit: 152eba1a7d5de2d34ab97db7d49596b41569aeb5
Parents: c5a330d
Author: Nakul Jindal <na...@gmail.com>
Authored: Fri Jul 7 11:23:17 2017 -0700
Committer: Nakul Jindal <na...@gmail.com>
Committed: Fri Jul 7 11:23:18 2017 -0700

----------------------------------------------------------------------
 scripts/perftest/python/run_perftest.py | 10 +++++-----
 scripts/perftest/python/utils.py        | 18 +++++++++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/152eba1a/scripts/perftest/python/run_perftest.py
----------------------------------------------------------------------
diff --git a/scripts/perftest/python/run_perftest.py b/scripts/perftest/python/run_perftest.py
index dcc52c8..b0257d4 100755
--- a/scripts/perftest/python/run_perftest.py
+++ b/scripts/perftest/python/run_perftest.py
@@ -82,7 +82,7 @@ ML_PREDICT = {'Kmeans': 'Kmeans-predict',
 
 
 # Responsible for execution and metric logging
-def algorithm_workflow(algo, exec_type, config_path, file_name, action_mode):
+def algorithm_workflow(algo, exec_type, config_path, dml_file_name, action_mode):
     """
     This function is responsible for overall workflow. This does the following actions
     Check if the input is key value argument or list of positional args
@@ -99,7 +99,7 @@ def algorithm_workflow(algo, exec_type, config_path, file_name, action_mode):
     config_path : String
     Path to read the json file from
 
-    file_name : String
+    dml_file_name : String
     DML file name to be used while processing the arguments give
 
     action_mode : String
@@ -116,8 +116,8 @@ def algorithm_workflow(algo, exec_type, config_path, file_name, action_mode):
         list_args = ' '.join(config_data)
         args = {'-args': list_args}
 
-    folder_name = config_path.split('/')[-1]
-    mat_type, mat_shape, intercept = get_folder_metrics(folder_name, action_mode)
+    config_file_name = config_path.split('/')[-1]
+    mat_type, mat_shape, intercept = get_folder_metrics(config_file_name, action_mode)
 
     exit_flag_success = get_existence(config_path, action_mode)
 
@@ -125,7 +125,7 @@ def algorithm_workflow(algo, exec_type, config_path, file_name, action_mode):
         print('data already exists {}'.format(config_path))
         time = 'data_exists'
     else:
-        time = exec_dml_and_parse_time(exec_type, file_name, args)
+        time = exec_dml_and_parse_time(exec_type, dml_file_name, config_file_name,  args)
 
     # Write a _SUCCESS file only if time is found and in data-gen action_mode
     if len(time.split('.')) == 2 and action_mode == 'data-gen':

http://git-wip-us.apache.org/repos/asf/systemml/blob/152eba1a/scripts/perftest/python/utils.py
----------------------------------------------------------------------
diff --git a/scripts/perftest/python/utils.py b/scripts/perftest/python/utils.py
index 7ff3b54..464d7f6 100755
--- a/scripts/perftest/python/utils.py
+++ b/scripts/perftest/python/utils.py
@@ -138,7 +138,7 @@ def get_existence(path, action_mode):
     return exist
 
 
-def exec_dml_and_parse_time(exec_type, file_name, args, Time=True):
+def exec_dml_and_parse_time(exec_type, dml_file_name, execution_output_file, args, Time=True):
     """
     This function is responsible of execution of input arguments via python sub process,
     We also extract time obtained from the output of this subprocess
@@ -146,9 +146,12 @@ def exec_dml_and_parse_time(exec_type, file_name, args, Time=True):
     exec_type: String
     Contains the execution type singlenode / hybrid_spark
 
-    file_name: String
+    dml_file_name: String
     DML file name to be used while processing the arguments give
 
+    execution_output_file: String
+    Name of the file where the output of the DML run is written out
+
     args: Dictionary
     Key values pairs depending on the arg type
 
@@ -156,7 +159,7 @@ def exec_dml_and_parse_time(exec_type, file_name, args, Time=True):
     Boolean argument used to extract time from raw output logs.
     """
 
-    algorithm = file_name + '.dml'
+    algorithm = dml_file_name + '.dml'
     if exec_type == 'singlenode':
         exec_script = join(os.environ.get('SYSTEMML_HOME'), 'bin', 'systemml-standalone.py')
 
@@ -189,11 +192,15 @@ def exec_dml_and_parse_time(exec_type, file_name, args, Time=True):
         out1, err1 = proc1.communicate()
 
         if "Error" in str(err1):
-            print('Error Found in {}'.format(file_name))
+            print('Error Found in {}'.format(dml_file_name))
             total_time = 'failure'
         else:
             total_time = parse_time(proc1_log)
 
+        with open(execution_output_file, 'w') as f:
+            for row in proc1_log:
+                f.write("%s\n" % str(row))
+
     else:
         total_time = 'not_specified'
 
@@ -242,7 +249,8 @@ def exec_test_data(exec_type, path):
     args = {'-args': ' '.join([X, Y, X_test, Y_test, 'csv'])}
 
     # Call the exec script without time
-    exec_dml_and_parse_time(exec_type, test_split_script, args, False)
+    config_file_name = path.split('/')[-1]
+    exec_dml_and_parse_time(exec_type, test_split_script, config_file_name, args, False)
 
 
 def check_predict(current_algo, ML_PREDICT):