-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from dynamicslab/lp/patch-1
Improvement of Developer's Experience
- Loading branch information
Showing
13 changed files
with
301 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "HydroGym Devpod", | ||
|
||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
// pulling from Dockerhub | ||
"image": "lpaehler/hydrogym-devpod:stable", | ||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/black:2": {}, | ||
"ghcr.io/devcontainers-contrib/features/poetry:2": {}, | ||
"ghcr.io/devcontainers-contrib/features/ruff:1": {} | ||
}, | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// Setting up an editable version of HydroGym | ||
"postCreateCommand": "pip install -e ." | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Full Firedrake pre-installed with all of it enabled | ||
FROM lpaehler/hydrogym-env:stable | ||
|
||
# Activation of the virtual environment | ||
RUN bash -c "source firedrake/bin/activate" | ||
|
||
# Clone HydroGym | ||
RUN bash -c "git clone https://github.com/dynamicslab/hydrogym.git" | ||
|
||
# Installation of HydroGym's dependencies, and only the | ||
# the dependencies | ||
RUN bash -c "cd hydrogym && pip install -r requirements.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
# DockerFile for an environment into which firedrake can be installed. | ||
# entirely based on: | ||
# https://github.com/firedrakeproject/firedrake/blob/master/docker/Dockerfile.env | ||
FROM ubuntu:22.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 \ | ||
liboce-ocaf-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 | ||
|
||
# Set up user so that we do not run as root | ||
RUN useradd -m -s /bin/bash -G 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 \ | ||
--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-chaco \ | ||
--download-fftw \ | ||
--download-hdf5 \ | ||
--download-hwloc \ | ||
--download-hypre \ | ||
--download-metis \ | ||
--download-ml \ | ||
--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 \ | ||
--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-chaco-dir=$PACKAGES \ | ||
--with-fftw-dir=$PACKAGES \ | ||
--with-hdf5-dir=$PACKAGES \ | ||
--with-hwloc-dir=$PACKAGES \ | ||
--with-hypre-dir=$PACKAGES \ | ||
--with-metis-dir=$PACKAGES \ | ||
--with-ml-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 \ | ||
--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-chaco-dir=$PACKAGES \ | ||
--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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Dockerfile with HydroGym included | ||
# --> highly unstable for now. | ||
|
||
FROM lpaehler/hydrogym-env:stable | ||
|
||
USER firedrake | ||
WORKDIR /home/firedrake | ||
|
||
# Activation of the virtual environment | ||
RUN bash -c "source firedrake/bin/activate" | ||
|
||
# Clone HydroGym | ||
RUN bash -c "git clone https://github.com/dynamicslab/hydrogym.git" | ||
|
||
# Installation of HydroGym | ||
RUN bash -c "cd hydrogym && pip install ." | ||
|
||
#RUN bash -c ". $VENV/bin/activate && pip install -e /home/hydrogym" | ||
#RUN bash -c ". $VENV_COMPLEX/bin/activate && pip install -e /home/hydrogym" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Dockerfile for a fully enabled Firedrake as base environment for HydroGym | ||
# Based on: | ||
# https://github.com/firedrakeproject/firedrake/blob/master/docker/Dockerfile.vanilla | ||
# https://github.com/firedrakeproject/firedrake/blob/master/docker/Dockerfile.firedrake | ||
|
||
FROM lpaehler/hydrogym-firedrake-env:stable | ||
|
||
USER firedrake | ||
WORKDIR /home/firedrake | ||
|
||
ENV PETSC_ARCH default | ||
|
||
# Installation of basic Firedrake. | ||
RUN curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install | ||
RUN bash -c "python3 firedrake-install \ | ||
--no-package-manager \ | ||
--disable-ssh \ | ||
--torch \ | ||
--honour-petsc-dir \ | ||
--mpicc=$MPICH_DIR/mpicc \ | ||
--mpicxx=$MPICH_DIR/mpicxx \ | ||
--mpif90=$MPICH_DIR/mpif90 \ | ||
--mpiexec=$MPICH_DIR/mpiexec" | ||
|
||
# Installation of extra Firedrake components. | ||
RUN bash -c "source firedrake/bin/activate; \ | ||
firedrake-update \ | ||
--documentation-dependencies \ | ||
--netgen \ | ||
--slepc \ | ||
--tinyasm \ | ||
--install femlium \ | ||
--install fascd \ | ||
--install gusto \ | ||
--install icepack \ | ||
--install irksome \ | ||
--install thetis" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.