diff options
| author | leochanj105 <leochanj@live.unc.edu> | 2021-10-26 13:22:32 -0400 |
|---|---|---|
| committer | leochanj105 <leochanj@live.unc.edu> | 2021-10-26 13:22:32 -0400 |
| commit | 14c854543b1a3cf344a371a5b45595657f95786b (patch) | |
| tree | 70f752880522e5e44669af365754ac0f649dce81 /run_case_study_dag.py | |
| parent | 5e2ccfae0532ddd89bcc04bf14aad451e9c79785 (diff) | |
add deadlines and costs
Diffstat (limited to 'run_case_study_dag.py')
| -rwxr-xr-x | run_case_study_dag.py | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/run_case_study_dag.py b/run_case_study_dag.py index 0599bec..df44cb4 100755 --- a/run_case_study_dag.py +++ b/run_case_study_dag.py | |||
| @@ -9,9 +9,9 @@ import subprocess | |||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | # Single tasks: | 11 | # Single tasks: |
| 12 | # 0, binary_name, task_name, iterations, my_core, runID, save?, period, criticality, phase | 12 | # 0, binary_name, task_name, iterations, my_core, runID, save?, period, criticality, phase, cost, deadline |
| 13 | # Paired tasks: | 13 | # Paired tasks: |
| 14 | # 1, binary_name, task_name, iterations, my_core, runID, save?, period, criticality, phase, other_binary_name, other_task_name | 14 | # 1, binary_name, task_name, iterations, my_core, runID, save?, period, criticality, phase, cost, deadline, other_binary_name, other_task_name, other_cost, other_deadline |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | binary_path = "./SD-VBS/dag_binaries/" | 17 | binary_path = "./SD-VBS/dag_binaries/" |
| @@ -28,9 +28,13 @@ SAVE_RESULT = 6 | |||
| 28 | PERIOD = 7 | 28 | PERIOD = 7 |
| 29 | CRT_LEVEL = 8 | 29 | CRT_LEVEL = 8 |
| 30 | PHASE= 9 | 30 | PHASE= 9 |
| 31 | COST = 10 | ||
| 32 | DEADLINE = 11 | ||
| 31 | 33 | ||
| 32 | OTHER_BINARY_NAME = 10 | 34 | OTHER_BINARY_NAME = 12 |
| 33 | OTHER_TASK_NAME = 11 | 35 | OTHER_TASK_NAME = 13 |
| 36 | OTHER_COST = 14 | ||
| 37 | OTHER_DEADLINE = 15 | ||
| 34 | # OTHER_CORE_NUM = 12 | 38 | # OTHER_CORE_NUM = 12 |
| 35 | # PAIR_ID = 12 | 39 | # PAIR_ID = 12 |
| 36 | 40 | ||
| @@ -137,18 +141,23 @@ def main(pathName): | |||
| 137 | period = launch[PERIOD].strip() | 141 | period = launch[PERIOD].strip() |
| 138 | crt_level = launch[CRT_LEVEL].strip() | 142 | crt_level = launch[CRT_LEVEL].strip() |
| 139 | phase = launch[PHASE].strip() | 143 | phase = launch[PHASE].strip() |
| 144 | cost = launch[COST].strip() | ||
| 145 | deadline = launch[DEADLINE].strip() | ||
| 146 | if(int(cost) > int(deadline)): | ||
| 147 | print("----Error: task {} cost = {} > {} = deadline!----".format(task_name, int(cost), int(deadline))) | ||
| 148 | continue | ||
| 140 | 149 | ||
| 141 | 150 | ||
| 142 | phys_core = int(core_num) % 16 | 151 | phys_core = int(core_num) % 16 |
| 143 | if ID2PID(task_name): | 152 | if ID2PID(task_name): |
| 144 | print("ERROR: Task Name {} is already running! Did you end the previous case study?".format(task_name)) | 153 | print("----ERROR: Task Name {} is already running! Did you end the previous case study?---- ".format(task_name)) |
| 145 | return 1 | 154 | return 1 |
| 146 | # single tasks | 155 | # single tasks |
| 147 | if launch[0] == '0': | 156 | if launch[0] == '0': |
| 148 | if LITMUS: | 157 | if LITMUS: |
| 149 | binary = binary_path + binary_name + "_single" | 158 | binary = binary_path + binary_name + "_single" |
| 150 | # Arg format: <unique name> <num_iters> <core> <NULL runID> <save?> <period> <crit lvl> <phase> | 159 | # Arg format: <unique name> <num_iters> <core> <NULL runID> <save?> <period> <crit lvl> <phase> |
| 151 | arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " + period +" " + crt_level + " "+ phase | 160 | arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " + period +" " + crt_level + " "+ phase + " " + cost + " " + deadline |
| 152 | bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file) | 161 | bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file) |
| 153 | 162 | ||
| 154 | else: | 163 | else: |
| @@ -170,18 +179,23 @@ def main(pathName): | |||
| 170 | other_binary_name = launch[OTHER_BINARY_NAME].strip() | 179 | other_binary_name = launch[OTHER_BINARY_NAME].strip() |
| 171 | other_task_name = launch[OTHER_TASK_NAME].strip() | 180 | other_task_name = launch[OTHER_TASK_NAME].strip() |
| 172 | other_core_num = str(int(core_num)+16) | 181 | other_core_num = str(int(core_num)+16) |
| 173 | 182 | if LITMUS: | |
| 183 | other_cost = launch[OTHER_COST].strip() | ||
| 184 | other_deadline = launch[OTHER_DEADLINE].strip() | ||
| 185 | if(int(other_cost) > int(other_deadline)): | ||
| 186 | print("----Error: task {} cost = {} > {} = deadline!----".format(other_task_name, int(other_cost), int(other_deadline))) | ||
| 187 | continue | ||
| 174 | #Check if SMT-paired correctly | 188 | #Check if SMT-paired correctly |
| 175 | # assert(abs(int(core_num)-int(other_core_num)) == 16) | 189 | # assert(abs(int(core_num)-int(other_core_num)) == 16) |
| 176 | if ID2PID(other_task_name): | 190 | if ID2PID(other_task_name): |
| 177 | print("ERROR: Task Name {} is already running! Did you end the previous case study?".format(other_task_name)) | 191 | print("----ERROR: Task Name {} is already running! Did you end the previous case study?----".format(other_task_name)) |
| 178 | return 1 | 192 | return 1 |
| 179 | if LITMUS: | 193 | if LITMUS: |
| 180 | binary = binary_path + binary_name + "_pair" | 194 | binary = binary_path + binary_name + "_pair" |
| 181 | other_binary = binary_path + other_binary_name + "_pair" | 195 | other_binary = binary_path + other_binary_name + "_pair" |
| 182 | # Arg format: <unique name> <num iters> <core> <0 other core> <other name> <runID> <save?> <pairID> <period> <crit lvl> <phase> | 196 | # Arg format: <unique name> <num iters> <core> <0 other core> <other name> <runID> <save?> <pairID> <period> <crit lvl> <phase> |
| 183 | arg1 = " " + task_name + " " + num_iters +" " + core_num +" " + other_core_num+" "+ other_task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level +" "+phase | 197 | arg1 = " " + task_name + " " + num_iters +" " + core_num +" " + other_core_num+" "+ other_task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level +" "+phase + " " + cost + " " + deadline |
| 184 | arg2 = " " + other_task_name + " " + num_iters +" " + other_core_num +" " + core_num+" "+ task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level+" " +phase | 198 | arg2 = " " + other_task_name + " " + num_iters +" " + other_core_num +" " + core_num+" "+ task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level+" " +phase + " " + other_cost + " " + other_deadline |
| 185 | # print(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1) | 199 | # print(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1) |
| 186 | # print(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2) | 200 | # print(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2) |
| 187 | bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file) | 201 | bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file) |
