-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild_coq_projects.sh
executable file
·57 lines (46 loc) · 1.86 KB
/
build_coq_projects.sh
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
#!/usr/bin/env bash
# source swarm-prelude.sh
# INIT_CMD="~/opam-scripts/read-opam.sh"
INIT_CMD=""
NTHREADS=1
while getopts ":j:" opt; do
case "$opt" in
j)
NTHREADS="${OPTARG}"
shift
;;
esac
done
# Make sure ruby is in the path
export PATH=$HOME/.local/bin:$PATH
git submodule init && git submodule update
TARGETS=${@:-$(jq -r '.[].project_name' coqgym_projs_splits.json)}
for project in $TARGETS; do
SBATCH_FLAGS=""
echo "#!/usr/bin/env bash" > coq-projects/$project/make.sh
echo ${INIT_CMD} >> coq-projects/$project/make.sh
if $(jq -e ".[] | select(.project_name == \"$project\") | has(\"build_command\")" \
coqgym_projs_splits.json); then
BUILD=$(jq -r ".[] | select(.project_name == \"$project\") | .build_command" \
coqgym_projs_splits.json)
else
BUILD="make"
fi
if $(jq -e ".[] | select(.project_name == \"$project\") | has(\"build_partition\")" \
coqgym_projs_splits.json); then
PART=$(jq -r ".[] | select(.project_name == \"$project\") | .build_partition" \
coqgym_projs_splits.json)
SBATCH_FLAGS+=" -p $PART"
fi
if $(jq -e ".[] | select(.project_name == \"$project\") | has(\"timeout\")" \
coqgym_projs_splits.json); then
TIMEOUT=$(jq -r ".[] | select(.project_name == \"$project\") | .timeout" \
coqgym_projs_splits.json)
SBATCH_FLAGS+=" --time=${TIMEOUT}"
fi
SWITCH=$(jq -r ".[] | select(.project_name == \"$project\") | .switch" coqgym_projs_splits.json)
echo "eval \"$(opam env --set-switch --switch=$SWITCH)\"" >> coq-projects/$project/make.sh
echo "$BUILD -j $NTHREADS" >> coq-projects/$project/make.sh
chmod u+x coq-projects/$project/make.sh
(cd coq-projects/$project && sbatch --cpus-per-task=${NTHREADS} $SBATCH_FLAGS -o build-output.out make.sh)
done