diff options
| author | leochanj105 <leochanj@live.unc.edu> | 2020-10-23 16:24:51 -0400 |
|---|---|---|
| committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-23 16:24:51 -0400 |
| commit | 863e64b15f29dc35ab646045ece7e3d40fe2a6c4 (patch) | |
| tree | e12e021fa06bc9f02ef3d1252fe0cde063333a21 | |
| parent | 010690950e295802405f2d538be859ef21bec155 (diff) | |
wip
| -rw-r--r-- | run_case_study.py | 43 | ||||
| -rw-r--r-- | sudo | 1 |
2 files changed, 28 insertions, 16 deletions
diff --git a/run_case_study.py b/run_case_study.py index f5a4f61..7f0893a 100644 --- a/run_case_study.py +++ b/run_case_study.py | |||
| @@ -3,6 +3,10 @@ import sys | |||
| 3 | import re | 3 | import re |
| 4 | import csv | 4 | import csv |
| 5 | import subprocess | 5 | import subprocess |
| 6 | def run(command): | ||
| 7 | print(command) | ||
| 8 | os.system(command) | ||
| 9 | |||
| 6 | def main(): | 10 | def main(): |
| 7 | pathName = sys.argv[1] | 11 | pathName = sys.argv[1] |
| 8 | tacle_pairs_path = "./all_pairs" | 12 | tacle_pairs_path = "./all_pairs" |
| @@ -56,7 +60,9 @@ def main(): | |||
| 56 | else: | 60 | else: |
| 57 | row.append("s") | 61 | row.append("s") |
| 58 | levelC.append(row) | 62 | levelC.append(row) |
| 59 | #os.system('echo "L3:0=L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') | 63 | line += 1 |
| 64 | #os.system('mount -t resctrl resctrl /sys/fs/resctrl') | ||
| 65 | run('sudo echo "L3:0=0000,1=0000,2=0000,3=0000" > sudo /sys/fs/resctrl/schemata') | ||
| 60 | 66 | ||
| 61 | with open(pathName+"/l3alloc.csv", "r") as csv_file: | 67 | with open(pathName+"/l3alloc.csv", "r") as csv_file: |
| 62 | csv_reader = csv.reader(csv_file, delimiter = ',') | 68 | csv_reader = csv.reader(csv_file, delimiter = ',') |
| @@ -69,17 +75,19 @@ def main(): | |||
| 69 | way_C = int(row[3]) | 75 | way_C = int(row[3]) |
| 70 | # Level C allocation | 76 | # Level C allocation |
| 71 | if(core == 1): | 77 | if(core == 1): |
| 72 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-0") | 78 | run("mkdir -p /sys/fs/resctrl/level-c-ccx-0") |
| 73 | 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') | 79 | run('sudo echo "L3:0=' + ("%0.4x" % (int("1"*way_C, 2))) + ',1=0000,2=0000,3=0000" > sudo /sys/fs/resctrl/level-c-ccx-0/schemata') |
| 74 | 80 | ||
| 75 | if(core == 4): | 81 | if(core == 4): |
| 76 | os.system("mkdir /sys/fs/resctrl/level-c-ccx-1") | 82 | run("mkdir -p /sys/fs/resctrl/level-c-ccx-1") |
| 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') | 83 | run('sudo echo "L3:0=0000, 1=' + ("%0.4x" % (int("1"*way_C, 2))) + ',2=0000,3=0000" > sudo /sys/fs/resctrl/level-c-ccx-1/schemata') |
| 78 | os.system('mkdir /sys/fs/resctrl/level-ab-core-' + core) | 84 | run('mkdir -p /sys/fs/resctrl/level-ab-core-' + str(core)) |
| 79 | if(core < 4): | 85 | if(core < 4): |
| 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') | 86 | run('sudo echo "L3:0=' + ("%0.4x" % (int("1"*way_AB + "0"*(16-way_AB), 2))) + ',1=0000,2=0000,3=0000" > sudo /sys/fs/resctrl/level-ab-core-' + str(core) + '/schemata') |
| 81 | else: | 87 | else: |
| 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') | 88 | run('sudo echo "L3:0=0000,1=' + ("%0.4x" % (int("1"*way_AB + "0"*(16-way_AB), 2))) + ',2=0000,3=0000" > sudo /sys/fs/resctrl/level-ab-core-' + str(core) + '/schemata') |
| 89 | line += 1 | ||
| 90 | run("sudo rm -rf /dev/shm/*") | ||
| 83 | pairID = 0 | 91 | pairID = 0 |
| 84 | i = 0 | 92 | i = 0 |
| 85 | for task in levelAB: | 93 | for task in levelAB: |
| @@ -113,13 +121,14 @@ def main(): | |||
| 113 | else: | 121 | else: |
| 114 | binary = dis_inputs[name1] + " | ./dis/" + name1 + arg | 122 | binary = dis_inputs[name1] + " | ./dis/" + name1 + arg |
| 115 | proc = subprocess.open([binary + " &"], shell = True) | 123 | proc = subprocess.open([binary + " &"], shell = True) |
| 124 | print(binary + " &" ) | ||
| 116 | pid = proc.pid | 125 | pid = proc.pid |
| 117 | os.system("echo " + pid + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | 126 | run("sudo echo " + pid + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") |
| 118 | 127 | ||
| 119 | else: | 128 | else: |
| 120 | pairID += 1 | 129 | pairID += 1 |
| 121 | arg1 = " NULL -1 " + core + " 0 NULL NULL 0 " + str(pairID) + " " + period1 + " " + criticality | 130 | 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 | 131 | arg2 = " NULL -1 " + str(int(core)+16) + " 0 NULL NULL 0 " + str(pairID) + " " + period2 + " " + criticality |
| 123 | 132 | ||
| 124 | if(suite1 == "TACLe"): | 133 | if(suite1 == "TACLe"): |
| 125 | binary1 = "./all_pairs/bin/" + name1 + arg1 | 134 | binary1 = "./all_pairs/bin/" + name1 + arg1 |
| @@ -127,14 +136,16 @@ def main(): | |||
| 127 | else: | 136 | else: |
| 128 | binary1 = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg1 | 137 | binary1 = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg1 |
| 129 | binary2 = dis_inputs[name2] + " | ./dis/" + name2 + "_all" + arg2 | 138 | binary2 = dis_inputs[name2] + " | ./dis/" + name2 + "_all" + arg2 |
| 130 | proc1 = subprocess.Popen(["numactl --membind=0 " + binary1 + " &"], shell = True) | 139 | proc1 = subprocess.Popen(["sudo numactl --membind=0 " + binary1 + " &"], shell = True) |
| 131 | proc2 = subprocess.Popen(["numactl --membind=1 " + binary2 + " &"], shell = True) | 140 | proc2 = subprocess.Popen(["sudo numactl --membind=1 " + binary2 + " &"], shell = True) |
| 141 | print("sudo numactl --membind=0 " + binary1 + " &") | ||
| 142 | print("sudo numactl --membind=1 " + binary2 + " &") | ||
| 132 | pid1 = proc1.pid | 143 | pid1 = proc1.pid |
| 133 | pid2 = proc2.pid | 144 | pid2 = proc2.pid |
| 134 | 145 | ||
| 135 | os.system("echo " + str(pid1) + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | 146 | run("sudo echo " + str(pid1) + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") |
| 136 | os.system("echo " + str(pid2) + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") | 147 | run("sudo echo " + str(pid2) + " > sudo /sys/fs/resctrl/level-ab-core-" + core + "/tasks") |
| 137 | 148 | exit(1) | |
| 138 | 149 | ||
| 139 | for task in levelC: | 150 | for task in levelC: |
| 140 | i+=1 | 151 | i+=1 |
| @@ -161,7 +172,7 @@ def main(): | |||
| 161 | binary = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg | 172 | binary = dis_inputs[name1] + " | ./dis/" + name1 + "_all" + arg |
| 162 | proc = subprocess.Popen([binary + " &"], shell = True) | 173 | proc = subprocess.Popen([binary + " &"], shell = True) |
| 163 | pid = proc.pid | 174 | pid = proc.pid |
| 164 | os.system("echo " + str(pid) + " > /sys/fs/resctrl/level-ab-ccx-" + ccx + "/tasks") | 175 | os.system("sudo echo " + str(pid) + " > sudo /sys/fs/resctrl/level-ab-ccx-" + ccx + "/tasks") |
| 165 | #os.system("/playpen/mc2/liblitmus/release_ts") | 176 | #os.system("/playpen/mc2/liblitmus/release_ts") |
| 166 | #os.system("ls") | 177 | #os.system("ls") |
| 167 | if __name__ == "__main__": | 178 | if __name__ == "__main__": |
| @@ -0,0 +1 @@ | |||
| 53322 /sys/fs/resctrl/level-ab-core-1/tasks | |||
