aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2014-01-18 16:20:45 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2014-01-18 16:20:45 -0500
commit424917db79a1e8855c5e867bcc602476899fa28e (patch)
tree0f2cc2598e664f1d42d80451f7ff986b426fcd97
parent398389d33ce3e1cb356c6415ffced2656fb7562e (diff)
Allow polluter/splitting span the same task set
-rw-r--r--gen/edf_generators.py15
-rw-r--r--gen/generator.py142
2 files changed, 96 insertions, 61 deletions
diff --git a/gen/edf_generators.py b/gen/edf_generators.py
index 7a30b4f..33f52be 100644
--- a/gen/edf_generators.py
+++ b/gen/edf_generators.py
@@ -84,6 +84,9 @@ class EdfPgmGenerator(gen.Generator):
84 gen.Generator._dist_option('depth_factor', ['uni-medium'], 84 gen.Generator._dist_option('depth_factor', ['uni-medium'],
85 ecrts14.NAMED_HEIGHT_FACTORS, 85 ecrts14.NAMED_HEIGHT_FACTORS,
86 'Depth of graphs.'), 86 'Depth of graphs.'),
87 gen.Generator._dist_option('clustering', ['L1', 'L2', 'L3', 'ALL'],
88 {},
89 'Clustering configurations'),
87 gen.Generator._dist_option('partitions', ['no_cache', 'parallel', 'cache_aware'], 90 gen.Generator._dist_option('partitions', ['no_cache', 'parallel', 'cache_aware'],
88 PARTITION_METHOD, 91 PARTITION_METHOD,
89 'Partition methods.'), 92 'Partition methods.'),
@@ -105,13 +108,10 @@ class EdfPgmGenerator(gen.Generator):
105 gen.Generator._dist_option('task_util', ['uni-light'], 108 gen.Generator._dist_option('task_util', ['uni-light'],
106 NAMED_UTILIZATIONS, 109 NAMED_UTILIZATIONS,
107 'Task utilization.'), 110 'Task utilization.'),
108 gen.Generator._dist_option('polluters', False, 111 gen.Generator._dist_option('polluters', [False, True],
109 {}, 112 {},
110 'Polluters.'), 113 'Polluters.'),
111# gen.Generator._dist_option('release_master', False, 114 gen.Generator._dist_option('job_splitting', [False, True],
112# {},
113# 'Release master.'),
114 gen.Generator._dist_option('job_splitting', True,
115 {}, 115 {},
116 'Job splitting.'), 116 'Job splitting.'),
117 gen.Generator._dist_option('ovh_type', 'max', 117 gen.Generator._dist_option('ovh_type', 'max',
@@ -247,6 +247,8 @@ class CflSplitPgmGenerator(EdfPgmGenerator):
247 else: 247 else:
248 assert False 248 assert False
249 249
250 exp_params['fan_in_cap'] = int(exp_params['fan_in_cap'])
251
250 dp.nr_clusters = cpus / cluster_sz 252 dp.nr_clusters = cpus / cluster_sz
251 assert dp.nr_clusters * cluster_sz == cpus 253 assert dp.nr_clusters * cluster_sz == cpus
252 254
@@ -261,6 +263,7 @@ class CflSplitPgmGenerator(EdfPgmGenerator):
261 # compute split factor 263 # compute split factor
262 working_ts = ts 264 working_ts = ts
263 partitions = get_partitions(working_ts, dp.nr_clusters, cluster_sz) 265 partitions = get_partitions(working_ts, dp.nr_clusters, cluster_sz)
264 is_srt_sched = split.compute_splits_nolock(overheads, False, working_ts, partitions, bypass_split = not dp.job_splitting) 266 do_splits = dp.job_splitting == 'True'
267 is_srt_sched = split.compute_splits_nolock(overheads, False, working_ts, partitions, bypass_split = not do_splits)
265 268
266 return True, working_ts 269 return True, working_ts
diff --git a/gen/generator.py b/gen/generator.py
index 89b893e..7b254b5 100644
--- a/gen/generator.py
+++ b/gen/generator.py
@@ -3,6 +3,7 @@ import os
3import sys 3import sys
4import copy 4import copy
5import math 5import math
6import itertools
6import pprint 7import pprint
7import schedcat.generator.tasks as tasks 8import schedcat.generator.tasks as tasks
8import shutil as sh 9import shutil as sh
@@ -361,17 +362,44 @@ class Generator(object):
361 exp.sched = ['edf'] 362 exp.sched = ['edf']
362 exp.update(self.params) 363 exp.update(self.params)
363 364
365 # extract the parameters we want to test the same task set under
366 polluter_method = exp['polluters']
367 split_method = exp['job_splitting']
368 del exp['polluters']
369 del exp['job_splitting']
370
364 # Track changing values so only relevant parameters are included 371 # Track changing values so only relevant parameters are included
365 # in directory names 372 # in directory names
366 for dp in PgmDesignPointGenerator(exp): 373 for dp in PgmDesignPointGenerator(exp):
367 for k, v in dp.iteritems(): 374 for k, v in dp.iteritems():
368 builder.try_add(k, v) 375 builder.try_add(k, v)
369 col_map = builder.build() 376 col_map = builder.build()
370 377
378 # extract the parameters we want to test the same task set under
371 partition_method = exp['partitions'] 379 partition_method = exp['partitions']
380 cluster_method = exp['clustering']
372 del exp['partitions'] 381 del exp['partitions']
382 del exp['clustering']
383
384 shared_params = []
385 for part, clust, pol, splt in list(itertools.product(partition_method, cluster_method, polluter_method, split_method)):
386 if clust == 'ALL' and part != 'no_cache':
387 # skip over partition methods when there is no clustering/partitioning
388 continue
389 p = storage()
390 p.partitioning = part
391 p.clustering = clust
392 p.polluting = pol
393 p.splitting = splt
394 shared_params.append(p)
373 395
374 for _dp in PgmDesignPointGenerator(exp): 396 for _dp in PgmDesignPointGenerator(exp):
397
398 # TODO: Find out why fan_in_cap is set to a string. >:(
399 # Force it to be int.
400 for i,c in enumerate(_dp.fan_in_cap):
401 _dp.fan_in_cap = int(c)
402
375 for trial in xrange(trials): 403 for trial in xrange(trials):
376 dp = copy.deepcopy(_dp) 404 dp = copy.deepcopy(_dp)
377 dp.num_graphs = NAMED_NUM_GRAPHS[dp.num_graphs] 405 dp.num_graphs = NAMED_NUM_GRAPHS[dp.num_graphs]
@@ -395,65 +423,69 @@ class Generator(object):
395 ts, graphs, subts = self._create_tasks(dp) 423 ts, graphs, subts = self._create_tasks(dp)
396 dp.tasks = len(ts) 424 dp.tasks = len(ts)
397 425
398 # TODO: Reuse the same task set and partition with polluter overheads
399 # and with and without job splitting.
400 # That is, same task set for:
401 # {poluters, no polluters} x {job splitting, no job splitting} x
402 # {cluster levels} x {partition methods}
403
404 levels = ['L1', 'L2', 'L3', 'ALL']
405 try: 426 try:
406 for lvl in levels: 427 for shp in shared_params:
407 dp['level'] = lvl 428 dp['level'] = shp.clustering
408 _dp['level'] = lvl 429 _dp['level'] = shp.clustering
409 for pm in partition_method: 430
410 dp.partitions = pm 431 # load in the shared parameters
411 # Create directory name from relevant parameters 432 dp.partitions = shp.partitioning
412 dir_leaf = "sched=%s_cluster=%s_%s" % (self.scheduler, lvl, col_map.encode(dp)) 433 dp.cluster = shp.clustering
413 dir_leaf = dir_leaf.strip('_') # If there are none 434 dp.polluters = shp.polluting
414 dir_leaf += ("_trial=%s" % trial) if trials > 1 else "" 435 dp.job_splitting = shp.splitting
415 436
416 dir_path = "%s/%s" % (out_dir, dir_leaf.strip('_')) 437 # Create directory name from relevant parameters
417 438 dir_parts = []
418 print("Generating for %s" % dir_path) 439 dir_parts.append("sched=%s" % self.scheduler)
419 440 dir_parts.append("cluster=%s" % shp.clustering)
420 if os.path.exists(dir_path): 441 dir_parts.append("polluterovh=%s" % shp.polluting)
421 if force: 442 dir_parts.append("splitting=%s" % shp.splitting)
422 sh.rmtree(dir_path) 443 others = col_map.encode(dp)
423 else: 444 if others != "":
424 print("Skipping existing experiment: '%s'" % dir_path) 445 dir_parts.append(others)
425 continue 446 if trials > 1:
426 447 dir_parts.append("trial=%d" % trial)
427 os.mkdir(dir_path) 448 dir_leaf = "_".join(dir_parts)
428 created_dirs.append(dir_path) 449 dir_path = "%s/%s" % (out_dir, dir_leaf)
429 450
430 if trials > 1: 451 print("Generating %s" % dir_leaf)
431 dp[PARAMS['trial']] = trial 452
432 _dp[PARAMS['trial']] = trial 453 if os.path.exists(dir_path):
433 self.out_dir = dir_path 454 if force:
434 455 sh.rmtree(dir_path)
435 _dp.system = topology.Topology(machines[dp.host]) 456 else:
436 _dp.partitions = pm 457 print("Skipping existing experiment: '%s'" % dir_path)
437 458 continue
438 # Write a sched.py and param.py for each partition method 459
439 ret = self._create_exp(_dp, ts, graphs, subts) 460 os.mkdir(dir_path)
440 if not ret: 461 created_dirs.append(dir_path)
441 print("Bin-packing fails for " + dir_leaf) 462
442 last_failed = dir_leaf 463 if trials > 1:
443 raise Exception("Failed to partition.") 464 dp[PARAMS['trial']] = trial
444 del(self.out_dir) 465 _dp[PARAMS['trial']] = trial
445 if PARAMS['trial'] in dp: 466 self.out_dir = dir_path
446 del dp[PARAMS['trial']] 467
447 del _dp[PARAMS['trial']] 468 _dp.system = topology.Topology(machines[dp.host])
448 # just generate one experiment for global 469 _dp.partitions = dp.partitions
449 if dp['level'] == 'ALL': 470 _dp.polluters = dp.polluters
450 break 471 _dp.job_splitting = dp.job_splitting
472
473 # Write a sched.py and param.py for each partition method
474 ret = self._create_exp(_dp, ts, graphs, subts)
475 if not ret:
476 print("Bin-packing fails for " + dir_leaf)
477 last_failed = dir_leaf
478 raise Exception("Failed to partition.")
479 del(self.out_dir)
480 if PARAMS['trial'] in dp:
481 del dp[PARAMS['trial']]
482 del _dp[PARAMS['trial']]
451 success = True 483 success = True
452 except Exception, e: 484 except Exception, e:
453 for d in created_dirs: 485 for d in created_dirs:
454 sh.rmtree(d) 486 sh.rmtree(d)
455 if not success: 487 if not success:
456 print("Failed to generate experiments. Last failed: %s" % last_failed) 488 print("Failed to generate experiment (%s). Try count = %d" % (last_failed, tries))
457 489
458 490
459 def print_help(self): 491 def print_help(self):