diff options
Diffstat (limited to 'run_case_study.py')
| -rw-r--r-- | run_case_study.py | 119 |
1 files changed, 114 insertions, 5 deletions
diff --git a/run_case_study.py b/run_case_study.py index d715644..f5a4f61 100644 --- a/run_case_study.py +++ b/run_case_study.py | |||
| @@ -2,11 +2,24 @@ import os | |||
| 2 | import sys | 2 | import sys |
| 3 | import re | 3 | import re |
| 4 | import csv | 4 | import csv |
| 5 | import subprocess | ||
| 5 | def main(): | 6 | def main(): |
| 6 | pathName = sys.argv[1] | 7 | pathName = sys.argv[1] |
| 8 | tacle_pairs_path = "./all_pairs" | ||
| 9 | tacle_baseline_path = "./baseline" | ||
| 10 | dis_path = "./dis" | ||
| 7 | all_tasks = [] | 11 | all_tasks = [] |
| 8 | levelAB = [] | 12 | levelAB = [] |
| 9 | levelC = [] | 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 | |||
| 10 | with open(pathName+"/all_tasks.csv", "r") as csv_file: | 23 | with open(pathName+"/all_tasks.csv", "r") as csv_file: |
| 11 | csv_reader = csv.reader(csv_file, delimiter = ',') | 24 | csv_reader = csv.reader(csv_file, delimiter = ',') |
| 12 | line = 0 | 25 | line = 0 |
| @@ -24,10 +37,25 @@ def main(): | |||
| 24 | with open(pathName+"/levelC_threads.csv", "r") as csv_file: | 37 | with open(pathName+"/levelC_threads.csv", "r") as csv_file: |
| 25 | csv_reader = csv.reader(csv_file, delimiter = ',') | 38 | csv_reader = csv.reader(csv_file, delimiter = ',') |
| 26 | line = 0 | 39 | line = 0 |
| 40 | ccx = "0" | ||
| 41 | threaded = True | ||
| 27 | for row in csv_reader: | 42 | for row in csv_reader: |
| 28 | if line > 0: | 43 | if(len(row) < 3): |
| 29 | levelC.append(row) | 44 | continue |
| 30 | line += 1 | 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) | ||
| 31 | #os.system('echo "L3:0=L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') | 59 | #os.system('echo "L3:0=L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') |
| 32 | 60 | ||
| 33 | with open(pathName+"/l3alloc.csv", "r") as csv_file: | 61 | with open(pathName+"/l3alloc.csv", "r") as csv_file: |
| @@ -46,14 +74,95 @@ def main(): | |||
| 46 | 74 | ||
| 47 | if(core == 4): | 75 | if(core == 4): |
| 48 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-1") | 76 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-1") |
| 49 | os.system('echo "L3:0=0000, 1=' + ("%0.4x" % (int("1"*way_C, 2))) + ',2=0000,3=0000" > /sys/fs/resctrl/level-c-ccx-0/schemata') | 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') |
| 50 | os.system('mkdir /sys/fs/resctrl/level-ab-core-' + core) | 78 | os.system('mkdir /sys/fs/resctrl/level-ab-core-' + core) |
| 51 | if(core < 4): | 79 | if(core < 4): |
| 52 | 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') | 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') |
| 53 | else: | 81 | else: |
| 54 | 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') | 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 | ||
| 55 | for task in levelAB: | 85 | for task in levelAB: |
| 56 | 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") | ||
| 57 | #os.system("ls") | 166 | #os.system("ls") |
| 58 | if __name__ == "__main__": | 167 | if __name__ == "__main__": |
| 59 | main() | 168 | main() |
