Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[Gathering results of all experiments] Added infrastructure to gather…

… results of all runs of an experiment
  • Loading branch information...
commit b7f48c9e3e3773376d5099c7368d679fd8fd2bb8 1 parent 1a17fa7
authored
0  results/.DO_NOT_DELETE
No changes.
50  run_tests.py → tools/run_tests.py
@@ -6,6 +6,7 @@
6 6
 # Import other configuration parameters from carbon_sim.cfg that you want
7 7
 # to change
8 8
 
  9
+import os
9 10
 import re
10 11
 import sys
11 12
 import subprocess
@@ -29,7 +30,12 @@ def parse_config_file_params(tests_config_filename):
29 30
    parsing_app_list = 0
30 31
    parsing_pintool_params = 0
31 32
 
32  
-   tests_config = open(tests_config_filename,"r").readlines()
  33
+   try:
  34
+      tests_config = open(tests_config_filename,"r").readlines()
  35
+   except IOError:
  36
+      print "Cannot Open File: %s" % tests_config_filename
  37
+      sys.exit(-1)
  38
+
33 39
    for line in tests_config:
34 40
       if re.search(r'^\[apps\]', line):
35 41
          parsing_app_list = 1
@@ -250,6 +256,9 @@ def run_simulation(is_dryrun):
250 256
    global app_list
251 257
    global num_thread_index_list
252 258
 
  259
+   global sim_root
  260
+   global experiment_directory
  261
+
253 262
    pin_bin = '/afs/csail/group/carbon/tools/pin/current/ia32/bin/pinbin'
254 263
    pin_tool = './lib/pin_sim'
255 264
    pin_run = pin_bin + " -mt -t " + pin_tool
@@ -264,13 +273,47 @@ def run_simulation(is_dryrun):
264 273
             if is_dryrun == 0:
265 274
                proc = subprocess.Popen(command, shell=True)
266 275
                proc.wait()
  276
+               # Copy the results into a per-experiment per-run directory
  277
+               run_directory = experiment_directory + "ARGS_" + remove_unwanted_symbols(sim_flags_list[i]) + remove_unwanted_symbols(app_list[j]) + "/"
  278
+            
  279
+               mkdir_command = "mkdir " + run_directory
  280
+               os.system(mkdir_command)
  281
+            
  282
+               mv_command = "mv " + sim_root + "sim.out " + run_directory;
  283
+               os.system (mv_command)
267 284
          j = j+1
268 285
       i = i+1
269 286
 
270 287
    return
271 288
 
  289
+def remove_unwanted_symbols(in_string):
  290
+   
  291
+   i = 0
  292
+   out_string = ''
  293
+   while i < len(in_string):
  294
+      if in_string[i] == ' ':
  295
+         out_string += '___'
  296
+      elif in_string[i] == '-':
  297
+         pass
  298
+      elif in_string[i] == '/':
  299
+         out_string += '__'
  300
+      elif re.search(r'\w', in_string[i]):
  301
+         out_string += in_string[i]
  302
+      else:
  303
+         out_string += '_'
  304
+      i += 1
  305
+
  306
+   return out_string
  307
+
272 308
 
273 309
 # Actual program starts here
  310
+sim_root = "./"
  311
+from time import strftime
  312
+experiment_directory = sim_root + "results/" + strftime("%Y_%m_%d__%H_%M_%S") + "/"
  313
+mkdir_experiment_dir_command = "mkdir " + experiment_directory
  314
+os.system(mkdir_experiment_dir_command)
  315
+
  316
+tests_config_filename = "tests.cfg"
274 317
 is_dryrun = 0
275 318
 expecting_file_name = 0
276 319
 assert(len(sys.argv) <= 4)
@@ -285,4 +328,9 @@ def run_simulation(is_dryrun):
285 328
 
286 329
 curr_num_procs = parse_config_file_params(tests_config_filename)
287 330
 generate_simulation_args(parse_fixed_param_list(), curr_num_procs, 0)
  331
+
  332
+# Move config file
  333
+mv_config_file_command = "mv " + sim_root + tests_config_filename + " " + experiment_directory
  334
+os.system(mv_config_file_command)
  335
+
288 336
 run_simulation(is_dryrun)

0 notes on commit b7f48c9

Please sign in to comment.
Something went wrong with that request. Please try again.