summaryrefslogtreecommitdiffstats
path: root/run_case_study.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_case_study.py')
-rwxr-xr-xrun_case_study.py34
1 files changed, 11 insertions, 23 deletions
diff --git a/run_case_study.py b/run_case_study.py
index b06697f..b073468 100755
--- a/run_case_study.py
+++ b/run_case_study.py
@@ -36,7 +36,7 @@ def ID2PID(lookupID):
36 res = None 36 res = None
37 # Find benchmark PID (avoid getting shell or numactl PID) 37 # Find benchmark PID (avoid getting shell or numactl PID)
38 try: 38 try:
39 res = subprocess.check_output("pgrep -af " + lookupID + " | grep -v numactl | cut -d ' ' -f 1", shell=True) 39 res = subprocess.check_output("pgrep -af ' " + lookupID + " ' | grep -v numactl | cut -d ' ' -f 1", shell=True)
40 except: 40 except:
41 res = None 41 res = None
42 if res: 42 if res:
@@ -147,13 +147,8 @@ def main(pathName):
147 ### Cleanup Old State ### 147 ### Cleanup Old State ###
148 run("rm -rf /dev/shm/*") 148 run("rm -rf /dev/shm/*")
149 pairID = 0 149 pairID = 0
150 i = 0
151 ### Dispatch all the Level-A and -B paired and unpaired tasks ### 150 ### Dispatch all the Level-A and -B paired and unpaired tasks ###
152 for pairing in levelAB: 151 for pairing in levelAB:
153 if i > 2:
154 break
155 i += 1
156
157 task1 = int(pairing[P_T1_ID]) 152 task1 = int(pairing[P_T1_ID])
158 task2 = int(pairing[P_T2_ID]) 153 task2 = int(pairing[P_T2_ID])
159 # Lookup periods and binary location 154 # Lookup periods and binary location
@@ -174,20 +169,20 @@ def main(pathName):
174 if suite1 == "TACLe": 169 if suite1 == "TACLe":
175 binary = "./baseline/bin/" + name1 170 binary = "./baseline/bin/" + name1
176 elif suite1 == "SD-VBS": 171 elif suite1 == "SD-VBS":
177 binary = "./SD-VBS/" + name1 172 binary = "./SD-VBS/" + name1 + "_qcif"
178 elif suite1 == "DIS": 173 elif suite1 == "DIS":
179 binary = "./dis/" + name1 174 binary = "./dis/" + name1
180 else: 175 else:
181 print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") 176 print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...")
182 return 1 177 return 1
183 178
184 lookupID = name1 + task1 179 lookupID = name1 + str(task1)
185 if ID2PID(lookupID): 180 if ID2PID(lookupID):
186 print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) 181 print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID))
187 return 1 182 return 1
188 # Arg format: <unique name> <infinite loops> <core> <NULL runID> <no output> <period> <crit lvl> 183 # Arg format: <unique name> <infinite loops> <core> <NULL runID> <no output> <period> <crit lvl>
189 arg = " " + lookupID + " -1 " + core + " NULL 0 " + period1 + " " + criticality 184 arg = " " + lookupID + " -1 " + core + " NULL 0 " + period1 + " " + criticality
190 bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell = True) 185 bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash')
191 pid_str = ID2PID(lookupID) 186 pid_str = ID2PID(lookupID)
192 if not pid_str: 187 if not pid_str:
193 print("Unable to launch {} as a solo task! Exiting...".format(name1)) 188 print("Unable to launch {} as a solo task! Exiting...".format(name1))
@@ -200,8 +195,8 @@ def main(pathName):
200 binary1 = "./all_pairs/bin/" + name1 195 binary1 = "./all_pairs/bin/" + name1
201 binary2 = "./all_pairs/bin/" + name2 196 binary2 = "./all_pairs/bin/" + name2
202 elif suite1 == "SD-VBS": 197 elif suite1 == "SD-VBS":
203 binary1 = "./SD-VBS/" + name1 + "_all" 198 binary1 = "./SD-VBS/" + name1 + "_qcif_all"
204 binary2 = "./SD-VBS/" + name2 + "_all" 199 binary2 = "./SD-VBS/" + name2 + "_qcif_all"
205 elif suite1 == "DIS": 200 elif suite1 == "DIS":
206 binary1 = "./dis/" + name1 + "_all" 201 binary1 = "./dis/" + name1 + "_all"
207 binary2 = "./dis/" + name2 + "_all" 202 binary2 = "./dis/" + name2 + "_all"
@@ -219,8 +214,8 @@ def main(pathName):
219 # Arg format: <unique name> <infinite loops> <core> <0 other core> <NULL other name> <NULL runID> <no output> <pairID> <period> <crit lvl> 214 # Arg format: <unique name> <infinite loops> <core> <0 other core> <NULL other name> <NULL runID> <no output> <pairID> <period> <crit lvl>
220 arg1 = " " + lookupID1 + " -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality 215 arg1 = " " + lookupID1 + " -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality
221 arg2 = " " + lookupID2 + " -1 " + thread + " 0 NULL NULL 0 " + str(pairID) + " " + period2 + " " + criticality 216 arg2 = " " + lookupID2 + " -1 " + thread + " 0 NULL NULL 0 " + str(pairID) + " " + period2 + " " + criticality
222 bench_tsk1 = subprocess.Popen(input_cmd[name1] + "| numactl --membind=0 " + binary1 + arg1, shell = True) 217 bench_tsk1 = subprocess.Popen(input_cmd[name1] + " | numactl --membind=0 " + binary1 + arg1, shell=True, executable='/bin/bash')
223 bench_tsk2 = subprocess.Popen(input_cmd[name2] + "| numactl --membind=1 " + binary2 + arg2, shell = True) 218 bench_tsk2 = subprocess.Popen(input_cmd[name2] + " | numactl --membind=1 " + binary2 + arg2, shell=True, executable='/bin/bash')
224 # Find benchmark PID (avoid getting shell or numactl PID) 219 # Find benchmark PID (avoid getting shell or numactl PID)
225 pid1_str = ID2PID(lookupID1) 220 pid1_str = ID2PID(lookupID1)
226 pid2_str = ID2PID(lookupID2) 221 pid2_str = ID2PID(lookupID2)
@@ -233,13 +228,8 @@ def main(pathName):
233 addpid(pid1_str) 228 addpid(pid1_str)
234 addpid(pid2_str) 229 addpid(pid2_str)
235 230
236 i = 0
237 ### Dispatch all the Level-C tasks ### 231 ### Dispatch all the Level-C tasks ###
238 for task in levelC: 232 for task in levelC:
239 if i > 2:
240 break
241 i += 1
242
243 tid = int(task[T_ID]) 233 tid = int(task[T_ID])
244 name = all_tasks[tid][A_BIN] 234 name = all_tasks[tid][A_BIN]
245 period = all_tasks[tid][A_PERIOD] 235 period = all_tasks[tid][A_PERIOD]
@@ -249,11 +239,12 @@ def main(pathName):
249 if suite == "TACLe": 239 if suite == "TACLe":
250 binary = "./baseline/bin/" + name 240 binary = "./baseline/bin/" + name
251 elif suite == "SD-VBS": 241 elif suite == "SD-VBS":
242 name += "_qcif"
252 binary = "./SD-VBS/" + name 243 binary = "./SD-VBS/" + name
253 elif suite == "DIS": 244 elif suite == "DIS":
254 binary = "./dis/" + name 245 binary = "./dis/" + name
255 else: 246 else:
256 print("Invalid suite name " + suite + " in Level-A/-B tasks! Exiting...") 247 print("Invalid suite name " + suite + " in Level-C tasks! Exiting...")
257 return 1 248 return 1
258 # XXX XXX XXX: FIXME when LITMUS is fixed 249 # XXX XXX XXX: FIXME when LITMUS is fixed
259 core = str(int(ccx)*4 + 1); 250 core = str(int(ccx)*4 + 1);
@@ -264,7 +255,7 @@ def main(pathName):
264 return 1 255 return 1
265 # Arg format: <unique name> <infinite loops> <core> <NULL runID> <no output> <period> <crit lvl> 256 # Arg format: <unique name> <infinite loops> <core> <NULL runID> <no output> <period> <crit lvl>
266 arg = " " + lookupID + " -1 " + core + " NULL 0 " + period + " " + str(CRIT_LEVEL_C) 257 arg = " " + lookupID + " -1 " + core + " NULL 0 " + period + " " + str(CRIT_LEVEL_C)
267 bench_tsk = subprocess.Popen(input_cmd[name] + " | numactl --interleave=all " + binary + arg, shell=True) 258 bench_tsk = subprocess.Popen(input_cmd[name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash')
268 # Find benchmark PID (avoid getting shell or numactl PID) 259 # Find benchmark PID (avoid getting shell or numactl PID)
269 pid_str = ID2PID(lookupID) 260 pid_str = ID2PID(lookupID)
270 if not pid_str: 261 if not pid_str:
@@ -273,9 +264,6 @@ def main(pathName):
273 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) 264 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms)
274 run("echo " + pid_str + " > /sys/fs/resctrl/level-c-ccx-" + ccx + "/tasks") 265 run("echo " + pid_str + " > /sys/fs/resctrl/level-c-ccx-" + ccx + "/tasks")
275 addpid(pid_str) 266 addpid(pid_str)
276 #os.system("/playpen/mc2/liblitmus/release_ts")
277 #os.system("ls")
278 time.sleep(3)
279 267
280if __name__ == "__main__": 268if __name__ == "__main__":
281 if len(sys.argv) < 2: 269 if len(sys.argv) < 2: