aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2014-01-02 10:50:27 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2014-01-02 10:50:27 -0500
commit57d87fed3fafd55ae34ddd35cfbeea8fb9c0d26e (patch)
tree00bdd6e0ca3f7d71029dbde36c69ad43de78925a
parentde754b0a0a56b10eeb14305358f58a275eaa262c (diff)
Script updates.
-rwxr-xr-xcache_cost.py36
-rwxr-xr-xdistill_co.py (renamed from distill_pco.py)42
-rwxr-xr-xdistill_pmo.py41
-rw-r--r--gen/__init__.py1
-rw-r--r--gen/edf_generators.py40
-rwxr-xr-xproduce_consume_cost.py31
6 files changed, 122 insertions, 69 deletions
diff --git a/cache_cost.py b/cache_cost.py
index 9f4e54a..9c8f2ac 100755
--- a/cache_cost.py
+++ b/cache_cost.py
@@ -4,6 +4,7 @@ import os
4import copy 4import copy
5import sys 5import sys
6import string 6import string
7import pwd
7import smtplib 8import smtplib
8import socket 9import socket
9import time 10import time
@@ -114,6 +115,15 @@ def run_exp(nsamples, ncpu, numa_args, wss, wcycle, sleep_range_ms, walk, do_pol
114 print str(p) 115 print str(p)
115 print str(probe) 116 print str(probe)
116 117
118def send_email(_to, _msg):
119 user = pwd.getpwuid(os.getuid())[0]
120 host = socket.gethostname()
121 _from = "%s@%s" % (user, host)
122 _body = "\r\n".join(["From: %s" % _from, "To: %s" % _to, "Subject: Test Completed!", "", "{}"])
123 mail = smtplib.SMTP("localhost")
124 mail.sendmail(_from, [_to], _body.format(_msg))
125 mail.quit()
126
117def main(argv): 127def main(argv):
118 nsamples = 5000 128 nsamples = 5000
119 129
@@ -128,12 +138,12 @@ def main(argv):
128 # 138 #
129 # todo: configure numa args for system automatically 139 # todo: configure numa args for system automatically
130 ncpu_and_numa_args = { 140 ncpu_and_numa_args = {
131 6: ['--cpunodebind=0', '--interleave=0'] 141 24: []
132# 12: ['--cpunodebind=0,1', '--interleave=0,1']
133 } 142 }
134 143
135 wss_kb = [4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 3072, 4096, 8192, 12288, 16384] 144 wss_kb = [4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 3072, 4096, 8192, 12288, 16384]
136 write_cycle = [0, 64, 16, 4, 2, 1] 145 write_cycle = [16, 4, 2]
146# write_cycle = [0]
137 147
138 sleep_range_ms = [0,50] 148 sleep_range_ms = [0,50]
139 149
@@ -142,8 +152,11 @@ def main(argv):
142 huge_pages = [False] 152 huge_pages = [False]
143 153
144 pollute = [False, True] 154 pollute = [False, True]
145 walk = ['seq', 'rand'] 155# walk = ['seq', 'rand']
146# walk = ['seq'] 156 walk = ['seq']
157
158 # disable rt throttling in linux scheduler
159 os.system("echo -1 > /proc/sys/kernel/sched_rt_runtime_us")
147 160
148 for ncpu, numa_args in ncpu_and_numa_args.iteritems(): 161 for ncpu, numa_args in ncpu_and_numa_args.iteritems():
149 for u in uncache: 162 for u in uncache:
@@ -158,16 +171,9 @@ def main(argv):
158 run_exp(nsamples, ncpu, numa_args, wss, wcycle, sleep_range_ms, w, p, h, u) 171 run_exp(nsamples, ncpu, numa_args, wss, wcycle, sleep_range_ms, w, p, h, u)
159 172
160 if email_notification: 173 if email_notification:
161 _subject = "Cache Ovh Collection Complete!" 174 to = "gelliott@cs.unc.edu"
162 _to = "gelliott@cs.unc.edu" 175 msg = "Cache Ovh Collection Complete!"
163 _from = "gelliott@bonham.cs.unc.edu" 176 send_email(to, msg)
164 _text = "Cache Ovh Collection Complete!"
165 _body = string.join(("From: %s" % _from, "To: %s" % _to, "Subject: %s" % _subject, "", _text), "\r\n")
166 s = smtplib.SMTP("localhost")
167 s.sendmail(_from, [_to], _body)
168 s.quit()
169
170
171 177
172if __name__ == "__main__": 178if __name__ == "__main__":
173 179
diff --git a/distill_pco.py b/distill_co.py
index c83ccde..d507f47 100755
--- a/distill_pco.py
+++ b/distill_co.py
@@ -95,6 +95,9 @@ def get_topo(host):
95 topologies[host] = topo 95 topologies[host] = topo
96 return topo 96 return topo
97 97
98def non_polluter_filename(csv_file):
99 return re.sub(r"polluters=True", r"polluters=False", csv_file)
100
98# find the max/avg/std of preemption and migration 101# find the max/avg/std of preemption and migration
99def process_cpmd(csv_file, params): 102def process_cpmd(csv_file, params):
100 103
@@ -106,7 +109,10 @@ def process_cpmd(csv_file, params):
106 print 'processing ' + csv_file 109 print 'processing ' + csv_file
107 110
108 ifile = open(csv_file, "r") 111 ifile = open(csv_file, "r")
112 bestcase = open(non_polluter_filename(csv_file), "r")
113
109 reader = csv.reader(ifile) 114 reader = csv.reader(ifile)
115 bc_reader = csv.reader(bestcase)
110 costs = {} 116 costs = {}
111 117
112 SAMPLE = 0 118 SAMPLE = 0
@@ -120,12 +126,11 @@ def process_cpmd(csv_file, params):
120 CONSUME_COLD = 8 126 CONSUME_COLD = 8
121 CONSUME_HOT = 9 127 CONSUME_HOT = 9
122 128
123 for row in reader: 129 for (row, bc_row) in zip(reader, bc_reader):
124 hot = int(row[CONSUME_HOT]) 130 hot = min(int(row[CONSUME_HOT]), int(bc_row[CONSUME_HOT]))
125 after = int(row[CONSUME_COLD]) 131 after = int(row[CONSUME_COLD])
126 cost = max(after - hot, 0) 132 cost = max(after - hot, 0)
127 distance = topo.distance(int(row[NEXT_CPU]), int(row[LAST_CPU])) 133 distance = int(row[DIST])
128 assert distance == int(row[DIST])
129 if distance not in costs: 134 if distance not in costs:
130 costs[distance] = [] 135 costs[distance] = []
131 costs[distance].append(cost) 136 costs[distance].append(cost)
@@ -133,7 +138,7 @@ def process_cpmd(csv_file, params):
133 for d,c in costs.iteritems(): 138 for d,c in costs.iteritems():
134 arr = np.array(c, float) 139 arr = np.array(c, float)
135 arr = np.sort(arr) 140 arr = np.sort(arr)
136 (arr, mincut, maxcut) = utils.iqr.apply_iqr(arr, 1.5) 141# (arr, mincut, maxcut) = utils.iqr.apply_iqr(arr, 1.5)
137 for x in np.nditer(arr, op_flags=['readwrite']): 142 for x in np.nditer(arr, op_flags=['readwrite']):
138 x[...] = utils.machines.cycles_to_us(params['host'], x) 143 x[...] = utils.machines.cycles_to_us(params['host'], x)
139 costs[d] = arr 144 costs[d] = arr
@@ -187,23 +192,16 @@ def main():
187# print results 192# print results
188 for common in results: 193 for common in results:
189 trends = results[common] 194 trends = results[common]
190 name = 'dpco_host=%s_lvl=%s_polluters=%s_walk=%s_hpages=%s_upages=%s.csv' % 195 for t in ['max', 'median', 'mean']:
191 (common[0], get_level(common[0], common[1]), common[2], common[3], common[4], common[5]) 196 name = 'dco_host=%s_lvl=%s_polluters=%s_walk=%s_hpages=%s_upages=%s_type=%s.csv' % (common[0], get_level(common[0], common[1]), common[2], common[3], common[4], common[5], t)
192 f = open(name, 'w') 197 f = open(name, 'w')
193 for w,stats in iter(sorted(trends.iteritems())): 198 f.write('WSS,L1,L2,L3,MEM\n')
194 f.write('%d' % w) 199 for w,stats in iter(sorted(trends.iteritems())):
195 _mean = 0 200 f.write('%d' % w)
196 _max = 0 201 for i,data in iter(sorted(stats.iteritems())):
197 for i,data in iter(sorted(stats.iteritems())): 202 val = data[t]
198 dist_mean = data['mean'] 203 f.write(',%.6f' % val)
199 _mean = max(_mean, dist_mean) 204 f.write('\n')
200 f.write(', %.6f' % dist_mean)
201 f.write(', %.6f' % _mean)
202 for i,data in iter(sorted(stats.iteritems())):
203 dist_max = data['max']
204 _max = max(_max, dist_max)
205 f.write(', %.6f' % dist_max)
206 f.write(', %.6f\n' % _max)
207 205
208if __name__ == '__main__': 206if __name__ == '__main__':
209 main() 207 main()
diff --git a/distill_pmo.py b/distill_pmo.py
index 9821dd5..3897b7f 100755
--- a/distill_pmo.py
+++ b/distill_pmo.py
@@ -95,6 +95,9 @@ def get_topo(host):
95 topologies[host] = topo 95 topologies[host] = topo
96 return topo 96 return topo
97 97
98def non_polluter_filename(csv_file):
99 return re.sub(r"polluters=True", r"polluters=False", csv_file)
100
98# find the max/avg/std of preemption and migration 101# find the max/avg/std of preemption and migration
99def process_cpmd(csv_file, params): 102def process_cpmd(csv_file, params):
100 103
@@ -106,7 +109,10 @@ def process_cpmd(csv_file, params):
106 print 'processing ' + csv_file 109 print 'processing ' + csv_file
107 110
108 ifile = open(csv_file, "r") 111 ifile = open(csv_file, "r")
112 bestcase = open(non_polluter_filename(csv_file), "r")
113
109 reader = csv.reader(ifile) 114 reader = csv.reader(ifile)
115 bc_reader = csv.reader(bestcase)
110 costs = {} 116 costs = {}
111 117
112 SAMPLE = 0 118 SAMPLE = 0
@@ -122,12 +128,14 @@ def process_cpmd(csv_file, params):
122 HOT3 = 10 128 HOT3 = 10
123 AFTER_RESUME = 11 129 AFTER_RESUME = 11
124 130
125 for row in reader: 131 for (row, bc_row) in zip(reader, bc_reader):
132 # read the 'hot' value from both cases to iron out anomolies
126 hot = min(int(row[HOT1]), int(row[HOT2]), int(row[HOT3])) 133 hot = min(int(row[HOT1]), int(row[HOT2]), int(row[HOT3]))
134 bc_hot = min(int(bc_row[HOT1]), int(bc_row[HOT2]), int(bc_row[HOT3]))
135 hot = min(hot, bc_hot)
127 after = int(row[AFTER_RESUME]) 136 after = int(row[AFTER_RESUME])
128 cost = max(after - hot, 0) 137 cost = max(after - hot, 0)
129 distance = topo.distance(int(row[NEXT_CPU]), int(row[LAST_CPU])) 138 distance = int(row[DIST])
130 assert distance == int(row[DIST])
131 if distance not in costs: 139 if distance not in costs:
132 costs[distance] = [] 140 costs[distance] = []
133 costs[distance].append(cost) 141 costs[distance].append(cost)
@@ -189,23 +197,16 @@ def main():
189# print results 197# print results
190 for common in results: 198 for common in results:
191 trends = results[common] 199 trends = results[common]
192 name = 'dpmo_host=%s_lvl=%s_wcycle=%s_polluters=%s_walk=%s_hpages=%s_upages=%s.csv' % 200 for t in ['max', 'median', 'mean']:
193 (common[0], get_level(common[0], common[1]), common[2], common[3], common[4], common[5], common[6]) 201 name = 'dpmo_host=%s_lvl=%s_wcycle=%s_polluters=%s_walk=%s_hpages=%s_upages=%s_type=%s.csv' % (common[0], get_level(common[0], common[1]), common[2], common[3], common[4], common[5], common[6], t)
194 f = open(name, 'w') 202 f = open(name, 'w')
195 for w,stats in iter(sorted(trends.iteritems())): 203 f.write('WSS,L1,L2,L3,MEM\n')
196 f.write('%d' % w) 204 for w,stats in iter(sorted(trends.iteritems())):
197 _mean = 0 205 f.write('%d' % w)
198 _max = 0 206 for i,data in iter(sorted(stats.iteritems())):
199 for i,data in iter(sorted(stats.iteritems())): 207 val = data[t]
200 dist_mean = data['mean'] 208 f.write(',%.6f' % val)
201 _mean = max(_mean, dist_mean) 209 f.write('\n')
202 f.write(', %.6f' % dist_mean)
203 f.write(', %.6f' % _mean)
204 for i,data in iter(sorted(stats.iteritems())):
205 dist_max = data['max']
206 _max = max(_max, dist_max)
207 f.write(', %.6f' % dist_max)
208 f.write(', %.6f\n' % _max)
209 210
210if __name__ == '__main__': 211if __name__ == '__main__':
211 main() 212 main()
diff --git a/gen/__init__.py b/gen/__init__.py
index 8c60b46..654ac19 100644
--- a/gen/__init__.py
+++ b/gen/__init__.py
@@ -4,3 +4,4 @@ import edf_generators as edf
4gen.register_generator("G-EDF", edf.GedfGenerator) 4gen.register_generator("G-EDF", edf.GedfGenerator)
5gen.register_generator("P-EDF", edf.PedfGenerator) 5gen.register_generator("P-EDF", edf.PedfGenerator)
6gen.register_generator("C-EDF", edf.CedfGenerator) 6gen.register_generator("C-EDF", edf.CedfGenerator)
7gen.register_generator("C-FL-split", edf.CflSplitGenerator)
diff --git a/gen/edf_generators.py b/gen/edf_generators.py
index 8e4b8df..ce99d05 100644
--- a/gen/edf_generators.py
+++ b/gen/edf_generators.py
@@ -6,6 +6,7 @@ TP_TBASE = """#for $t in $task_set
6#end for""" 6#end for"""
7TP_GLOB_TASK = TP_TBASE.format("") 7TP_GLOB_TASK = TP_TBASE.format("")
8TP_PART_TASK = TP_TBASE.format("-p $t.cpu") 8TP_PART_TASK = TP_TBASE.format("-p $t.cpu")
9TP_CLST_TASK = TP_TBASE.format("-p $t.cluster -z $t.cluster_sz")
9 10
10class EdfGenerator(gen.Generator): 11class EdfGenerator(gen.Generator):
11 '''Creates sporadic task sets with the most common Litmus options.''' 12 '''Creates sporadic task sets with the most common Litmus options.'''
@@ -83,6 +84,45 @@ class CedfGenerator(PartitionedGenerator):
83 [CedfGenerator.CLUSTER_OPTION], 84 [CedfGenerator.CLUSTER_OPTION],
84 params) 85 params)
85 86
87class CflSplitGenerator(EdfGenerator):
88 TP_CLUSTER = "plugins/C-FL-split/cluster{$level}"
89 CLUSTER_OPTION = gen.GenOption('level', ['L1', 'L2', 'L3', 'ALL'], 'L2',
90 'Cache clustering level.',)
91# CLUSTER_SZ_OPTION = gen.GenOption('cluster_size', ['1', '2', '6', '24'], '2',
92# 'Cluster size.',)
93
94 def __init__(self, params={}):
95 super(CflSplitGenerator, self).__init__("C-FL-split",
96 [CflSplitGenerator.TP_CLUSTER, TP_CLST_TASK],
97 [CflSplitGenerator.CLUSTER_OPTION],
98 params)
99
100 def _customize(self, taskset, exp_params):
101 cpus = int(exp_params['cpus'])
102# cluster_sz = int(exp_params['cluster_size'])
103
104 if exp_params['level'] == 'L1':
105 cluster_sz = 1
106 elif exp_params['level'] == 'L2':
107 cluster_sz = 2
108 elif exp_params['level'] == 'L3':
109 cluster_sz = 6
110 elif exp_params['level'] == 'ALL':
111 cluster_sz = 24
112 else:
113 assert False
114
115 num_clusters = cpus / cluster_sz
116 assert num_clusters * cluster_sz == cpus
117
118 utils = [0]*num_clusters
119 tasks = [0]*num_clusters
120 for t in taskset:
121 t.cluster = utils.index(min(utils))
122 t.cluster_sz = cluster_sz
123 utils[t.cluster] += t.utilization()
124 tasks[t.cluster] += 1
125
86class GedfGenerator(EdfGenerator): 126class GedfGenerator(EdfGenerator):
87 def __init__(self, params={}): 127 def __init__(self, params={}):
88 super(GedfGenerator, self).__init__("GSN-EDF", [TP_GLOB_TASK], 128 super(GedfGenerator, self).__init__("GSN-EDF", [TP_GLOB_TASK],
diff --git a/produce_consume_cost.py b/produce_consume_cost.py
index fd08a8d..b24ce76 100755
--- a/produce_consume_cost.py
+++ b/produce_consume_cost.py
@@ -4,6 +4,7 @@ import os
4import copy 4import copy
5import sys 5import sys
6import string 6import string
7import pwd
7import smtplib 8import smtplib
8import socket 9import socket
9import time 10import time
@@ -111,8 +112,17 @@ def run_exp(nsamples, ncpu, numa_args, wss, sleep_range_ms, walk, do_pollute, do
111 print str(p) 112 print str(p)
112 print str(probe) 113 print str(probe)
113 114
115def send_email(_to, _msg):
116 user = pwd.getpwuid(os.getuid())[0]
117 host = socket.gethostname()
118 _from = "%s@%s" % (user, host)
119 _body = "\r\n".join(["From: %s" % _from, "To: %s" % _to, "Subject: Test Completed!", "", "{}"])
120 mail = smtplib.SMTP("localhost")
121 mail.sendmail(_from, [_to], _body.format(_msg))
122 mail.quit()
123
114def main(argv): 124def main(argv):
115 nsamples = 5000 125 nsamples = 5000*4
116 126
117 # We may need to test different NUMA node configurations 127 # We may need to test different NUMA node configurations
118 # according to memory interleaving across the NUMA topology. 128 # according to memory interleaving across the NUMA topology.
@@ -125,8 +135,9 @@ def main(argv):
125 # 135 #
126 # todo: configure numa args for system automatically 136 # todo: configure numa args for system automatically
127 ncpu_and_numa_args = { 137 ncpu_and_numa_args = {
128 6: ['--cpunodebind=0', '--interleave=0'] 138# 6: ['--cpunodebind=0', '--interleave=0']
129# 12: ['--cpunodebind=0,1', '--interleave=0,1'] 139# 12: ['--cpunodebind=0,1', '--interleave=0,1']
140 24: []
130 } 141 }
131 142
132 wss_kb = [4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 3072, 4096, 8192, 12288, 16384] 143 wss_kb = [4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 3072, 4096, 8192, 12288, 16384]
@@ -140,6 +151,9 @@ def main(argv):
140# walk = ['seq', 'rand'] 151# walk = ['seq', 'rand']
141 walk = ['seq'] 152 walk = ['seq']
142 153
154 # disable rt throttling in linux scheduler
155 os.system("echo -1 > /proc/sys/kernel/sched_rt_runtime_us")
156
143 for ncpu, numa_args in ncpu_and_numa_args.iteritems(): 157 for ncpu, numa_args in ncpu_and_numa_args.iteritems():
144 for u in uncache: 158 for u in uncache:
145 for h in huge_pages: 159 for h in huge_pages:
@@ -149,16 +163,9 @@ def main(argv):
149 run_exp(nsamples, ncpu, numa_args, wss, sleep_range_ms, w, p, h, u) 163 run_exp(nsamples, ncpu, numa_args, wss, sleep_range_ms, w, p, h, u)
150 164
151 if email_notification: 165 if email_notification:
152 _subject = "Producer/Consumer Ovh Collection Complete!" 166 to = "gelliott@cs.unc.edu"
153 _to = "gelliott@cs.unc.edu" 167 msg = "Producer/Consumer Ovh Collection Complete!"
154 _from = "gelliott@bonham.cs.unc.edu" 168 send_email(to, msg)
155 _text = "Producer/Consumer Ovh Collection Complete!"
156 _body = string.join(("From: %s" % _from, "To: %s" % _to, "Subject: %s" % _subject, "", _text), "\r\n")
157 s = smtplib.SMTP("localhost")
158 s.sendmail(_from, [_to], _body)
159 s.quit()
160
161
162 169
163if __name__ == "__main__": 170if __name__ == "__main__":
164 171