From 47da00d019b27772cb6009a07ad3fc52aaf2b15f Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Fri, 30 Oct 2020 10:34:30 -0400 Subject: Case study runner script fixes - Quote lookup ID in ID2PID - Fix SD-VBS benchmark names - Use bash rather than sh as the shell so that `echo -e` works - Remove dispatch limit that was for debugging --- run_case_study.py | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'run_case_study.py') 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): res = None # Find benchmark PID (avoid getting shell or numactl PID) try: - res = subprocess.check_output("pgrep -af " + lookupID + " | grep -v numactl | cut -d ' ' -f 1", shell=True) + res = subprocess.check_output("pgrep -af ' " + lookupID + " ' | grep -v numactl | cut -d ' ' -f 1", shell=True) except: res = None if res: @@ -147,13 +147,8 @@ def main(pathName): ### Cleanup Old State ### run("rm -rf /dev/shm/*") pairID = 0 - i = 0 ### Dispatch all the Level-A and -B paired and unpaired tasks ### for pairing in levelAB: - if i > 2: - break - i += 1 - task1 = int(pairing[P_T1_ID]) task2 = int(pairing[P_T2_ID]) # Lookup periods and binary location @@ -174,20 +169,20 @@ def main(pathName): if suite1 == "TACLe": binary = "./baseline/bin/" + name1 elif suite1 == "SD-VBS": - binary = "./SD-VBS/" + name1 + binary = "./SD-VBS/" + name1 + "_qcif" elif suite1 == "DIS": binary = "./dis/" + name1 else: print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") return 1 - lookupID = name1 + task1 + lookupID = name1 + str(task1) if ID2PID(lookupID): print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) return 1 # Arg format: arg = " " + lookupID + " -1 " + core + " NULL 0 " + period1 + " " + criticality - bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell = True) + bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash') pid_str = ID2PID(lookupID) if not pid_str: print("Unable to launch {} as a solo task! Exiting...".format(name1)) @@ -200,8 +195,8 @@ def main(pathName): binary1 = "./all_pairs/bin/" + name1 binary2 = "./all_pairs/bin/" + name2 elif suite1 == "SD-VBS": - binary1 = "./SD-VBS/" + name1 + "_all" - binary2 = "./SD-VBS/" + name2 + "_all" + binary1 = "./SD-VBS/" + name1 + "_qcif_all" + binary2 = "./SD-VBS/" + name2 + "_qcif_all" elif suite1 == "DIS": binary1 = "./dis/" + name1 + "_all" binary2 = "./dis/" + name2 + "_all" @@ -219,8 +214,8 @@ def main(pathName): # Arg format: <0 other core> arg1 = " " + lookupID1 + " -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality arg2 = " " + lookupID2 + " -1 " + thread + " 0 NULL NULL 0 " + str(pairID) + " " + period2 + " " + criticality - bench_tsk1 = subprocess.Popen(input_cmd[name1] + "| numactl --membind=0 " + binary1 + arg1, shell = True) - bench_tsk2 = subprocess.Popen(input_cmd[name2] + "| numactl --membind=1 " + binary2 + arg2, shell = True) + bench_tsk1 = subprocess.Popen(input_cmd[name1] + " | numactl --membind=0 " + binary1 + arg1, shell=True, executable='/bin/bash') + bench_tsk2 = subprocess.Popen(input_cmd[name2] + " | numactl --membind=1 " + binary2 + arg2, shell=True, executable='/bin/bash') # Find benchmark PID (avoid getting shell or numactl PID) pid1_str = ID2PID(lookupID1) pid2_str = ID2PID(lookupID2) @@ -233,13 +228,8 @@ def main(pathName): addpid(pid1_str) addpid(pid2_str) - i = 0 ### Dispatch all the Level-C tasks ### for task in levelC: - if i > 2: - break - i += 1 - tid = int(task[T_ID]) name = all_tasks[tid][A_BIN] period = all_tasks[tid][A_PERIOD] @@ -249,11 +239,12 @@ def main(pathName): if suite == "TACLe": binary = "./baseline/bin/" + name elif suite == "SD-VBS": + name += "_qcif" binary = "./SD-VBS/" + name elif suite == "DIS": binary = "./dis/" + name else: - print("Invalid suite name " + suite + " in Level-A/-B tasks! Exiting...") + print("Invalid suite name " + suite + " in Level-C tasks! Exiting...") return 1 # XXX XXX XXX: FIXME when LITMUS is fixed core = str(int(ccx)*4 + 1); @@ -264,7 +255,7 @@ def main(pathName): return 1 # Arg format: arg = " " + lookupID + " -1 " + core + " NULL 0 " + period + " " + str(CRIT_LEVEL_C) - bench_tsk = subprocess.Popen(input_cmd[name] + " | numactl --interleave=all " + binary + arg, shell=True) + bench_tsk = subprocess.Popen(input_cmd[name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash') # Find benchmark PID (avoid getting shell or numactl PID) pid_str = ID2PID(lookupID) if not pid_str: @@ -273,9 +264,6 @@ def main(pathName): # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) run("echo " + pid_str + " > /sys/fs/resctrl/level-c-ccx-" + ccx + "/tasks") addpid(pid_str) - #os.system("/playpen/mc2/liblitmus/release_ts") - #os.system("ls") - time.sleep(3) if __name__ == "__main__": if len(sys.argv) < 2: -- cgit v1.2.2