diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f61ab2d9b..fdf5f48dc2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,6 +61,7 @@ jobs: # shellcheck disable=SC2086 ./firedrake/scripts/firedrake-install \ $COMPLEX \ + --petsc-int-type=int64 \ --honour-petsc-dir \ --mpicc="$MPICH_DIR"/mpicc \ --mpicxx="$MPICH_DIR"/mpicxx \ @@ -150,3 +151,12 @@ jobs: tag: ${{ needs.docker_tag.outputs.tag }} status: ${{ needs.build.result }} secrets: inherit + docker_testing: + # Strictly for testing! + uses: ./.github/workflows/docker_reuse.yml + with: + target: firedrake-test + tag: latest + dockerfile: docker/Dockerfile.testing + secrets: inherit + diff --git a/docker/Dockerfile.testing b/docker/Dockerfile.testing new file mode 100644 index 0000000000..6a13b1f417 --- /dev/null +++ b/docker/Dockerfile.testing @@ -0,0 +1,168 @@ +# DockerFile for an environment into which firedrake can be installed. + +FROM ubuntu:24.04 + +# Update and install required packages for Firedrake +USER root +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN apt-get update \ + && apt-get -y dist-upgrade \ + && DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata \ + && apt-get -y install curl vim docker.io \ + openssh-client build-essential autoconf automake \ + cmake gfortran git libopenblas-serial-dev \ + libtool python3-dev python3-pip python3-tk python3-venv \ + python3-requests zlib1g-dev libboost-dev sudo gmsh \ + bison flex ninja-build \ + libocct-ocaf-dev libocct-data-exchange-dev \ + swig graphviz \ + libcurl4-openssl-dev libxml2-dev \ + && rm -rf /var/lib/apt/lists/* + +# Use a more sane locale +ENV LC_ALL C.UTF-8 + +# Change the `ubuntu` user to `firedrake` +# and ensure that we do not run as root on self-hosted systems +RUN usermod -d /home/firedrake -m ubuntu && \ + usermod -l firedrake ubuntu && \ + groupmod -n firedrake ubuntu && \ + usermod -aG sudo firedrake && \ + echo "firedrake:docker" | chpasswd && \ + echo "firedrake ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ + ldconfig + +USER firedrake +WORKDIR /home/firedrake + +# Fetch PETSc, SLEPc and eigen +RUN git clone https://github.com/firedrakeproject/petsc.git +RUN git clone https://github.com/firedrakeproject/slepc.git + +# Build MPICH manually because we don't want PETSc to build it twice +RUN bash -c 'cd petsc; \ + ./configure \ + --with-64-bit-indices=1 \ + --COPTFLAGS=-O3 -march=native -mtune=native \ + --CXXOPTFLAGS=-O3 -march=native -mtune=native \ + --FOPTFLAGS=-O3 -march=native -mtune=native \ + --with-c2html=0 \ + --with-debugging=0 \ + --with-fortran-bindings=0 \ + --with-make-np=12 \ + --with-shared-libraries=1 \ + --with-zlib \ + --download-fftw \ + --download-hdf5 \ + --download-hwloc \ + --download-hypre \ + --download-metis \ + --download-mumps \ + --download-mpich \ + --download-mpich-device=ch3:sock \ + --download-netcdf \ + --download-pastix \ + --download-pnetcdf \ + --download-ptscotch \ + --download-scalapack \ + --download-suitesparse \ + --download-superlu_dist \ + PETSC_ARCH=packages; \ + mv packages/include/petscconf.h packages/include/old_petscconf.nope;' +# Don't run make here, we only want MPICH and HWLOC +# It is also necessary to move `petscconf.h` so packages isn't treated like a working PETSc + +# Build default Firedrake PETSc +RUN bash -c 'export PACKAGES=/home/firedrake/petsc/packages; \ + cd petsc; \ + ./configure \ + --with-64-bit-indices=1 \ + --COPTFLAGS=-O3 -march=native -mtune=native \ + --CXXOPTFLAGS=-O3 -march=native -mtune=native \ + --FOPTFLAGS=-O3 -march=native -mtune=native \ + --with-c2html=0 \ + --with-debugging=0 \ + --with-fortran-bindings=0 \ + --with-make-np=12 \ + --with-shared-libraries=1 \ + --with-bison \ + --with-flex \ + --with-zlib \ + --with-fftw-dir=$PACKAGES \ + --with-hdf5-dir=$PACKAGES \ + --with-hwloc-dir=$PACKAGES \ + --with-hypre-dir=$PACKAGES \ + --with-metis-dir=$PACKAGES \ + --with-mpi-dir=$PACKAGES \ + --with-mumps-dir=$PACKAGES \ + --with-netcdf-dir=$PACKAGES \ + --with-pastix-dir=$PACKAGES \ + --with-pnetcdf-dir=$PACKAGES \ + --with-ptscotch-dir=$PACKAGES \ + --with-scalapack-dir=$PACKAGES \ + --with-suitesparse-dir=$PACKAGES \ + --with-superlu_dist-dir=$PACKAGES \ + PETSC_ARCH=default; \ + make PETSC_DIR=/home/firedrake/petsc PETSC_ARCH=default all;' + +# Build default Firedrake SLEPc +RUN bash -c 'export PETSC_DIR=/home/firedrake/petsc; \ + export PETSC_ARCH=default; \ + cd slepc; \ + ./configure; \ + make SLEPC_DIR=/home/firedrake/slepc PETSC_DIR=/home/firedrake/petsc PETSC_ARCH=default;' + +# Additionally build complex PETSc for Firedrake +RUN bash -c 'export PACKAGES=/home/firedrake/petsc/packages; \ + cd petsc; \ + ./configure \ + --with-64-bit-indices=1 \ + --COPTFLAGS=-O3 -march=native -mtune=native \ + --CXXOPTFLAGS=-O3 -march=native -mtune=native \ + --FOPTFLAGS=-O3 -march=native -mtune=native \ + --with-c2html=0 \ + --with-debugging=0 \ + --with-fortran-bindings=0 \ + --with-make-np=12 \ + --with-scalar-type=complex \ + --with-shared-libraries=1 \ + --with-bison \ + --with-flex \ + --with-zlib \ + --with-fftw-dir=$PACKAGES \ + --with-hdf5-dir=$PACKAGES \ + --with-hwloc-dir=$PACKAGES \ + --with-metis-dir=$PACKAGES \ + --with-mpi-dir=$PACKAGES \ + --with-mumps-dir=$PACKAGES \ + --with-netcdf-dir=$PACKAGES \ + --with-pastix-dir=$PACKAGES \ + --with-pnetcdf-dir=$PACKAGES \ + --with-ptscotch-dir=$PACKAGES \ + --with-scalapack-dir=$PACKAGES \ + --with-suitesparse-dir=$PACKAGES \ + --with-superlu_dist-dir=$PACKAGES \ + PETSC_ARCH=complex; \ + make PETSC_DIR=/home/firedrake/petsc PETSC_ARCH=complex all;' + +# Build complex Firedrake SLEPc +RUN bash -c 'export PETSC_DIR=/home/firedrake/petsc; \ + export PETSC_ARCH=complex; \ + cd slepc; \ + ./configure; \ + make SLEPC_DIR=/home/firedrake/slepc PETSC_DIR=/home/firedrake/petsc PETSC_ARCH=complex;' + +# Clean up unnecessary files +RUN rm -rf /home/firedrake/petsc/**/externalpackages \ + && rm -rf /home/firedrake/petsc/src/docs \ + && rm -f /home/firedrake/petsc/src/**/tutorials/output/* \ + && rm -f /home/firedrake/petsc/src/**/tests/output/* + +# Set some useful environment variables +ENV PETSC_DIR /home/firedrake/petsc +ENV SLEPC_DIR /home/firedrake/slepc +ENV MPICH_DIR /home/firedrake/petsc/packages/bin +ENV HDF5_DIR /home/firedrake/petsc/packages +ENV HDF5_MPI ON +ENV OMP_NUM_THREADS 1 +ENV OPENBLAS_NUM_THREADS 1