diff options
Diffstat (limited to 'run_case_study_dag.py')
| -rwxr-xr-x | run_case_study_dag.py | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/run_case_study_dag.py b/run_case_study_dag.py index d9a0563..0a5c5fe 100755 --- a/run_case_study_dag.py +++ b/run_case_study_dag.py | |||
| @@ -44,7 +44,7 @@ def ID2PID(lookupID): | |||
| 44 | res = None | 44 | res = None |
| 45 | # Find benchmark PID (avoid getting shell or numactl PID) | 45 | # Find benchmark PID (avoid getting shell or numactl PID) |
| 46 | try: | 46 | try: |
| 47 | res = subprocess.check_output("pgrep -af ' " + lookupID + " ' | grep -v numactl", shell=True) | 47 | res = subprocess.check_output("pgrep -af '" + lookupID + "' | grep -v numactl", shell=True) |
| 48 | except: | 48 | except: |
| 49 | res = None | 49 | res = None |
| 50 | if res: | 50 | if res: |
| @@ -56,14 +56,6 @@ def ID2PID(lookupID): | |||
| 56 | def main(pathName): | 56 | def main(pathName): |
| 57 | with open("./pids.txt", "w") as f: | 57 | with open("./pids.txt", "w") as f: |
| 58 | f.write("") | 58 | f.write("") |
| 59 | |||
| 60 | tacle_pairs_path = "./all_pairs" | ||
| 61 | tacle_baseline_path = "./baseline" | ||
| 62 | dis_path = "./dis" | ||
| 63 | # List of lists | ||
| 64 | # Each list represents the parameters for a task as: | ||
| 65 | # [id, suite, binary name, criticality level (0-base), pet us (unused), period ms, wss (unused)] | ||
| 66 | all_tasks = [] | ||
| 67 | 59 | ||
| 68 | input_cmd = {} | 60 | input_cmd = {} |
| 69 | # Load input command for each binary | 61 | # Load input command for each binary |
| @@ -72,9 +64,6 @@ def main(pathName): | |||
| 72 | for line in f: | 64 | for line in f: |
| 73 | name, cmd = line.split(maxsplit=1) | 65 | name, cmd = line.split(maxsplit=1) |
| 74 | input_cmd[name.replace("./", "")] = cmd.replace("./", "./SD-VBS/").strip() | 66 | input_cmd[name.replace("./", "")] = cmd.replace("./", "./SD-VBS/").strip() |
| 75 | # for k in input_cmd: | ||
| 76 | # print(k, input_cmd[k]) | ||
| 77 | # return 1 | ||
| 78 | 67 | ||
| 79 | task_launches = [] | 68 | task_launches = [] |
| 80 | max_core = 0 | 69 | max_core = 0 |
| @@ -85,8 +74,8 @@ def main(pathName): | |||
| 85 | parameters = line.split(",") | 74 | parameters = line.split(",") |
| 86 | task_launches.append(parameters) | 75 | task_launches.append(parameters) |
| 87 | core_num = int(parameters[CORE_NUM]) % 16 | 76 | core_num = int(parameters[CORE_NUM]) % 16 |
| 88 | if max_core < core_num: | 77 | # if max_core < core_num: |
| 89 | max_core = core_num | 78 | # max_core = core_num |
| 90 | all_cores.add(core_num) | 79 | all_cores.add(core_num) |
| 91 | # if parameters[0] == '1': | 80 | # if parameters[0] == '1': |
| 92 | # other_core_num = int(parameters[OTHER_CORE_NUM]) % 16 | 81 | # other_core_num = int(parameters[OTHER_CORE_NUM]) % 16 |
| @@ -98,7 +87,7 @@ def main(pathName): | |||
| 98 | 87 | ||
| 99 | ### Allocate Cache Ways ### | 88 | ### Allocate Cache Ways ### |
| 100 | run('mount -t resctrl resctrl /sys/fs/resctrl') | 89 | run('mount -t resctrl resctrl /sys/fs/resctrl') |
| 101 | # run('echo "L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') | 90 | run('sudo echo "L3:0=0000;1=0000;2=0000;3=000f" | sudo tee /sys/fs/resctrl/schemata') |
| 102 | for core in range(16): | 91 | for core in range(16): |
| 103 | if core not in all_cores: | 92 | if core not in all_cores: |
| 104 | continue | 93 | continue |
| @@ -145,7 +134,7 @@ def main(pathName): | |||
| 145 | arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " + period +" " + crt_level + " "+ phase | 134 | arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " + period +" " + crt_level + " "+ phase |
| 146 | # print(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg) | 135 | # print(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg) |
| 147 | bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file) | 136 | bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file) |
| 148 | pid_str = ID2PID(task_name) | 137 | pid_str = ID2PID(binary + " " + task_name) |
| 149 | if not pid_str: | 138 | if not pid_str: |
| 150 | print("Unable to launch {} as a solo task! Exiting...".format(task_name)) | 139 | print("Unable to launch {} as a solo task! Exiting...".format(task_name)) |
| 151 | return 1 | 140 | return 1 |
| @@ -170,11 +159,13 @@ def main(pathName): | |||
| 170 | # print(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2) | 159 | # print(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2) |
| 171 | bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file) | 160 | bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file) |
| 172 | bench_tsk2 = subprocess.Popen(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2, shell=True, executable='/bin/bash', stderr=stderr_file) | 161 | bench_tsk2 = subprocess.Popen(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2, shell=True, executable='/bin/bash', stderr=stderr_file) |
| 173 | pid1_str = ID2PID(task_name) | 162 | # print(binary + " " + task_name,other_binary + " " +other_task_name) |
| 174 | pid2_str = ID2PID(other_task_name) | 163 | pid1_str = ID2PID(binary + " " + task_name) |
| 164 | pid2_str = ID2PID(other_binary + " " +other_task_name) | ||
| 175 | if not pid1_str or not pid2_str: | 165 | if not pid1_str or not pid2_str: |
| 176 | print("Unable to launch {} and {} in a pair! Exiting...".format(task_name, other_task_name)) | 166 | print("Unable to launch {} and {} in a pair! Exiting...".format(task_name, other_task_name)) |
| 177 | return 1 | 167 | return 1 |
| 168 | |||
| 178 | run("echo " + pid1_str + " > /sys/fs/resctrl/core-" + str(phys_core) + "/tasks") | 169 | run("echo " + pid1_str + " > /sys/fs/resctrl/core-" + str(phys_core) + "/tasks") |
| 179 | run("echo " + pid2_str + " > /sys/fs/resctrl/core-" + str(phys_core) + "/tasks") | 170 | run("echo " + pid2_str + " > /sys/fs/resctrl/core-" + str(phys_core) + "/tasks") |
| 180 | pairID += 1 | 171 | pairID += 1 |
