diff options
| -rw-r--r-- | gen/generator.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gen/generator.py b/gen/generator.py index 7b91a93..9831252 100644 --- a/gen/generator.py +++ b/gen/generator.py | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | import gen.rv as rv | 1 | import gen.rv as rv |
| 2 | import os | 2 | import os |
| 3 | import sys | ||
| 3 | import copy | 4 | import copy |
| 5 | import math | ||
| 4 | import pprint | 6 | import pprint |
| 5 | import schedcat.generator.tasks as tasks | 7 | import schedcat.generator.tasks as tasks |
| 6 | import shutil as sh | 8 | import shutil as sh |
| @@ -146,6 +148,7 @@ class Generator(object): | |||
| 146 | cluster_arg = [] | 148 | cluster_arg = [] |
| 147 | clustersz_arg = [] | 149 | clustersz_arg = [] |
| 148 | wss_arg = [] | 150 | wss_arg = [] |
| 151 | wss_cycle_arg = [] | ||
| 149 | split_arg = [] | 152 | split_arg = [] |
| 150 | for g in pgm_params['graphs']: | 153 | for g in pgm_params['graphs']: |
| 151 | cluster_arg_t = [] | 154 | cluster_arg_t = [] |
| @@ -167,8 +170,6 @@ class Generator(object): | |||
| 167 | # assume that x=1 | 170 | # assume that x=1 |
| 168 | period_str = format(n.task.period/1000.0, '.4f').rstrip('0').rstrip('.') | 171 | period_str = format(n.task.period/1000.0, '.4f').rstrip('0').rstrip('.') |
| 169 | rates_arg_t.append('node_' + str(n.id) + ':1:' + period_str) | 172 | rates_arg_t.append('node_' + str(n.id) + ':1:' + period_str) |
| 170 | # get cluster size | ||
| 171 | clustersz_arg_t = str(pgm_params['cpus'] / pgm_params['nr_clusters']) | ||
| 172 | if len(g.nodes) == 1: | 173 | if len(g.nodes) == 1: |
| 173 | graph_desc_arg_t.append('node_' + str(n.id)) | 174 | graph_desc_arg_t.append('node_' + str(n.id)) |
| 174 | for succ in n.succ: | 175 | for succ in n.succ: |
| @@ -192,21 +193,26 @@ class Generator(object): | |||
| 192 | wss_arg.append(wss_arg_t) | 193 | wss_arg.append(wss_arg_t) |
| 193 | split_arg.append(split_arg_t) | 194 | split_arg.append(split_arg_t) |
| 194 | rates_arg.append(rates_arg_t) | 195 | rates_arg.append(rates_arg_t) |
| 195 | clustersz_arg.append(clustersz_arg_t) | 196 | |
| 196 | #print('----------') | 197 | clustersz_arg.append(str(pgm_params['cpus'] / pgm_params['nr_clusters'])) |
| 197 | #print(pgm_params) | 198 | |
| 199 | # Use a wss cycle of 1.5x the graph depth to avoid cache | ||
| 200 | # contention among tasks. This mimics how a real data-flow | ||
| 201 | # program would work: buffers get passed down the graph | ||
| 202 | # and later reused after processing by the last node. | ||
| 203 | wss_cycle_arg.append(str(int(math.ceil(g.depth * 1.5)))) | ||
| 198 | 204 | ||
| 199 | pgm_args = [] | 205 | pgm_args = [] |
| 200 | for i in range(len(pgm_params['graphs'])): | 206 | for i in range(len(pgm_params['graphs'])): |
| 201 | pgm_args_t = ''; | 207 | pgm_args_t = ''; |
| 202 | pgm_args_t += '--wait --cluster ' + cluster_arg[i] + ' --clusterSize ' + clustersz_arg[i] + ' --name graph_' + str(i) | 208 | pgm_args_t += '--wait --cluster ' + cluster_arg[i] + ' --clusterSize ' + clustersz_arg[i] |
| 203 | pgm_args_t += ' --graph ' + graph_desc_arg[i] + ' --rates ' + rates_arg[i] + ' --execution ' + exec_arg[i] | 209 | pgm_args_t += ' --graph ' + graph_desc_arg[i] + ' --rates ' + rates_arg[i] + ' --execution ' + exec_arg[i] |
| 204 | if len(split_arg[i]) != 0: | 210 | if len(split_arg[i]) != 0: |
| 205 | pgm_args_t += ' --split ' + split_arg[i] | 211 | pgm_args_t += ' --split ' + split_arg[i] |
| 206 | if len(wss_arg[i]) != 0: | 212 | if len(wss_arg[i]) != 0: |
| 207 | pgm_args_t += ' --wss ' + wss_arg[i] | 213 | pgm_args_t += ' --wss ' + wss_arg[i] |
| 214 | pgm_args_t += ' --wsCycle ' + wss_cycle_arg[i] | ||
| 208 | 215 | ||
| 209 | # pgm_args_t += ' --duration ' + str(pgm_params['duration']) | ||
| 210 | # last argument must always be duration. actual duration given by run_exps.py | 216 | # last argument must always be duration. actual duration given by run_exps.py |
| 211 | pgm_args_t += ' --duration' | 217 | pgm_args_t += ' --duration' |
| 212 | 218 | ||
| @@ -380,7 +386,8 @@ class Generator(object): | |||
| 380 | last_failed = '' | 386 | last_failed = '' |
| 381 | tries = 0 | 387 | tries = 0 |
| 382 | success = False | 388 | success = False |
| 383 | while tries < 100 and not success: | 389 | max_tries = 100 |
| 390 | while tries < max_tries and not success: | ||
| 384 | created_dirs = [] | 391 | created_dirs = [] |
| 385 | tries += 1 | 392 | tries += 1 |
| 386 | 393 | ||
