diff options
Diffstat (limited to 'parse_exps.py')
-rwxr-xr-x | parse_exps.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/parse_exps.py b/parse_exps.py index 8f98309..1f36bab 100755 --- a/parse_exps.py +++ b/parse_exps.py | |||
@@ -7,6 +7,7 @@ import os | |||
7 | import parse.ft as ft | 7 | import parse.ft as ft |
8 | import parse.sched as st | 8 | import parse.sched as st |
9 | import re | 9 | import re |
10 | import shutil as sh | ||
10 | 11 | ||
11 | from collections import namedtuple | 12 | from collections import namedtuple |
12 | from common import load_params | 13 | from common import load_params |
@@ -18,10 +19,16 @@ def parse_args(): | |||
18 | parser = OptionParser("usage: %prog [options] [data_dir]...") | 19 | parser = OptionParser("usage: %prog [options] [data_dir]...") |
19 | 20 | ||
20 | parser.add_option('-o', '--out-dir', dest='out_dir', | 21 | parser.add_option('-o', '--out-dir', dest='out_dir', |
21 | help='directory for data output', default=os.getcwd()) | 22 | help='directory for data output', default='parse-data') |
23 | parser.add_option('-c', '--clean', action='store_true', default=False, | ||
24 | dest='clean', help='do not output single-point csvs') | ||
22 | parser.add_option('-s', '--scale-against', dest='scale_against', | 25 | parser.add_option('-s', '--scale-against', dest='scale_against', |
23 | metavar='PARAM=VALUE', default="", | 26 | metavar='PARAM=VALUE', default="", |
24 | help='calculate task scaling factors against these configs') | 27 | help='calculate task scaling factors against these configs') |
28 | parser.add_option('-f', '--force', action='store_true', default=False, | ||
29 | dest='force', help='overwrite existing data') | ||
30 | parser.add_option('-v', '--verbose', action='store_true', default=False, | ||
31 | dest='verbose', help='print out data points') | ||
25 | 32 | ||
26 | return parser.parse_args() | 33 | return parser.parse_args() |
27 | 34 | ||
@@ -46,7 +53,7 @@ def get_exp_params(data_dir, col_map): | |||
46 | return params | 53 | return params |
47 | 54 | ||
48 | 55 | ||
49 | def gen_exp_data(exp_dirs, base_conf, col_map): | 56 | def gen_exp_data(exp_dirs, base_conf, col_map, force): |
50 | plain_exps = [] | 57 | plain_exps = [] |
51 | scaling_bases = [] | 58 | scaling_bases = [] |
52 | 59 | ||
@@ -60,8 +67,8 @@ def gen_exp_data(exp_dirs, base_conf, col_map): | |||
60 | 67 | ||
61 | # Read and translate exp output files | 68 | # Read and translate exp output files |
62 | params = get_exp_params(data_dir, col_map) | 69 | params = get_exp_params(data_dir, col_map) |
63 | st_output = st.get_st_output(data_dir, tmp_dir) | 70 | st_output = st.get_st_output(data_dir, tmp_dir, force) |
64 | ft_output = ft.get_ft_output(data_dir, tmp_dir) | 71 | ft_output = ft.get_ft_output(data_dir, tmp_dir, force) |
65 | 72 | ||
66 | # Create experiment named after the data dir | 73 | # Create experiment named after the data dir |
67 | exp_data = ExpData(data_dir, params, DataFiles(ft_output, st_output)) | 74 | exp_data = ExpData(data_dir, params, DataFiles(ft_output, st_output)) |
@@ -88,7 +95,7 @@ def main(): | |||
88 | 95 | ||
89 | col_map = ColMap() | 96 | col_map = ColMap() |
90 | 97 | ||
91 | (plain_exps, scaling_bases) = gen_exp_data(args, base_conf, col_map) | 98 | (plain_exps, scaling_bases) = gen_exp_data(args, base_conf, col_map, opts.force) |
92 | 99 | ||
93 | if base_conf and base_conf.keys()[0] not in col_map: | 100 | if base_conf and base_conf.keys()[0] not in col_map: |
94 | raise IOError("Base column '%s' not present in any parameters!" % | 101 | raise IOError("Base column '%s' not present in any parameters!" % |
@@ -121,8 +128,15 @@ def main(): | |||
121 | 128 | ||
122 | result_table.add_exp(exp.params, result) | 129 | result_table.add_exp(exp.params, result) |
123 | 130 | ||
124 | print(result) | 131 | if opts.verbose: |
132 | print(result) | ||
125 | 133 | ||
134 | if opts.force and os.path.exists(opts.out_dir): | ||
135 | sh.rmtree(opts.out_dir) | ||
136 | |||
137 | # Remove un-plottable values | ||
138 | if opts.clean: | ||
139 | result_table.reduce() | ||
126 | 140 | ||
127 | result_table.write_result(opts.out_dir) | 141 | result_table.write_result(opts.out_dir) |
128 | 142 | ||