-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_cluster_experiments.sh
More file actions
57 lines (48 loc) · 1.41 KB
/
run_cluster_experiments.sh
File metadata and controls
57 lines (48 loc) · 1.41 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
#!/bin/bash -x
file_system_setup() {
mkdir -p $MODEL_FILES
mkdir -p $PARAMETRIC_EXPS_BASE
}
get_models() {
if ! [ -f "$MODEL_FILES/benchmark.zip" ]
then
echo "Downloading benchmark instances"
wget http://miplib.zib.de/downloads/benchmark.zip -P instances/
else
echo "Benchmark instance archive already exists"
fi
unzip -u $MODEL_FILES/benchmark.zip -d $MODEL_FILES
fi
}
check_apptainer() {
module load apptainer
if [ ! -f $OPTIMAL_CUT_CONTAINER ]; then
echo "Building Apptainer"
apptainer build $OPTIMAL_CUT_CONTAINER $APPTAINER_DEF_PATH
else
echo "Optimal cut image already exists."
fi
}
setup_experiments() {
srun --partition=$PARTITION --account=$CLUSTER_ACCOUNT --ntasks=1 --cpus-per-task=1 --time="$SETUP_TIME:00" --mem=$SETUP_MEM --wait ./src/Experiments/source/setup_experiments.sh
}
run_experiments(){
# The number of * is based on the number of non global parameters for experiments
# Currently the directory paths represent algorithm/cut_score/max_number_of_bkpts/max_number_of_cuts/
# see fun:setup_experiment_paths in setup_experiments.py
for experiment in $PARAMETRIC_EXPS_BASE/*/*/*/*/TrialPrograms/run_trails.sh;
do
chmod +x $experiment
echo "Dispatching trial runs for $experiment."
./$experiment
done
}
main(){
echo "Loading cluster environment."
source "./src/Experiments/source/cluster_environment.sh"
file_system_setup()
get_models()
check_apptainer()
run_experiments()
}
main()