-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
67 lines (54 loc) · 2.17 KB
/
Copy pathrun.py
File metadata and controls
67 lines (54 loc) · 2.17 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import subprocess
import toml
import os
import sys
from datetime import datetime
# Configuration settings to test
row_wise_settings = [
"sjq_old_no_overhead",
"sjq_old_has_overhead",
"sjq_new"
]
act_settings = [
"no_preact",
"has_preact"
]
pim_settings = [
"has_pim",
"no_pim"
]
def run_experiment():
# Get base log directory from command line argument or use default
# base_log_dir = sys.argv[1] if len(sys.argv) > 1 else "experiment_logs"
base_log_dir = "experiment_logs"
timestamp = datetime.now().strftime("%F_%H:%M:%S")
for setting in row_wise_settings:
for pim in pim_settings:
print(f"\nRunning experiment with row_wise_value: {setting}")
# Create a timestamp for the log directory
log_dir = f"{base_log_dir}/{timestamp}/{setting}_{pim}"
# Ensure the log directory exists
os.makedirs(log_dir, exist_ok=True)
# Run the bash script with the specified log directory
try:
# Modify the environment to set LOG_DIR
env = os.environ.copy()
env['LOG_DIR'] = log_dir
env['SJQ_CONFIG_PATH'] = f"{setting}_has_preact_{pim}.toml"
result = subprocess.run(["./brun_release.sh"],
check=True,
text=True,
capture_output=True,
env=env)
print(f"Experiment completed successfully for {setting} {pim}")
print(result.stdout)
# Create a symlink to the latest results for this setting
# latest_link = f"latest_{setting}.tsv"
# if os.path.exists(latest_link):
# os.remove(latest_link)
# os.symlink(f"{log_dir}/_summary.tsv", latest_link)
except subprocess.CalledProcessError as e:
print(f"Error running experiment for {setting} {pim}")
print(f"Error output: {e.stderr}")
if __name__ == "__main__":
run_experiment()