-
Notifications
You must be signed in to change notification settings - Fork 7
/
build_containers.sh
95 lines (87 loc) · 1.95 KB
/
build_containers.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
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
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
set -e # exit upon failure
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root or with sudo."
exit 1
fi
# Initialize flags
psiflow=false
gpaw=false
cp2k=false
build_sif=false
#mpi=mpich
# Parse command line options
while [[ $# -gt 0 ]]; do
case "$1" in
--gpaw)
gpaw=true
shift # Shift to next argument
;;
--cp2k)
cp2k=true
shift
;;
--psiflow)
psiflow=true
shift
;;
--build_sif)
build_sif=true
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
PSIFLOW_VERSION="v4.0.0"
CCTOOLS_VERSION=7.14.0
PLUMED_VERSION=2.9.0
GPU_LIBRARIES=("rocm6.2" "cu118")
# build model
if [ "$psiflow" = "true" ]; then
for GPU_LIBRARY in "${GPU_LIBRARIES[@]}"; do
TAG="psiflow:${PSIFLOW_VERSION}_${GPU_LIBRARY}"
docker build \
--build-arg GPU_LIBRARY=${GPU_LIBRARY} \
--build-arg PARSL_VERSION=$PARSL_VERSION \
--build-arg PSIFLOW_VERSION=$PSIFLOW_VERSION \
--build-arg CCTOOLS_VERSION=$CCTOOLS_VERSION \
--build-arg PLUMED_VERSION=$PLUMED_VERSION \
--build-arg DATE=$(date +%s) \
-t ghcr.io/molmod/$TAG \
-f Dockerfile . # test
if [ "$build_sif" = "true" ]; then
export TMPDIR=$(pwd)/tmp
mkdir -p $TMPDIR
apptainer build -F $TAG.sif docker-daemon:ghcr.io/molmod/$TAG
apptainer push $TAG.sif oras://ghcr.io/molmod/$TAG
rm $TAG.sif
rm -rf $TMPDIR
fi
done
fi
if [ "$cp2k" = "true" ]; then
TAG="cp2k:2024.1"
docker build \
-t ghcr.io/molmod/$TAG \
-f Dockerfile.cp2k .
if [ "$build_sif" = "true" ]; then
apptainer build -F $TAG.sif docker-daemon:ghcr.io/molmod/$TAG
apptainer push $TAG.sif oras://ghcr.io/molmod/$TAG
rm $TAG.sif
fi
fi
if [ "$gpaw" = "true" ]; then
TAG="gpaw:24.1"
sudo docker build \
--build-arg PSIFLOW_VERSION=$PSIFLOW_VERSION \
-t ghcr.io/molmod/$TAG \
-f Dockerfile.gpaw .
if [ "$build_sif" = "true" ]; then
apptainer build -F $TAG.sif docker-daemon:ghcr.io/molmod/$TAG
apptainer push $TAG.sif oras://ghcr.io/molmod/$TAG
rm $TAG.sif
fi
fi