aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-02-21 18:32:24 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-02-21 18:32:24 -0500
commit6e2b99a0870e467e35c8b4b95aeb1e665dded413 (patch)
tree1e4b4d000c6b53b93a35b5446dc774d4799c987c
parent9bcbb4048cd82ea11ed469731eae95d808b99449 (diff)
Many bugfixes motivated by some end-to-end testing.
-rw-r--r--common.py2
-rw-r--r--gen/generators.py22
-rw-r--r--parse/dir_map.py2
-rw-r--r--parse/ft.py14
-rw-r--r--parse/sched.py8
-rw-r--r--parse/tuple_table.py3
-rwxr-xr-xparse_exps.py58
-rw-r--r--plot/style.py3
-rwxr-xr-xplot_exps.py29
-rw-r--r--run/executable/executable.py9
-rw-r--r--run/executable/ftcat.py21
-rw-r--r--run/experiment.py9
-rw-r--r--run/litmus_util.py10
-rw-r--r--run/tracer.py19
-rwxr-xr-xrun_exps.py2
15 files changed, 138 insertions, 73 deletions
diff --git a/common.py b/common.py
index 6d1db97..d080e1a 100644
--- a/common.py
+++ b/common.py
@@ -105,7 +105,7 @@ def recordtype(typename, field_names, default=0):
105 namespace = {} 105 namespace = {}
106 try: 106 try:
107 exec template in namespace 107 exec template in namespace
108 except SyntaxError, e: 108 except SyntaxError as e:
109 raise SyntaxError(e.message + ':\n' + template) 109 raise SyntaxError(e.message + ':\n' + template)
110 cls = namespace[typename] 110 cls = namespace[typename]
111 111
diff --git a/gen/generators.py b/gen/generators.py
index 09ae979..dd6f1cc 100644
--- a/gen/generators.py
+++ b/gen/generators.py
@@ -53,7 +53,7 @@ GenOption = namedtuple('GenOption', ['name', 'types', 'default', 'help'])
53class BaseGenerator(object): 53class BaseGenerator(object):
54 '''Creates sporadic task sets with the most common Litmus options.''' 54 '''Creates sporadic task sets with the most common Litmus options.'''
55 def __init__(self, name, templates, options, params): 55 def __init__(self, name, templates, options, params):
56 self.options = self.__make_options() + options 56 self.options = self.__make_options(params) + options
57 57
58 self.__setup_params(params) 58 self.__setup_params(params)
59 59
@@ -61,11 +61,14 @@ class BaseGenerator(object):
61 self.template = "\n".join([TP_RM] + templates) 61 self.template = "\n".join([TP_RM] + templates)
62 self.name = name 62 self.name = name
63 63
64 def __make_options(self): 64 def __make_options(self, params):
65 '''Return generic Litmus options.''' 65 '''Return generic Litmus options.'''
66 66
67 # Guess defaults using the properties of this computer 67 # Guess defaults using the properties of this computer
68 cpus = lu.num_cpus() 68 if 'cpus' in params:
69 cpus = min(map(int, params['cpus']))
70 else:
71 cpus = lu.num_cpus()
69 try: 72 try:
70 config = get_config_option("RELEASE_MASTER") and True 73 config = get_config_option("RELEASE_MASTER") and True
71 except: 74 except:
@@ -127,9 +130,10 @@ class BaseGenerator(object):
127 f.write(str(Template(self.template, searchList=[exp_params]))) 130 f.write(str(Template(self.template, searchList=[exp_params])))
128 131
129 del exp_params['task_set'] 132 del exp_params['task_set']
133 del exp_params['num_tasks']
130 exp_params_file = out_dir + "/" + DEFAULTS['params_file'] 134 exp_params_file = out_dir + "/" + DEFAULTS['params_file']
131 with open(exp_params_file, 'wa') as f: 135 with open(exp_params_file, 'wa') as f:
132 exp_params['scheduler'] = 'CEDF' 136 exp_params['scheduler'] = self.name
133 f.write(str(exp_params)) 137 f.write(str(exp_params))
134 138
135 def __setup_params(self, params): 139 def __setup_params(self, params):
@@ -195,7 +199,7 @@ class BaseGenerator(object):
195 col_map = builder.build() 199 col_map = builder.build()
196 200
197 for dp in DesignPointGenerator(self.params): 201 for dp in DesignPointGenerator(self.params):
198 dir_leaf = "sched=%s_%s" % (self.name, col_map.get_encoding(dp)) 202 dir_leaf = "sched=%s_%s" % (self.name, col_map.encode(dp))
199 dir_path = "%s/%s" % (out_dir, dir_leaf.strip('_')) 203 dir_path = "%s/%s" % (out_dir, dir_leaf.strip('_'))
200 204
201 if os.path.exists(dir_path): 205 if os.path.exists(dir_path):
@@ -225,10 +229,10 @@ class BaseGenerator(object):
225 i+= len(word) 229 i+= len(word)
226 res += [word] 230 res += [word]
227 if i > 80: 231 if i > 80:
228 print ", ".join(res[:-1]) 232 print(", ".join(res[:-1]))
229 res = ["\t\t "+res[-1]] 233 res = ["\t\t "+res[-1]]
230 i = line.index("'") 234 i = line.index("'")
231 print ", ".join(res) 235 print(", ".join(res))
232 236
233class PartitionedGenerator(BaseGenerator): 237class PartitionedGenerator(BaseGenerator):
234 def __init__(self, name, templates, options, params): 238 def __init__(self, name, templates, options, params):
@@ -243,7 +247,7 @@ class PartitionedGenerator(BaseGenerator):
243 247
244class PedfGenerator(PartitionedGenerator): 248class PedfGenerator(PartitionedGenerator):
245 def __init__(self, params={}): 249 def __init__(self, params={}):
246 super(PedfGenerator, self).__init__("P-EDF", [], [], params) 250 super(PedfGenerator, self).__init__("PSN-EDF", [], [], params)
247 251
248class CedfGenerator(PartitionedGenerator): 252class CedfGenerator(PartitionedGenerator):
249 LEVEL_OPTION = GenOption('level', ['L2', 'L3', 'All'], ['L2'], 253 LEVEL_OPTION = GenOption('level', ['L2', 'L3', 'All'], ['L2'],
@@ -255,4 +259,4 @@ class CedfGenerator(PartitionedGenerator):
255 259
256class GedfGenerator(BaseGenerator): 260class GedfGenerator(BaseGenerator):
257 def __init__(self, params={}): 261 def __init__(self, params={}):
258 super(GedfGenerator, self).__init__("G-EDF", [TP_GLOB_TASK], [], params) 262 super(GedfGenerator, self).__init__("GSN-EDF", [TP_GLOB_TASK], [], params)
diff --git a/parse/dir_map.py b/parse/dir_map.py
index 1c17f40..601dd3b 100644
--- a/parse/dir_map.py
+++ b/parse/dir_map.py
@@ -46,7 +46,7 @@ class DirMap(object):
46 46
47 def remove_childless(self): 47 def remove_childless(self):
48 def remove_childless2(node): 48 def remove_childless2(node):
49 for key, child in node: 49 for key, child in node.children.items():
50 remove_childless2(child) 50 remove_childless2(child)
51 if not (child.children or child.values): 51 if not (child.children or child.values):
52 node.children.pop(key) 52 node.children.pop(key)
diff --git a/parse/ft.py b/parse/ft.py
index 5293b00..19453d1 100644
--- a/parse/ft.py
+++ b/parse/ft.py
@@ -3,6 +3,7 @@ import numpy as np
3import os 3import os
4import re 4import re
5import shutil as sh 5import shutil as sh
6import sys
6import subprocess 7import subprocess
7 8
8from point import Measurement,Type 9from point import Measurement,Type
@@ -28,7 +29,6 @@ def parse_overhead(result, overhead_bin, overhead, cycles, out_dir, err_file):
28 raise Exception("Failed (%d) with command: %s" % (ret, " ".join(cmd))) 29 raise Exception("Failed (%d) with command: %s" % (ret, " ".join(cmd)))
29 if not size: 30 if not size:
30 os.remove(ovh_fname) 31 os.remove(ovh_fname)
31
32 if size and not ret: 32 if size and not ret:
33 # Map and sort file for stats 33 # Map and sort file for stats
34 data = np.memmap(ovh_fname, dtype="float32", mode='c') 34 data = np.memmap(ovh_fname, dtype="float32", mode='c')
@@ -47,19 +47,22 @@ def parse_overhead(result, overhead_bin, overhead, cycles, out_dir, err_file):
47 47
48def sort_ft(ft_file, err_file, out_dir): 48def sort_ft(ft_file, err_file, out_dir):
49 '''Create and return file with sorted overheads from @ft_file.''' 49 '''Create and return file with sorted overheads from @ft_file.'''
50 out_fname = "{}/{}".format("%s/%s" % (os.getcwd(), out_dir), FT_SORTED_NAME) 50 out_fname = "{}/{}".format(out_dir, FT_SORTED_NAME)
51 51
52 # Sort happens in-place 52 # Sort happens in-place
53 sh.copyfile(ft_file, out_fname) 53 sh.copyfile(ft_file, out_fname)
54 cmd = [conf.BINS['ftsort'], out_fname] 54 cmd = [conf.BINS['ftsort'], out_fname]
55 ret = subprocess.call(cmd, cwd="%s/%s" % (os.getcwd(), out_dir), stderr=err_file, stdout=err_file)
56 55
56 ret = subprocess.call(cmd, cwd=out_dir, stderr=err_file, stdout=err_file)
57 if ret: 57 if ret:
58 raise Exception("Sort failed with command: %s" % " ".join(cmd)) 58 raise Exception("Sort failed (%d) with command: %s" % (ret, " ".join(cmd)))
59 59
60 return out_fname 60 return out_fname
61 61
62def extract_ft_data(result, data_dir, work_dir, cycles): 62def extract_ft_data(result, data_dir, work_dir, cycles):
63 data_dir = os.path.abspath(data_dir)
64 work_dir = os.path.abspath(work_dir)
65
63 freg = conf.FILES['ft_data'] + "$" 66 freg = conf.FILES['ft_data'] + "$"
64 bins = [f for f in os.listdir(data_dir) if re.match(freg, f)] 67 bins = [f for f in os.listdir(data_dir) if re.match(freg, f)]
65 68
@@ -67,6 +70,9 @@ def extract_ft_data(result, data_dir, work_dir, cycles):
67 return False 70 return False
68 71
69 bin_file = "{}/{}".format(data_dir, bins[0]) 72 bin_file = "{}/{}".format(data_dir, bins[0])
73 if not os.path.getsize(bin_file):
74 sys.stderr.write("Empty feather trace file %s!" % bin_file)
75 return False
70 76
71 with open("%s/%s" % (work_dir, FT_ERR_NAME), 'w') as err_file: 77 with open("%s/%s" % (work_dir, FT_ERR_NAME), 'w') as err_file:
72 sorted_bin = sort_ft(bin_file, err_file, work_dir) 78 sorted_bin = sort_ft(bin_file, err_file, work_dir)
diff --git a/parse/sched.py b/parse/sched.py
index ba0df5e..2da0149 100644
--- a/parse/sched.py
+++ b/parse/sched.py
@@ -2,6 +2,7 @@ import config.config as conf
2import os 2import os