From f03770f9c67c5c08209d0ca24c963e5c99554bd6 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Wed, 14 Jun 2023 15:25:05 -0600 Subject: [PATCH 1/4] Simplify docker image to work with both apptainer and docker --- docker/rayleigh/Dockerfile | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/docker/rayleigh/Dockerfile b/docker/rayleigh/Dockerfile index 8f216063..9fa3023b 100644 --- a/docker/rayleigh/Dockerfile +++ b/docker/rayleigh/Dockerfile @@ -1,18 +1,14 @@ FROM geodynamics/rayleigh-buildenv-jammy:latest +# expose the port for Jupyter EXPOSE 8888 -RUN useradd \ - --create-home \ - rayleigh_user +# define Rayleigh directory +ENV RAYLEIGH_DIR /opt/Rayleigh -USER rayleigh_user +RUN git clone 'https://github.com/geodynamics/Rayleigh.git' ${RAYLEIGH_DIR} -WORKDIR /home/rayleigh_user - -RUN git clone 'https://github.com/geodynamics/Rayleigh.git' - -WORKDIR /home/rayleigh_user/Rayleigh +WORKDIR ${RAYLEIGH_DIR} RUN ./configure \ -debian-mkl \ @@ -20,8 +16,10 @@ RUN ./configure \ && make install \ && make clean -ENV RAYLEIGH_DIR /home/rayleigh_user/Rayleigh - +# Add Rayleigh to the path ENV PATH="${RAYLEIGH_DIR}/bin:${PATH}" - ENV PYTHONPATH="${RAYLEIGH_DIR}/post_processing${PYTHONPATH:+:$PYTHONPATH}" + +# Allow running OpenMPI as root +ENV OMPI_ALLOW_RUN_AS_ROOT=1 +ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 From 0ba11fd3c6dd022d85671b4eb2a000cd69638439 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Wed, 14 Jun 2023 15:52:25 -0600 Subject: [PATCH 2/4] Update documentation --- doc/source/User_Guide/getting_started.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/source/User_Guide/getting_started.rst b/doc/source/User_Guide/getting_started.rst index 0166ed61..25d3526b 100644 --- a/doc/source/User_Guide/getting_started.rst +++ b/doc/source/User_Guide/getting_started.rst @@ -120,7 +120,20 @@ Docker provides a standardized way to build, distribute and run containerized en Launching the container ^^^^^^^^^^^^^^^^^^^^^^^ -You can download our pre-built container from Docker Hub and launch it using the command from the main Rayleigh directory. The following command is for GNU/Linux and macOS users. +You can launch our pre-built container that is hosted on Docker Hub from a terminal. +This container is set up to get used to Rayleigh not to run productive models with it. + +.. code-block:: bash + docker run -it --rm geodynamics/rayleigh:latest bash + +This command will create a terminal inside the container and drop you in a directory +that contains a pre-compiled version of Rayleigh. You can run input examples or +tests by executing `rayleigh.opt` or `rayleigh.dbg` and look at the output files, but +all files will be deleted when you `exit` the container. + +We also provide a container with a development environment for Rayleigh that allows you to change the code, build the +documentation and the code, and to keep model outputs. +The following command is for GNU/Linux and macOS users. .. code-block:: bash @@ -136,7 +149,7 @@ Windows users should run the script ``docker-devel.bat`` instead. Configuration and Compilation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. note:: All these commands are run inside the Docker container and assume you have a copy of Rayleigh at ``$HOME/path/to/Rayleigh`` (which corresponds to ``/root/path/to/Rayleigh`` inside the container). +.. note:: All these commands are run inside the Docker container and assume you have a copy of Rayleigh at ``$HOME/path/to/Rayleigh`` (which corresponds to ``/work/path/to/Rayleigh`` inside the container). Building the documentation From 1fc16245c0a552f8f214b6d8ef5193cb4c039c7a Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Fri, 16 Jun 2023 09:46:57 -0600 Subject: [PATCH 3/4] Add fix for OpenMPI warnings --- docker/rayleigh/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/rayleigh/Dockerfile b/docker/rayleigh/Dockerfile index 9fa3023b..aa8f78b2 100644 --- a/docker/rayleigh/Dockerfile +++ b/docker/rayleigh/Dockerfile @@ -20,6 +20,7 @@ RUN ./configure \ ENV PATH="${RAYLEIGH_DIR}/bin:${PATH}" ENV PYTHONPATH="${RAYLEIGH_DIR}/post_processing${PYTHONPATH:+:$PYTHONPATH}" -# Allow running OpenMPI as root +# Allow running OpenMPI as root and avoid warning messages ENV OMPI_ALLOW_RUN_AS_ROOT=1 ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 +ENV OMPI_MCA_btl_vader_single_copy_mechanism=none From e8a6d85b57536d9db675a74ed2c1f0c6ac504330 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Fri, 16 Jun 2023 11:20:55 -0600 Subject: [PATCH 4/4] Add note to documentation --- doc/source/User_Guide/getting_started.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/source/User_Guide/getting_started.rst b/doc/source/User_Guide/getting_started.rst index 25d3526b..ef2a63bb 100644 --- a/doc/source/User_Guide/getting_started.rst +++ b/doc/source/User_Guide/getting_started.rst @@ -117,6 +117,7 @@ Docker Container ~~~~~~~~~~~~~~~ Docker provides a standardized way to build, distribute and run containerized environments on Linux, macOS, and Windows. To get started you should install Docker on your system following the instructions from `here `_. On Linux you can likely also install it from a distribution package (e.g., ``docker-io`` on Debian/Ubuntu). `Podman `_ is an alternative runtime that can run Docker containers and can be used as a drop-in replacement for Docker. +Singularity/Apptainer are other available alternatives that are more commonly used on HPC systems. Launching the container ^^^^^^^^^^^^^^^^^^^^^^^ @@ -131,6 +132,8 @@ that contains a pre-compiled version of Rayleigh. You can run input examples or tests by executing `rayleigh.opt` or `rayleigh.dbg` and look at the output files, but all files will be deleted when you `exit` the container. +.. note:: If you use Apptainer/Singularity instead of docker you can keep the model output files, because Apptainer by default mounts the current directory into the container. The command to run Rayleigh inside the container is ``mpirun -np X apptainer exec geodynamics/rayleigh:latest rayleigh.opt``` (assuming you have a Rayleigh input file in the current directory). + We also provide a container with a development environment for Rayleigh that allows you to change the code, build the documentation and the code, and to keep model outputs. The following command is for GNU/Linux and macOS users.