diff options
author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-23 16:42:53 -0400 |
---|---|---|
committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-23 16:42:53 -0400 |
commit | 3498e3270194093098f9b8275901517fa2f9fa32 (patch) | |
tree | 5ce66df0516fa44981da3542115bb307aefb6f65 /run_case_study.py | |
parent | 8e9d3399bbc1249370a4423bce3d1db9e417d952 (diff) |
Squashed commit sd-vbs from Leo:
- Fixes SD-VBS build with LITMUS 1 defined
- Fixes memory leak in stitch and tracking benchmarks
- Adds initial case-study script and configurations
Diffstat (limited to 'run_case_study.py')
-rw-r--r-- | run_case_study.py | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/run_case_study.py b/run_case_study.py new file mode 100644 index 0000000..f5a4f61 --- /dev/null +++ b/run_case_study.py | |||
@@ -0,0 +1,168 @@ | |||
1 | import os | ||
2 | import sys | ||
3 | import re | ||
4 | import csv | ||
5 | import subprocess | ||
6 | def main(): | ||
7 | pathName = sys.argv[1] | ||
8 | tacle_pairs_path = "./all_pairs" | ||
9 | tacle_baseline_path = "./baseline" | ||
10 | dis_path = "./dis" | ||
11 | all_tasks = [] | ||
12 | levelAB = [] | ||
13 | levelC = [] | ||
14 | levelC_s = [] | ||
15 | dis_inputs = dict() | ||
16 | dis_inputs["field"] = "./gen_input.py field inputs/Field/in0 2097152" | ||
17 | dis_inputs["matrix"] = "gen_input.py matrix inputs/Matrix/in0 2097152" | ||
18 | dis_inputs["neighborhood"] = "./gen_input.py neighborhood inputs/Neighborhood/in0 2097152" | ||
19 | dis_inputs["pointer"] = "./gen_input.py pointer inputs/Pointer/in0 2097152" | ||
20 | dis_inputs["transitive"] = "./gen_input.py transitive inputs/Transitive/in0 2097152" | ||
21 | dis_inputs["update"] = "./gen_input.py update inputs/Update/in0 2097152" | ||
22 | |||
23 | with open(pathName+"/all_tasks.csv", "r") as csv_file: | ||
24 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
25 | line = 0 | ||
26 | for row in csv_reader: | ||
27 | if line > 0: | ||
28 | all_tasks.append(row) | ||
29 | line += 1 | ||
30 | with open(pathName+"/levelAB_pairs.csv", "r") as csv_file: | ||
31 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
32 | line = 0 | ||
33 | for row in csv_reader: | ||
34 | if line > 0: | ||
35 | levelAB.append(row) | ||
36 | line += 1 | ||
37 | with open(pathName+"/levelC_threads.csv", "r") as csv_file: | ||
38 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
39 | line = 0 | ||
40 | ccx = "0" | ||
41 | threaded = True | ||
42 | for row in csv_reader: | ||
43 | if(len(row) < 3): | ||
44 | continue | ||
45 | if(row[0] == "threaded" or row[0] == "solo"): | ||
46 | threaded = row[0] == "threaded" | ||
47 | if(row[1] == "4"): | ||
48 | ccx = "1" | ||
49 | else: | ||
50 | ccx = "0" | ||
51 | continue | ||
52 | if(row[0] != "task id" and row[0] != ""): | ||
53 | row.append(ccx) | ||
54 | if(threaded): | ||
55 | row.append("t") | ||
56 | else: | ||
57 | row.append("s") | ||
58 | levelC.append(row) | ||
59 | #os.system('echo "L3:0=L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') | ||
60 | |||
61 | with open(pathName+"/l3alloc.csv", "r") as csv_file: | ||
62 | csv_reader = csv.reader(csv_file, delimiter = ',') | ||
63 | line = 0 | ||
64 | ccx = 0 | ||
65 | for row in csv_reader: | ||
66 | if line > 0: | ||
67 | core = int(row[0]) | ||
68 | way_AB = int(row[1]) | ||
69 | way_C = int(row[3]) | ||
70 | # Level C allocation | ||
71 | if(core == 1): | ||
72 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-0") | ||
73 | os.system('echo "L3:0=' + ("%0.4x" % (int("1"*way_C, 2))) + ',1=0000,2=0000,3=0000" > /sys/fs/resctrl/level-c-ccx-0/schemata') | ||
74 | |||
75 | if(core == 4): | ||
76 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-1") | ||
77 | os.system('echo "L3:0=0000, 1=' + ("%0.4x" % (int("1"*way_C, 2))) + ',2=0000,3=0000" > /sys/fs/resctrl/level-c-ccx-1/schemata') | ||
78 | os.system('mkdir /sys/fs/resctrl/level-ab-core-' + core) | ||
79 | if(core < 4): | ||
80 | os.system('echo "L3:0=' + ("%0.4x" % (int("1"*way_C + "0"*(16-way_AB), 2))) + ',1=0000,2=0000,3=0000" > /sys/fs/resctrl/level-ab-core-' + core + '/schemata') | ||
81 | else: | ||
82 | os.system('echo "L3:0=0000,1=' + ("%0.4x" % (int("1"*way_C + "0"*(16-way_AB), 2))) + ',2=0000,3=0000" > /sys/fs/resctrl/level-ab-core-' + core + '/schemata') | ||
83 | pairID = 0 | ||
84 | i = 0 | ||
85 | for task in levelAB: | ||
86 | i+=1 | ||
87 | if(i>4): | ||
88 | break; | ||
89 | task1 = int(task[2]) | ||
90 | task2 = int(task[5]) | ||
91 | name1 = all_tasks[task1][2] | ||
92 | name2 = all_tasks[task2][2] | ||
93 | if(name1 == "rijndael_e"): | ||
94 | name1 = "rijndael_enc" | ||
95 | |||
96 | if(name2 == "rijndael_e"): | ||
97 | name2 = "rijndael_enc" | ||
98 | period1 = all_tasks[task1][5] | ||
99 | period2 = all_tasks[task2][5] | ||
100 | suite1 = all_tasks[task1][1] | ||
101 | suite2 = all_tasks[task2][1] | ||
102 | core = task[0] | ||
103 | criticality = task[1] | ||
104 | binary = "" | ||
105 | binary1 = "" | ||
106 | binary2 = "" | ||
107 | arg = "" | ||
108 | if(task1 == task2): | ||
109 | arg = " NULL -1 " + core + " NULL 0 " + period1 + " " + criticality | ||
110 | |||
111 | if(suite1 == "TACLe"): | ||
112 | binary = "./baseline/bin/" + name1 + arg | ||
113 | else: | ||
114 | binary = dis_inputs[name1] + " | ./dis/" + name1 + arg | ||
115 | proc = subprocess.open([binary + " &"], shell = True) | ||
116 | pid = proc.pid | ||
117 | os.system("echo " + pid + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | ||
118 | |||
119 | else: | ||
120 | pairID += 1 | ||
121 | arg1 = " NULL -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality | ||
122 | arg2 = " NULL -1 " + str(int(core)+16) + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality | ||
123 | |||
124 | if(suite1 == "TACLe"): | ||
125 | binary1 = "./all_pairs/bin/" + name1 + arg1 | ||
126 | binary2 = "./all_pairs/bin/" + name2 + arg2 | ||
127 | else: | ||
128 | binary1 = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg1 | ||
129 | binary2 = dis_inputs[name2] + " | ./dis/" + name2 + "_all" + arg2 | ||
130 | proc1 = subprocess.Popen(["numactl --membind=0 " + binary1 + " &"], shell = True) | ||
131 | proc2 = subprocess.Popen(["numactl --membind=1 " + binary2 + " &"], shell = True) | ||
132 | pid1 = proc1.pid | ||
133 | pid2 = proc2.pid | ||
134 | |||
135 | os.system("echo " + str(pid1) + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | ||
136 | os.system("echo " + str(pid2) + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | ||
137 | |||
138 | |||
139 | for task in levelC: | ||
140 | i+=1 | ||
141 | if(i>6): | ||
142 | break | ||
143 | tid = int(task[0]) | ||
144 | name = all_tasks[tid][2] | ||
145 | period = all_tasks[tid][5] | ||
146 | suite = all_tasks[tid][1] | ||
147 | ccx = task[3] | ||
148 | threaded = task[4] == "t" | ||
149 | arg = "" | ||
150 | |||
151 | if(name == "rijndael_e"): | ||
152 | name = "rijndael_enc" | ||
153 | if(not threaded): | ||
154 | arg = " NULL -1 " + ccx + " NULL 0 " + period + " 2" | ||
155 | else: | ||
156 | pairID += 1 | ||
157 | arg = " NULL -1 " + ccx + " 0 NULL NULL 0 " + str(pairID) + " " + period + " 2" | ||
158 | if(suite1 == "TACLe"): | ||
159 | binary = "./baseline/bin/" + name1 + arg | ||
160 | else: | ||
161 | binary = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg | ||
162 | proc = subprocess.Popen([binary + " &"], shell = True) | ||
163 | pid = proc.pid | ||
164 | os.system("echo " + str(pid) + " > /sys/fs/resctrl/level-ab-ccx-" + ccx + "/tasks") | ||
165 | #os.system("/playpen/mc2/liblitmus/release_ts") | ||
166 | #os.system("ls") | ||
167 | if __name__ == "__main__": | ||
168 | main() | ||