summaryrefslogtreecommitdiffstats
path: root/run_case_study_dag.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_case_study_dag.py')
-rwxr-xr-xrun_case_study_dag.py71
1 files changed, 50 insertions, 21 deletions
diff --git a/run_case_study_dag.py b/run_case_study_dag.py
index 516458f..d4f12e1 100755
--- a/run_case_study_dag.py
+++ b/run_case_study_dag.py
@@ -17,6 +17,8 @@ import subprocess
17binary_path = "./SD-VBS/dag_binaries/" 17binary_path = "./SD-VBS/dag_binaries/"
18stderr_file = open("./deadline_misses", 'w+') 18stderr_file = open("./deadline_misses", 'w+')
19 19
20LITMUS = True
21
20BINARY_NAME = 1 22BINARY_NAME = 1
21TASK_NAME = 2 23TASK_NAME = 2
22NUM_ITERS = 3 24NUM_ITERS = 3
@@ -98,13 +100,17 @@ def main(pathName):
98 mask = "0000" 100 mask = "0000"
99 mask = mask[:in_ccx] +'f'+ mask[in_ccx+1:] 101 mask = mask[:in_ccx] +'f'+ mask[in_ccx+1:]
100 if ccx == 0: 102 if ccx == 0:
103 run('echo {} > /sys/fs/resctrl/core-{}/cpus_list'.format(core, core))
101 run('echo "L3:0=' + mask + ';1=0000;2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core)) 104 run('echo "L3:0=' + mask + ';1=0000;2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core))
102 # run('echo "L3:0=ffff;1=0000;2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core)) 105 # run('echo "L3:0=ffff;1=0000;2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core))
103 if ccx == 1: 106 if ccx == 1:
107 run('echo {} > /sys/fs/resctrl/core-{}/cpus_list'.format(core, core))
104 run('echo "L3:0=0000;1=' + mask + ';2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core)) 108 run('echo "L3:0=0000;1=' + mask + ';2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core))
105 if ccx == 2: 109 if ccx == 2:
110 run('echo {} > /sys/fs/resctrl/core-{}/cpus_list'.format(core, core))
106 run('echo "L3:0=0000;1=0000;2=' + mask + ';3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core)) 111 run('echo "L3:0=0000;1=0000;2=' + mask + ';3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core))
107 if ccx == 3: 112 if ccx == 3:
113 run('echo {} > /sys/fs/resctrl/core-{}/cpus_list'.format(core, core))
108 run('echo "L3:0=0000;1=0000;2=0000;3=' + mask + '" > /sys/fs/resctrl/core-{}/schemata'.format(core)) 114 run('echo "L3:0=0000;1=0000;2=0000;3=' + mask + '" > /sys/fs/resctrl/core-{}/schemata'.format(core))
109 115
110 # return 1 116 # return 1
@@ -120,9 +126,10 @@ def main(pathName):
120 core_num =launch[CORE_NUM].strip() 126 core_num =launch[CORE_NUM].strip()
121 run_id = launch[RUN_ID].strip() 127 run_id = launch[RUN_ID].strip()
122 save_result = launch[SAVE_RESULT].strip() 128 save_result = launch[SAVE_RESULT].strip()
123 period = launch[PERIOD].strip() 129 if LITMUS:
124 crt_level = launch[CRT_LEVEL].strip() 130 period = launch[PERIOD].strip()
125 phase = launch[PHASE].strip() 131 crt_level = launch[CRT_LEVEL].strip()
132 phase = launch[PHASE].strip()
126 133
127 134
128 phys_core = int(core_num) % 16 135 phys_core = int(core_num) % 16
@@ -131,13 +138,20 @@ def main(pathName):
131 return 1 138 return 1
132 # single tasks 139 # single tasks
133 if launch[0] == '0': 140 if launch[0] == '0':
134 # binary = binary_path + binary_name + "_single" 141 if LITMUS:
135 binary = binary_path + binary_name + "_single_no_litmus" 142 binary = binary_path + binary_name + "_single"
136 # Arg format: <unique name> <num_iters> <core> <NULL runID> <save?> <period> <crit lvl> 143 # Arg format: <unique name> <num_iters> <core> <NULL runID> <save?> <period> <crit lvl> <phase>
137 # arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " + period +" " + crt_level + " "+ phase 144 arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " + period +" " + crt_level + " "+ phase
138 arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " 145 bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file)
139 # print(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg) 146 else:
140 bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file) 147 # Arg format: <unique name> <num_iters> <core> <NULL runID>
148 binary = binary_path + binary_name + "_single_no_litmus"
149 arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" "
150 bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all taskset -c " + core_num + " " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file)
151
152 # print(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg)
153 # print(binary)
154 # print(arg)
141 pid_str = ID2PID(binary + " " + task_name) 155 pid_str = ID2PID(binary + " " + task_name)
142 if not pid_str: 156 if not pid_str:
143 print("Unable to launch {} as a solo task! Exiting...".format(task_name)) 157 print("Unable to launch {} as a solo task! Exiting...".format(task_name))
@@ -154,15 +168,24 @@ def main(pathName):
154 if ID2PID(other_task_name): 168 if ID2PID(other_task_name):
155 print("ERROR: Task Name {} is already running! Did you end the previous case study?".format(other_task_name)) 169 print("ERROR: Task Name {} is already running! Did you end the previous case study?".format(other_task_name))
156 return 1 170 return 1
157 binary = binary_path + binary_name + "_pair" 171 if LITMUS:
158 other_binary = binary_path + other_binary_name + "_pair" 172 binary = binary_path + binary_name + "_pair"
159 # Arg format: <unique name> <num iters> <core> <0 other core> <other name> <runID> <save?> <pairID> <period> <crit lvl> 173 other_binary = binary_path + other_binary_name + "_pair"
160 arg1 = " " + task_name + " " + num_iters +" " + core_num +" " + other_core_num+" "+ other_task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level +" "+phase 174 # Arg format: <unique name> <num iters> <core> <0 other core> <other name> <runID> <save?> <pairID> <period> <crit lvl> <phase>
161 arg2 = " " + other_task_name + " " + num_iters +" " + other_core_num +" " + core_num+" "+ task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level+" " +phase 175 arg1 = " " + task_name + " " + num_iters +" " + core_num +" " + other_core_num+" "+ other_task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level +" "+phase
162 # print(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1) 176 arg2 = " " + other_task_name + " " + num_iters +" " + other_core_num +" " + core_num+" "+ task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level+" " +phase
163 # print(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2) 177 # print(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1)
164 bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file) 178 # print(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2)
165 bench_tsk2 = subprocess.Popen(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2, shell=True, executable='/bin/bash', stderr=stderr_file) 179 bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file)
180 bench_tsk2 = subprocess.Popen(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2, shell=True, executable='/bin/bash', stderr=stderr_file)
181 else:
182 binary = binary_path + binary_name + "_pair_no_litmus"
183 other_binary = binary_path + other_binary_name + "_pair_no_litmus"
184 # Arg format: <unique name> <num iters> <core> <0 other core> <other name> <runID> <save?> <pairID>
185 arg1 = " " + task_name + " " + num_iters +" " + core_num +" " + other_core_num+" "+ other_task_name+" "+ run_id +" " + save_result+" " +str(pairID)
186 arg2 = " " + other_task_name + " " + num_iters +" " + other_core_num +" " + core_num+" "+ task_name+" "+ run_id +" " + save_result+" " +str(pairID)
187 bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 taskset -c " + core_num + " " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file)
188 bench_tsk2 = subprocess.Popen(input_cmd[other_binary_name] + " | numactl --membind=1 taskset -c " + core_num + " " + other_binary + arg2, shell=True, executable='/bin/bash', stderr=stderr_file)
166 # print(binary + " " + task_name,other_binary + " " +other_task_name) 189 # print(binary + " " + task_name,other_binary + " " +other_task_name)
167 pid1_str = ID2PID(binary + " " + task_name) 190 pid1_str = ID2PID(binary + " " + task_name)
168 pid2_str = ID2PID(other_binary + " " +other_task_name) 191 pid2_str = ID2PID(other_binary + " " +other_task_name)
@@ -175,13 +198,19 @@ def main(pathName):
175 pairID += 1 198 pairID += 1
176 199
177if __name__ == "__main__": 200if __name__ == "__main__":
178 if len(sys.argv) < 2: 201 if len(sys.argv) < 3:
179 print("Usage: " + sys.argv[0] + " <task sets path>") 202 print("Usage: " + sys.argv[0] + " <task sets path> <LITMUS>")
180 exit(1) 203 exit(1)
181 if os.geteuid() != 0: 204 if os.geteuid() != 0:
182 print("You must run this script as root to enable cache isolation and access LITMUS-RT.") 205 print("You must run this script as root to enable cache isolation and access LITMUS-RT.")
183 exit(1) 206 exit(1)
184 pathName = sys.argv[1] 207 pathName = sys.argv[1]
208 if sys.argv[2] == '1':
209 LITMUS =True
210 else:
211 LITMUS = False
212 print("Litmus on ? " + str(LITMUS))
213 # exit(0)
185 err = main(pathName) 214 err = main(pathName)
186 input("Done. Waiting for termination signal...") 215 input("Done. Waiting for termination signal...")
187 exit(err) 216 exit(err)