-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_scripts.py
27 lines (22 loc) · 947 Bytes
/
run_scripts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
CONFIGS_DIR_PREFIX = 'configs/group_2/'
RESULTS_DIR_PREFIX = 'sim_results/group_2/'
TRACE_DIR_PREFIX = 'trace/'
SIM = "target/release/cache-simulator"
CARGO = "cargo"
config_names = os.listdir(CONFIGS_DIR_PREFIX)
config_files = [f"{CONFIGS_DIR_PREFIX}{file}" for file in config_names]
trace_names = os.listdir(TRACE_DIR_PREFIX)
trace_files = [f"{TRACE_DIR_PREFIX}{file}" for file in trace_names]
# Compile
os.system(f"{CARGO} build --release")
# Execution
for (config_name, config_file) in zip(config_names, config_files):
for (trace_name, trace_file) in zip(trace_names, trace_files):
config_name = config_name.split('.')[0]
trace_name = trace_name.split('.')[0]
res_dir = f"{RESULTS_DIR_PREFIX}{trace_name}/"
os.makedirs(res_dir, exist_ok=True)
save_path = f"{res_dir}{config_name}.txt"
os.system(
f"{SIM} --config {config_file} --trace {trace_file} > {save_path}")