diff options
Diffstat (limited to 'parse_exps.py')
| -rwxr-xr-x | parse_exps.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/parse_exps.py b/parse_exps.py index 8aa9b43..c254536 100755 --- a/parse_exps.py +++ b/parse_exps.py | |||
| @@ -32,6 +32,9 @@ def parse_args(): | |||
| 32 | parser.add_option('-m', '--write-map', action='store_true', default=False, | 32 | parser.add_option('-m', '--write-map', action='store_true', default=False, |
| 33 | dest='write_map', | 33 | dest='write_map', |
| 34 | help='Output map of values instead of csv tree') | 34 | help='Output map of values instead of csv tree') |
| 35 | parser.add_option('-p', '--processors', default=max(cpu_count() - 1, 1), | ||
| 36 | type='int', dest='processors', | ||
| 37 | help='number of threads for processing') | ||
| 35 | 38 | ||
| 36 | return parser.parse_args() | 39 | return parser.parse_args() |
| 37 | 40 | ||
| @@ -134,7 +137,7 @@ def main(): | |||
| 134 | 137 | ||
| 135 | sys.stderr.write("Parsing data...\n") | 138 | sys.stderr.write("Parsing data...\n") |
| 136 | 139 | ||
| 137 | procs = min(len(exps), max(cpu_count()/2, 1)) | 140 | procs = min(len(exps), opts.processors) |
| 138 | pool = Pool(processes=procs) | 141 | pool = Pool(processes=procs) |
| 139 | pool_args = zip(exps, [opts.force]*len(exps)) | 142 | pool_args = zip(exps, [opts.force]*len(exps)) |
| 140 | enum = pool.imap_unordered(parse_exp, pool_args, 1) | 143 | enum = pool.imap_unordered(parse_exp, pool_args, 1) |
| @@ -161,8 +164,8 @@ def main(): | |||
| 161 | 164 | ||
| 162 | reduced_table = result_table.reduce() | 165 | reduced_table = result_table.reduce() |
| 163 | 166 | ||
| 164 | sys.stderr.write("Writing result...\n") | ||
| 165 | if opts.write_map: | 167 | if opts.write_map: |
| 168 | sys.stderr.write("Writing python map into %s...\n" % opts.out) | ||
| 166 | # Write summarized results into map | 169 | # Write summarized results into map |
| 167 | reduced_table.write_map(opts.out) | 170 | reduced_table.write_map(opts.out) |
| 168 | else: | 171 | else: |
| @@ -177,6 +180,7 @@ def main(): | |||
| 177 | for e in exp: | 180 | for e in exp: |
| 178 | print(e) | 181 | print(e) |
| 179 | else: | 182 | else: |
| 183 | sys.stderr.write("Writing csvs into %s...\n" % opts.out) | ||
| 180 | dir_map.write(opts.out) | 184 | dir_map.write(opts.out) |
| 181 | 185 | ||
| 182 | if __name__ == '__main__': | 186 | if __name__ == '__main__': |
