-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_energy.sh
More file actions
85 lines (73 loc) · 2.82 KB
/
run_energy.sh
File metadata and controls
85 lines (73 loc) · 2.82 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
set -euo pipefail
CONFIG_FILE=${CONFIG_FILE:-config/run_gen_model.yaml}
eval "$(python - <<'PY'
import os, sys, yaml, shlex
cfg_path = os.environ.get('CONFIG_FILE', 'config/run_gen_model.yaml')
if not os.path.isfile(cfg_path):
sys.stderr.write(f"Config not found: {cfg_path}\n")
sys.exit(1)
with open(cfg_path, 'r', encoding='utf-8') as f:
cfg = yaml.safe_load(f) or {}
def g(path, default):
d = cfg
for k in path:
if not isinstance(d, dict) or k not in d:
return default
d = d[k]
return d
items = {
'DATA': g(['data'], './data/train/train-v4.csv'),
'DIS_MODEL': g(['discrete', 'model'], 'GAN'),
'DIS_EPOCHS': g(['discrete', 'epochs'], 10),
'DIS_BATCH': g(['discrete', 'batch'], 500),
'DIS_SAMPLE': g(['discrete', 'sample'], 100),
'CVAE_HIDDEN': g(['cvae', 'hidden'], 1024),
'CVAE_BATCH': g(['cvae', 'batch'], 2048),
'CVAE_EPOCHS': g(['cvae', 'epochs'], 10),
'CVAE_OUT': g(['cvae', 'out'], 'models/VAE_stage2.pt'),
'CVAE_EMBED': g(['cvae', 'embed'], 128),
'LATENT_DIM': g(['cvae', 'embed'], 128),
'RELAX_TYPE': g(['relax', 'type'], 'single'),
'RELAX_NUM': g(['relax', 'num'], 100),
'RELAX_LOG_DIR': g(['relax', 'log_dir'], 'results'),
'TOPO_CHUNK': g(['topology', 'chunk_size'], 1000),
'TOPO_OVERWRITE': g(['topology', 'overwrite'], False),
'TOPO_WARMUP': g(['topology', 'warmup'], True),
'ENERGY_MIN': g(['energy', 'min'], -9.4),
'ENERGY_MAX': g(['energy', 'max'], -8.8),
'MACE_STEPS_SMALL': g(['mace', 'steps_small'], 250),
'MACE_STEPS_MEDIUM': g(['mace', 'steps_medium'], 100),
'MACE_STEPS_LARGE': g(['mace', 'steps_large'], 50),
'ENERGY_CPU': g(['run_energy', 'cpu'], 96),
'ENERGY_RANK': g(['run_energy', 'rank'], 0),
'SKIP_CREATE': g(['run_energy', 'skip_create'], False),
'SKIP_TOPOLOGY': g(['run_energy', 'skip_topology'], False),
'SKIP_GULP': g(['run_energy', 'skip_gulp'], False),
'SKIP_MACE': g(['run_energy', 'skip_mace'], False),
}
for k, v in items.items():
print(f"{k}={shlex.quote(str(v))}")
PY
)"
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
export NUMEXPR_NUM_THREADS=1
export BLIS_NUM_THREADS=1
export MKL_DYNAMIC=FALSE
export OPENBLAS_MAIN_FREE=1
NAME="synthetic_${DIS_MODEL}_dis${DIS_SAMPLE}_CVAE_hd${CVAE_HIDDEN}_e${CVAE_EPOCHS}"
if [[ "${RELAX_TYPE}" == "multi" ]]; then
echo "Running multi-optimization post-processing..."
python b-post_process_multi-opt.py \
--name "${RELAX_LOG_DIR}/${NAME}_type${RELAX_TYPE}" \
--cpu "${ENERGY_CPU}"
echo "Multi-optimization post-processing completed at $(date)"
else
echo "Running single-pass energy analysis..."
python 4_energy.py \
--name "${NAME}_type${RELAX_TYPE}" \
--cpu "${ENERGY_CPU}"
echo "Energy analysis completed at $(date)"
fi