From 3498e3270194093098f9b8275901517fa2f9fa32 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Fri, 23 Oct 2020 16:42:53 -0400 Subject: 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 --- run_case_study.py | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 run_case_study.py (limited to 'run_case_study.py') 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 @@ +import os +import sys +import re +import csv +import subprocess +def main(): + pathName = sys.argv[1] + tacle_pairs_path = "./all_pairs" + tacle_baseline_path = "./baseline" + dis_path = "./dis" + all_tasks = [] + levelAB = [] + levelC = [] + levelC_s = [] + dis_inputs = dict() + dis_inputs["field"] = "./gen_input.py field inputs/Field/in0 2097152" + dis_inputs["matrix"] = "gen_input.py matrix inputs/Matrix/in0 2097152" + dis_inputs["neighborhood"] = "./gen_input.py neighborhood inputs/Neighborhood/in0 2097152" + dis_inputs["pointer"] = "./gen_input.py pointer inputs/Pointer/in0 2097152" + dis_inputs["transitive"] = "./gen_input.py transitive inputs/Transitive/in0 2097152" + dis_inputs["update"] = "./gen_input.py update inputs/Update/in0 2097152" + + with open(pathName+"/all_tasks.csv", "r") as csv_file: + csv_reader = csv.reader(csv_file, delimiter = ',') + line = 0 + for row in csv_reader: + if line > 0: + all_tasks.append(row) + line += 1 + with open(pathName+"/levelAB_pairs.csv", "r") as csv_file: + csv_reader = csv.reader(csv_file, delimiter = ',') + line = 0 + for row in csv_reader: + if line > 0: + levelAB.append(row) + line += 1 + with open(pathName+"/levelC_threads.csv", "r") as csv_file: + csv_reader = csv.reader(csv_file, delimiter = ',') + line = 0 + ccx = "0" + threaded = True + for row in csv_reader: + if(len(row) < 3): + continue + if(row[0] == "threaded" or row[0] == "solo"): + threaded = row[0] == "threaded" + if(row[1] == "4"): + ccx = "1" + else: + ccx = "0" + continue + if(row[0] != "task id" and row[0] != ""): + row.append(ccx) + if(threaded): + row.append("t") + else: + row.append("s") + levelC.append(row) + #os.system('echo "L3:0=L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') + + with open(pathName+"/l3alloc.csv", "r") as csv_file: + csv_reader = csv.reader(csv_file, delimiter = ',') + line = 0 + ccx = 0 + for row in csv_reader: + if line > 0: + core = int(row[0]) + way_AB = int(row[1]) + way_C = int(row[3]) + # Level C allocation + if(core == 1): + os.system("mkdir /sys/fs/resctrl/level-c-ccx-0") + 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') + + if(core == 4): + os.system("mkdir /sys/fs/resctrl/level-c-ccx-1") + 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') + os.system('mkdir /sys/fs/resctrl/level-ab-core-' + core) + if(core < 4): + 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') + else: + 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') + pairID = 0 + i = 0 + for task in levelAB: + i+=1 + if(i>4): + break; + task1 = int(task[2]) + task2 = int(task[5]) + name1 = all_tasks[task1][2] + name2 = all_tasks[task2][2] + if(name1 == "rijndael_e"): + name1 = "rijndael_enc" + + if(name2 == "rijndael_e"): + name2 = "rijndael_enc" + period1 = all_tasks[task1][5] + period2 = all_tasks[task2][5] + suite1 = all_tasks[task1][1] + suite2 = all_tasks[task2][1] + core = task[0] + criticality = task[1] + binary = "" + binary1 = "" + binary2 = "" + arg = "" + if(task1 == task2): + arg = " NULL -1 " + core + " NULL 0 " + period1 + " " + criticality + + if(suite1 == "TACLe"): + binary = "./baseline/bin/" + name1 + arg + else: + binary = dis_inputs[name1] + " | ./dis/" + name1 + arg + proc = subprocess.open([binary + " &"], shell = True) + pid = proc.pid + os.system("echo " + pid + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") + + else: + pairID += 1 + arg1 = " NULL -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality + arg2 = " NULL -1 " + str(int(core)+16) + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality + + if(suite1 == "TACLe"): + binary1 = "./all_pairs/bin/" + name1 + arg1 + binary2 = "./all_pairs/bin/" + name2 + arg2 + else: + binary1 = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg1 + binary2 = dis_inputs[name2] + " | ./dis/" + name2 + "_all" + arg2 + proc1 = subprocess.Popen(["numactl --membind=0 " + binary1 + " &"], shell = True) + proc2 = subprocess.Popen(["numactl --membind=1 " + binary2 + " &"], shell = True) + pid1 = proc1.pid + pid2 = proc2.pid + + os.system("echo " + str(pid1) + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") + os.system("echo " + str(pid2) + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") + + + for task in levelC: + i+=1 + if(i>6): + break + tid = int(task[0]) + name = all_tasks[tid][2] + period = all_tasks[tid][5] + suite = all_tasks[tid][1] + ccx = task[3] + threaded = task[4] == "t" + arg = "" + + if(name == "rijndael_e"): + name = "rijndael_enc" + if(not threaded): + arg = " NULL -1 " + ccx + " NULL 0 " + period + " 2" + else: + pairID += 1 + arg = " NULL -1 " + ccx + " 0 NULL NULL 0 " + str(pairID) + " " + period + " 2" + if(suite1 == "TACLe"): + binary = "./baseline/bin/" + name1 + arg + else: + binary = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg + proc = subprocess.Popen([binary + " &"], shell = True) + pid = proc.pid + os.system("echo " + str(pid) + " > /sys/fs/resctrl/level-ab-ccx-" + ccx + "/tasks") + #os.system("/playpen/mc2/liblitmus/release_ts") + #os.system("ls") +if __name__ == "__main__": + main() -- cgit v1.2.2