aboutsummaryrefslogtreecommitdiffstats
path: root/gen/generator.py
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2014-01-18 12:40:40 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2014-01-18 12:40:40 -0500
commit86bac2a320dc086a0d7e3bde373e3bace296a5ea (patch)
tree523839b1572091f6258ff483a24b4932e3ed8c67 /gen/generator.py
parentc6106e3eb375824fc20604ddfa845e6d8baa5198 (diff)
Generate wsCycle param for pgmrt.
This adds wsCycle parameter to parameters generated for pgmrt. wsCycle is set to ceil(1.5) the depth of the graph. This prevents the producer and consumer from accessing the same data at the same time. This simulates real buffer movement in a dataflow program.
Diffstat (limited to 'gen/generator.py')
-rw-r--r--gen/generator.py23
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 @@
1import gen.rv as rv 1import gen.rv as rv
2import os 2import os
3import sys
3import copy 4import copy
5import math
4import pprint 6import pprint
5import schedcat.generator.tasks as tasks 7import schedcat.generator.tasks as tasks
6import shutil as sh 8import 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