-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_ocs_slurm_scripts.py
More file actions
42 lines (35 loc) · 1.27 KB
/
make_ocs_slurm_scripts.py
File metadata and controls
42 lines (35 loc) · 1.27 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
from pathlib import Path
import json
data_dir = Path("./data")
slurm_dir = Path("./slurm")
threads = 48
systems = json.load(open(data_dir / "metadata.json")).keys()
for system in systems:
print(system)
for ot in ["both", "mean"]: # ["mean", "max", "both"]:
slurm_file = slurm_dir / f"ocs_{system}_{ot}.sh"
slurm_file.write_text(f"""#!/bin/sh
#SBATCH -p fpgaq # partition (queue)
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task {threads}
#SBATCH -t 14-00:00 # time (D-HH:MM)
#SBATCH -o slurm.{system}_{ot}.%N.%j.out # STDOUT
#SBATCH -e slurm.{system}_{ot}.%N.%j.err # STDERR
echo "Running ocs for {system} with {ot} optimization"
srun python src/ocs_ortools.py --system {system} --optimize_type {ot} --threads {threads}
echo "Done"
""")
slurm_file = slurm_dir / f"ocs_{system}_{ot}_cv.sh"
slurm_file.write_text(f"""#!/bin/sh
#SBATCH -p fpgaq # partition (queue)
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task {threads}
#SBATCH -t 14-00:00 # time (D-HH:MM)
#SBATCH -o slurm.{system}_{ot}_cv.%N.%j.out # STDOUT
#SBATCH -e slurm.{system}_{ot}_cv.%N.%j.err # STDERR
echo "Running ocs for {system} with {ot} optimization (CV)"
srun python src/ocs_ortools_cv.py --system {system} --optimize_type {ot} --threads {threads}
echo "Done"
""")