summaryrefslogtreecommitdiffstats
path: root/run_case_study.py
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2020-10-25 18:49:00 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-25 18:49:00 -0400
commit8da09ab18819d80c5eda206fde04454e4fccbf1a (patch)
tree5415583ced0662403890811e23433d204e258daf /run_case_study.py
parent1026e429095b1b6054fe81022bdeb173d7eccb47 (diff)
Don't exit the case study script until confirmed
Diffstat (limited to 'run_case_study.py')
-rwxr-xr-xrun_case_study.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/run_case_study.py b/run_case_study.py
index eff06fe..b06697f 100755
--- a/run_case_study.py
+++ b/run_case_study.py
@@ -179,19 +179,19 @@ def main(pathName):
179 binary = "./dis/" + name1 179 binary = "./dis/" + name1
180 else: 180 else:
181 print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") 181 print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...")
182 exit(1) 182 return 1
183 183
184 lookupID = name1 + task1 184 lookupID = name1 + task1
185 if ID2PID(lookupID): 185 if ID2PID(lookupID):
186 print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) 186 print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID))
187 exit(1) 187 return 1
188 # Arg format: <unique name> <infinite loops> <core> <NULL runID> <no output> <period> <crit lvl> 188 # Arg format: <unique name> <infinite loops> <core> <NULL runID> <no output> <period> <crit lvl>
189 arg = " " + lookupID + " -1 " + core + " NULL 0 " + period1 + " " + criticality 189 arg = " " + lookupID + " -1 " + core + " NULL 0 " + period1 + " " + criticality
190 bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell = True) 190 bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell = True)
191 pid_str = ID2PID(lookupID) 191 pid_str = ID2PID(lookupID)
192 if not pid_str: 192 if not pid_str:
193 print("Unable to launch {} as a solo task! Exiting...".format(name1)) 193 print("Unable to launch {} as a solo task! Exiting...".format(name1))
194 exit(1) 194 return 1
195 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) 195 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms)
196 run("echo " + pid_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") 196 run("echo " + pid_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks")
197 addpid(pid_str) 197 addpid(pid_str)
@@ -207,7 +207,7 @@ def main(pathName):
207 binary2 = "./dis/" + name2 + "_all" 207 binary2 = "./dis/" + name2 + "_all"
208 else: 208 else:
209 print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") 209 print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...")
210 exit(1) 210 return 1
211 211
212 pairID += 1 # Used for sem/shm identification in the pair task 212 pairID += 1 # Used for sem/shm identification in the pair task
213 thread = str(int(core) + 16) # How Linux numbers SMT threads on the 3950X 213 thread = str(int(core) + 16) # How Linux numbers SMT threads on the 3950X
@@ -215,7 +215,7 @@ def main(pathName):
215 lookupID2 = name2 + str(task2) 215 lookupID2 = name2 + str(task2)
216 if ID2PID(lookupID1) or ID2PID(lookupID2): 216 if ID2PID(lookupID1) or ID2PID(lookupID2):
217 print("ERROR: Part of the pair containing task IDs {} and {} is already running! Did you end the previous case study?".format(lookupID1, lookupID2)) 217 print("ERROR: Part of the pair containing task IDs {} and {} is already running! Did you end the previous case study?".format(lookupID1, lookupID2))
218 exit(1) 218 return 1
219 # Arg format: <unique name> <infinite loops> <core> <0 other core> <NULL other name> <NULL runID> <no output> <pairID> <period> <crit lvl> 219 # 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 220 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 221 arg2 = " " + lookupID2 + " -1 " + thread + " 0 NULL NULL 0 " + str(pairID) + " " + period2 + " " + criticality
@@ -226,7 +226,7 @@ def main(pathName):
226 pid2_str = ID2PID(lookupID2) 226 pid2_str = ID2PID(lookupID2)
227 if not pid1_str or not pid2_str: 227 if not pid1_str or not pid2_str:
228 print("Unable to launch {} and {} in a pair! Exiting...".format(name1, name2)) 228 print("Unable to launch {} and {} in a pair! Exiting...".format(name1, name2))
229 exit(1) 229 return 1
230 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) 230 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms)
231 run("echo " + pid1_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") 231 run("echo " + pid1_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks")
232 run("echo " + pid2_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") 232 run("echo " + pid2_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks")
@@ -254,14 +254,14 @@ def main(pathName):
254 binary = "./dis/" + name 254 binary = "./dis/" + name
255 else: 255 else:
256 print("Invalid suite name " + suite + " in Level-A/-B tasks! Exiting...") 256 print("Invalid suite name " + suite + " in Level-A/-B tasks! Exiting...")
257 exit(1) 257 return 1
258 # XXX XXX XXX: FIXME when LITMUS is fixed 258 # XXX XXX XXX: FIXME when LITMUS is fixed
259 core = str(int(ccx)*4 + 1); 259 core = str(int(ccx)*4 + 1);
260 260
261 lookupID = name + str(tid) 261 lookupID = name + str(tid)
262 if ID2PID(lookupID): 262 if ID2PID(lookupID):
263 print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) 263 print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID))
264 exit(1) 264 return 1
265 # Arg format: <unique name> <infinite loops> <core> <NULL runID> <no output> <period> <crit lvl> 265 # 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) 266 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) 267 bench_tsk = subprocess.Popen(input_cmd[name] + " | numactl --interleave=all " + binary + arg, shell=True)
@@ -269,7 +269,7 @@ def main(pathName):
269 pid_str = ID2PID(lookupID) 269 pid_str = ID2PID(lookupID)
270 if not pid_str: 270 if not pid_str:
271 print("Unable to launch {} as a Level-C thread! Exiting...".format(name)) 271 print("Unable to launch {} as a Level-C thread! Exiting...".format(name))
272 exit(1) 272 return 1
273 # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) 273 # 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") 274 run("echo " + pid_str + " > /sys/fs/resctrl/level-c-ccx-" + ccx + "/tasks")
275 addpid(pid_str) 275 addpid(pid_str)
@@ -285,6 +285,8 @@ if __name__ == "__main__":
285 print("You must run this script as root to enable cache isolation and access LITMUS-RT.") 285 print("You must run this script as root to enable cache isolation and access LITMUS-RT.")
286 exit(1) 286 exit(1)
287 pathName = sys.argv[1] 287 pathName = sys.argv[1]
288 main(pathName) 288 err = main(pathName)
289 input("Done. Waiting for termination signal...")
290 exit(err)
289 291
290 292