7
7
# - mpi and lavavu dockers are automatically generated via github actions
8
8
# - petsc and underworld2 must be created by runn the following script.
9
9
10
- UBUNTU_VERSION=24.04
11
- PYTHON_VERSION=3.12
10
+ PYTHON_VERSION=3.11
12
11
OMPI_VERSION=4.1.4
12
+ MPICH_VERSION=3.4.3
13
13
PETSC_VERSION=3.22.2
14
14
15
+ MPI_IMPLEMENTATION=opmi
16
+
17
+ BASE_IMAGE=" python:$PYTHON_VERSION -slim-bookworm"
18
+
19
+ # ### x86 images can be built on mac arm architecture using rosetta
15
20
ARCH=$( uname -m)
16
- echo " Will build docker image locally for architecture type: $ARCH "
21
+ echo " Will build docker image locally for architecture type: $ARCH , with mpi implementation: $MPI_IMPLEMENTATION "
17
22
echo " ************************************************************\n"
18
23
19
- # Get the ubuntu image
20
- podman pull ubuntu:$UBUNTU_VERSION
24
+
25
+ # Get the base image
26
+ podman pull $BASE_IMAGE
21
27
22
28
# # The mpi and lavavu images should be automatically made via github actions
23
- podman build . \
24
- --rm --squash-all \
25
- -f ./docs/development/docker/mpi/Dockerfile.openmpi \
26
- --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
27
- --build-arg OMPI_VERSION=$OMPI_VERSION \
28
- -t underworldcode/openmpi:$OMPI_VERSION -$ARCH
29
+
30
+ if [ " $MPI_IMPLEMENTATION " = " MPICH" ]
31
+ then
32
+ # # Default is openmpi, but can be switched to mpich
33
+ podman build . \
34
+ --rm --squash-all \
35
+ -f ./docs/development/docker/mpi/Dockerfile.mpich \
36
+ --build-arg BASE_IMAGE=$BASE_IMAGE \
37
+ --build-arg PYTHON_VERSION=$PYTHON_VERSION \
38
+ --build-arg MPICH_VERSION=$MPICH_VERSION \
39
+ -t underworldcode/mpich:$MPICH_VERSION -$ARCH
40
+
41
+ MPI_IMAGE=underworldcode/mpich:$MPICH_VERSION -$ARCH
42
+ mpi_lowercase=" mpich"
43
+ else
44
+ podman build . \
45
+ --rm --squash-all \
46
+ -f ./docs/development/docker/mpi/Dockerfile.openmpi \
47
+ --build-arg BASE_IMAGE=$BASE_IMAGE \
48
+ --build-arg PYTHON_VERSION=$PYTHON_VERSION \
49
+ --build-arg OMPI_VERSION=$OMPI_VERSION \
50
+ -t underworldcode/openmpi:$OMPI_VERSION -$ARCH
51
+
52
+ MPI_IMAGE=underworldcode/openmpi:$OMPI_VERSION -$ARCH
53
+ mpi_lowercase=" ompi"
54
+ fi
29
55
30
56
podman build . \
31
57
--rm --squash-all \
32
58
-f ./docs/development/docker/lavavu/Dockerfile \
33
- --build-arg UBUNTU_VERSION= $UBUNTU_VERSION \
59
+ --build-arg BASE_IMAGE= $BASE_IMAGE \
34
60
--build-arg PYTHON_VERSION=$PYTHON_VERSION \
35
61
-t underworldcode/lavavu:$ARCH
36
62
37
63
podman build . \
38
64
--rm --squash-all \
39
65
-f ./docs/development/docker/petsc/Dockerfile \
40
- --build-arg MPI_IMAGE= " underworldcode/openmpi: $OMPI_VERSION - $ARCH " \
41
- --build-arg UBUNTU_VERSION= $UBUNTU_VERSION \
66
+ --build-arg BASE_IMAGE= $BASE_IMAGE \
67
+ --build-arg MPI_IMAGE= $MPI_IMAGE \
42
68
--build-arg PYTHON_VERSION=$PYTHON_VERSION \
43
69
--build-arg PETSC_VERSION=$PETSC_VERSION \
44
- -t underworldcode/petsc:$PETSC_VERSION -$ARCH
70
+ -t underworldcode/petsc- $mpi_lowercase :$PETSC_VERSION -$ARCH
45
71
46
72
# ## don't use pull here as we want the petsc image above
47
73
podman build . \
48
74
--rm --squash-all \
49
- --build-arg UBUNTU_VERSION= $UBUNTU_VERSION \
75
+ --build-arg BASE_IMAGE= $BASE_IMAGE \
50
76
--build-arg PYTHON_VERSION=$PYTHON_VERSION \
51
- --build-arg PETSC_IMAGE=" underworldcode/petsc:$PETSC_VERSION -$ARCH " \
77
+ --build-arg PETSC_IMAGE=" underworldcode/petsc- $mpi_lowercase :$PETSC_VERSION -$ARCH " \
52
78
--build-arg LAVAVU_IMAGE=" underworldcode/lavavu:$ARCH " \
53
79
-f ./docs/development/docker/underworld2/Dockerfile \
54
- -t underworldcode/underworld2:2.16.0b-$ARCH
80
+ -t underworldcode/underworld2-$mpi_lowercase :2.16.0b-$ARCH
81
+
55
82
56
- # docker push underworldcode/petsc:3.19.4 -$ARCH
57
- # docker push underworldcode/underworld2:2.15 .0b-$ARCH
83
+ # docker push underworldcode/petsc-$mpi_lowercase:$PETSC_VERSION -$ARCH
84
+ # docker push underworldcode/underworld2-$mpi_lowercase :2.16 .0b-$ARCH
58
85
59
86
# ### if updates for both arm64 and x86_64 build manifest, ie
60
87
# docker manifest create underworldcode/petsc:3.18.1 \
@@ -64,3 +91,20 @@ podman build . \
64
91
# docker manifest push underworldcode/petsc:3.18.1
65
92
#
66
93
# in future this should be automated
94
+
95
+
96
+
97
+ # # How to use image on HPC with singularity/apptainer
98
+
99
+ # ## save the docker image
100
+ # podman save -o underworld2-$mpi_lowercase-2.16.0b-$ARCH.tar underworldcode/underworld2-$mpi_lowercase:2.16.0b-$ARCH
101
+ # ## upload to hpc
102
+ # scp underworld2-$mpi_lowercase-2.16.0b-$ARCH.tar user@setonix.pawsey.org.au:/path/to/store/container
103
+ # ## extract using singularity/apptainer on HPC
104
+ # module load singularity...
105
+ # singularity build underworld2-mpich-2.16.0b-x86_64.sif docker-archive://underworld2-mpich-2.16.0b-x86_64.tar
106
+
107
+
108
+ # ## Some good resources for using containers on HPC:
109
+ # (1) checking mpi is using system install not container
110
+ # https://pawseysc.github.io/containers-astro-python-workshop/3.hpc/index.html
0 commit comments