Skip to content
Snippets Groups Projects
Unverified Commit 638dd706 authored by Lars Bilke's avatar Lars Bilke Committed by GitHub
Browse files

Merge pull request #2356 from bilke/new-dockerfiles

Introducing ogs-container-generator
parents 27641074 d9f6c0ac
No related branches found
No related tags found
No related merge requests found
Showing
with 1212 additions and 1454 deletions
......@@ -235,6 +235,9 @@ option(OGS_ENABLE_ELEMENT_PYRAMID "Build FEM elements for pyramids." ON)
option(OGS_CHECK_HEADER_COMPILATION "Check header for standalone compilation." OFF)
option(OGS_USE_PYTHON "Interface with Python" OFF)
if(OGS_USE_PYTHON AND NOT Python_FOUND)
message(FATAL_ERROR "Python not found but required for OGS_USE_PYTHON=ON!")
endif()
option(OGS_USE_MFRONT "Enable solid material models by MFront (https://tfel.sourceforge.net)" OFF)
......
#!/usr/bin/env groovy
@Library('jenkins-pipeline@1.0.17') _
@Library('jenkins-pipeline@1.0.18') _
def stage_required = [build: false, data: false, full: false, docker: false]
......@@ -78,7 +78,7 @@ pipeline {
filename 'Dockerfile.gcc.full'
dir 'scripts/docker'
label 'docker'
args '-v /home/jenkins/cache:/home/jenkins/cache -v /home/jenkins/cache/conan/.conan:/home/jenkins/.conan'
args '-v /home/jenkins/cache/ccache:/opt/ccache -v /home/jenkins/cache/conan/.conan:/opt/conan/.conan'
additionalBuildArgs '--pull'
}
}
......@@ -143,10 +143,11 @@ pipeline {
}
agent {
dockerfile {
filename 'Dockerfile.gcc.full'
filename 'Dockerfile.gcc.gui'
dir 'scripts/docker'
label 'docker'
args '-v /home/jenkins/cache:/home/jenkins/cache -v /home/jenkins/cache/conan/.conan:/home/jenkins/.conan'
// Singularity1 has on old kernel (3.10) which is not compatible with Qt > 5.10 (req. 3.15)
label 'docker && !singularity1'
args '-v /home/jenkins/cache/ccache:/opt/ccache -v /home/jenkins/cache/conan/.conan:/opt/conan/.conan'
additionalBuildArgs '--pull'
}
}
......@@ -191,7 +192,7 @@ pipeline {
filename 'Dockerfile.gcc.full'
dir 'scripts/docker'
label 'docker'
args '-v /home/jenkins/cache:/home/jenkins/cache -v /home/jenkins/cache/conan/.conan:/home/jenkins/.conan'
args '-v /home/jenkins/cache/ccache:/opt/ccache -v /home/jenkins/cache/conan/.conan:/opt/conan/.conan'
additionalBuildArgs '--pull'
}
}
......@@ -411,7 +412,7 @@ pipeline {
filename 'Dockerfile.gcc.full'
dir 'scripts/docker'
label 'envinf11w'
args '-v /home/jenkins/cache:/home/jenkins/cache'
args '-v /home/jenkins/cache/ccache:/opt/ccache -v /home/jenkins/cache/conan/.conan:/opt/conan/.conan'
additionalBuildArgs '--pull'
}
}
......@@ -442,9 +443,11 @@ pipeline {
script {
dir('scripts/docker') {
def gccImage = docker.build("ogs6/gcc:latest", "-f Dockerfile.gcc.full .")
def gccGuiImage = docker.build("ogs6/gcc:gui", "-f Dockerfile.gcc.gui .")
def clangImage = docker.build("ogs6/clang:latest", "-f Dockerfile.clang.full .")
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
gccImage.push()
gccGuiImage.push()
clangImage.push()
}
}
......
......@@ -48,7 +48,7 @@ namespace PorousMedium
* Fully coupled generalized hybrid-mixed finite element approximation of
* two-phase two-component flow in porous media.
* Part I: formulation and properties of the mathematical model. Comput Geosci
* 2013;17(2):431C42.
* 2013;17(2):431-442.
*/
class VanGenuchtenCapillaryPressureSaturation final
: public CapillaryPressureSaturation
......
Subproject commit 72d804cfbcf82a1e171200c9c02748fa4b7ea033
Subproject commit 9d5f5fa551826cf071b898dce9b8b2f27df0bcd5
......@@ -22,7 +22,7 @@ else()
message(STATUS "No lcov coverage report generated because lcov or genhtml was not found.")
endif()
if(PYTHON_EXECUTABLE)
if(Python_EXECUTABLE)
setup_target_for_coverage_gcovr_xml(
NAME testrunner_coverage_cobertura
EXECUTABLE ${CMAKE_COMMAND} --build . --target tests
......@@ -34,3 +34,7 @@ if(PYTHON_EXECUTABLE)
else()
message(STATUS "No cobertura coverage report generated because Python executable was not found.")
endif()
if(UNIX)
add_custom_target(clean_coverage find . -name '*.gcda' -delete)
endif()
......@@ -9,7 +9,7 @@ find_program(GPROF_PATH gprof DOC "GNU profiler gprof" QUIET)
find_program(CPPCHECK_TOOL_PATH cppcheck)
find_package(PythonInterp QUIET)
find_package(Python COMPONENTS Interpreter Development)
# Find bash itself ...
find_program(BASH_TOOL_PATH bash
......
FROM ubuntu:17.10
RUN apt-get update && apt-get install -y curl \
&& curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \
&& apt-get update && apt-get -y install \
ccache \
g++-6 \
git git-lfs \
python3-pip \
sudo \
unzip
# Generated with https://github.com/ufz/ogs-container-maker/commit/c3dc13e
ENV CC=gcc-6
ENV CXX=g++-6
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
tar \
curl && \
rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --upgrade pip \
&& python3 -m pip install cmake conan>=1.10.0
# GNU compiler
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common && \
apt-add-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gcc-6 \
g++-6 \
gfortran-6 && \
rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/gcc gcc $(which gcc-6) 30 && \
update-alternatives --install /usr/bin/g++ g++ $(which g++-6) 30 && \
update-alternatives --install /usr/bin/gfortran gfortran $(which gfortran-6) 30 && \
update-alternatives --install /usr/bin/gcov gcov $(which gcov-6) 30
# Ninja
RUN curl -L -o ninja-linux.zip https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip \
&& unzip ninja-linux.zip \
&& mv ninja /usr/local/bin/ninja \
&& rm ninja-linux.zip
# OGS base building block
# Python
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 \
libpython3-dev && \
rm -rf /var/lib/apt/lists/*
# pip
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-pip \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip
# CMake version 3.13.4
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://cmake.org/files/v3.13/cmake-3.13.4-Linux-x86_64.sh && \
/bin/sh /var/tmp/cmake-3.13.4-Linux-x86_64.sh --prefix=/usr/local --skip-license && \
rm -rf /var/tmp/cmake-3.13.4-Linux-x86_64.sh
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common && \
apt-add-repository ppa:git-core/ppa -y && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
git-lfs \
make \
ninja-build && \
rm -rf /var/lib/apt/lists/*
RUN git lfs install && \
mkdir -p /apps /scratch /lustre /work /projects
# Add user jenkins to the image
RUN adduser --uid 500 --disabled-password --gecos "" jenkins \
# Add user jenkins to sudoers with NOPASSWD
&& echo "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
# Set password for the jenkins user (you may want to alter this).
&& echo "jenkins:jenkins" | chpasswd
# Package manager Conan building block
# pip
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-pip \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install conan==1.12.2
RUN mkdir -p /opt/conan && \
chmod 777 /opt/conan
ENV CONAN_USER_HOME=/opt/conan
LABEL org.opengeosys.pm=conan \
org.opengeosys.pm.conan.user_home=/opt/conan \
org.opengeosys.pm.conan.version=1.12.2
USER jenkins
ENV CCACHE_DIR=/home/jenkins/cache/ccache
RUN mkdir -p $CCACHE_DIR
ENV CCACHE_MAXSIZE=15G
ENV CCACHE_SLOPPINESS=pch_defines,time_macros
WORKDIR /home/jenkins
RUN conan user
# CVode version 2.8.2
### END gcc.minimal ###
USER root
RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://github.com/ufz/cvode/archive/2.8.2.tar.gz && \
mkdir -p /var/tmp && tar -x -f /var/tmp/2.8.2.tar.gz -C /var/tmp -z && \
mkdir -p /var/tmp/build && cd /var/tmp/build && cmake -DCMAKE_INSTALL_PREFIX=/usr/local/cvode -DEXAMPLES_INSTALL=OFF -DBUILD_SHARED_LIBS=OFF /var/tmp/cvode-2.8.2 && \
cmake --build /var/tmp/build --target install -- -j$(nproc) && \
rm -rf /var/tmp/2.8.2.tar.gz /var/tmp/build /var/tmp/cvode-2.8.2
ENV CVODE_ROOT=/usr/local/cvode
RUN apt-get update && apt-get install -y \
biber \
clang-tidy \
doxygen \
graphviz \
libxml2-utils \
python-dev
# cppcheck version 1.83
# Include-what-you-use
RUN curl https://include-what-you-use.org/downloads/include-what-you-use-0.8-x86_64-linux-gnu-ubuntu-16.04.tar.gz -O \
&& tar xf include-what-you-use-0.8-x86_64-linux-gnu-ubuntu-16.04.tar.gz -C /usr/ --strip-components=1 \
&& rm include-what-you-use-0.8-x86_64-linux-gnu-ubuntu-16.04.tar.gz
RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://github.com/danmar/cppcheck/archive/1.83.tar.gz && \
mkdir -p /var/tmp && tar -x -f /var/tmp/1.83.tar.gz -C /var/tmp -z && \
mkdir -p /var/tmp/build && cd /var/tmp/build && cmake -DCMAKE_INSTALL_PREFIX=/usr/local/cppcheck -DCMAKE_BUILD_TYPE=RELEASE /var/tmp/cppcheck-1.83 && \
cmake --build /var/tmp/build --target install -- -j$(nproc) && \
rm -rf /var/tmp/1.83.tar.gz /var/tmp/build /var/tmp/cppcheck-1.83
ENV PATH=/usr/local/cppcheck/bin:$PATH
# cppcheck
RUN curl -L -o 1.86.tar.gz https://github.com/danmar/cppcheck/archive/1.86.tar.gz \
&& tar xf 1.86.tar.gz \
&& cd cppcheck-1.86 \
&& make SRCDIR=build CFGDIR=/usr/share/cppcheck/ CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" \
&& make install CFGDIR=/usr/share/cppcheck/ \
&& cd .. && rm -r cppcheck-1.86 1.86.tar.gz
# Package manager Conan building block
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ccache && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/cache && chmod 777 /opt/cache
ENV CCACHE_DIR=/opt/cache \
CCACHE_MAXSIZE=15G \
CCACHE_SLOPPINESS=pch_defines,time_macros
LABEL ccache.dir=/opt/cache \
ccache.size=15G
RUN apt-get install -y mesa-common-dev libgl1-mesa-dev libxt-dev wget
# pip
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-pip \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install gcovr
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
doxygen \
graphviz \
texlive-base \
sudo && \
rm -rf /var/lib/apt/lists/*
# Jenkins node
RUN groupadd --gid 1001 jenkins && \
adduser --uid 500 --gid 1001 --disabled-password --gecos "" jenkins && \
echo "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
echo "jenkins:jenkins" | chpasswd
USER jenkins
WORKDIR /home/jenkins
FROM ubuntu:17.10
# Generated with https://github.com/ufz/ogs-container-maker/commit/c3dc13e
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
tar \
curl && \
rm -rf /var/lib/apt/lists/*
# GNU compiler
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common && \
apt-add-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gcc-6 \
g++-6 \
gfortran-6 && \
rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/gcc gcc $(which gcc-6) 30 && \
update-alternatives --install /usr/bin/g++ g++ $(which g++-6) 30 && \
update-alternatives --install /usr/bin/gfortran gfortran $(which gfortran-6) 30 && \
update-alternatives --install /usr/bin/gcov gcov $(which gcov-6) 30
# OGS base building block
# Python
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 \
libpython3-dev && \
rm -rf /var/lib/apt/lists/*
# pip
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-pip \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip
# CMake version 3.13.4
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://cmake.org/files/v3.13/cmake-3.13.4-Linux-x86_64.sh && \
/bin/sh /var/tmp/cmake-3.13.4-Linux-x86_64.sh --prefix=/usr/local --skip-license && \
rm -rf /var/tmp/cmake-3.13.4-Linux-x86_64.sh
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common && \
apt-add-repository ppa:git-core/ppa -y && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
git-lfs \
make \
ninja-build && \
rm -rf /var/lib/apt/lists/*
RUN git lfs install && \
mkdir -p /apps /scratch /lustre /work /projects
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
mesa-common-dev \
libgl1-mesa-dev \
libxt-dev && \
rm -rf /var/lib/apt/lists/*
# Package manager Conan building block
# pip
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-pip \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install conan==1.12.2
RUN mkdir -p /opt/conan && \
chmod 777 /opt/conan
ENV CONAN_USER_HOME=/opt/conan
LABEL org.opengeosys.pm=conan \
org.opengeosys.pm.conan.user_home=/opt/conan \
org.opengeosys.pm.conan.version=1.12.2
# Package manager Conan building block
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ccache && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/cache && chmod 777 /opt/cache
ENV CCACHE_DIR=/opt/cache \
CCACHE_MAXSIZE=15G \
CCACHE_SLOPPINESS=pch_defines,time_macros
LABEL ccache.dir=/opt/cache \
ccache.size=15G
# pip
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-pip \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install gcovr
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
doxygen \
graphviz \
texlive-base \
sudo && \
rm -rf /var/lib/apt/lists/*
# Jenkins node
RUN groupadd --gid 1001 jenkins && \
adduser --uid 500 --gid 1001 --disabled-password --gecos "" jenkins && \
echo "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
echo "jenkins:jenkins" | chpasswd
USER jenkins
WORKDIR /home/jenkins
This diff is collapsed.
......@@ -72,6 +72,7 @@ pre {
@apply .-ml-2;
@apply .pl-2;
@apply .border-l-8;
@apply .rounded
}
pre > code {
@apply .bg-transparent;
......@@ -96,6 +97,23 @@ p, ul, pre {
color: config('mycolors.text-accent');
}
blockquote {
@apply .bg-grey-lighter;
@apply .rounded;
@apply .border-l-8;
@apply .italic;
@apply .p-2;
@apply .mb-2;
}
blockquote > p:last-child {
@apply .mb-0;
}
cite::before {
content: "— ";
}
/* -- Navigation -- */
.nav-item {
@apply .mr-4;
......
......@@ -11,19 +11,20 @@ weight = 1034
## Introduction
> [Docker](https://www.docker.com/whatisdocker) containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.
> Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.
>
> <cite>[www.docker.com/whatisdocker](https://www.docker.com/whatisdocker)</cite>
See the [docs](https://docs.docker.com) for installation instructions.
## Images
Docker images can be created by [Dockerfiles](https://docs.docker.com/reference/builder/) which can be stacked and thus form a directed graph. OGS-6 image definitions can be found at the [ufz/dockerfiles](https://github.com/ufz/dockerfiles)-repo. Built images can be found at [Docker Hub](https://hub.docker.com/u/ogs6/).
Docker images can be created by [Dockerfiles](https://docs.docker.com/reference/builder/) which can be stacked and thus form a directed graph. OGS-6 image definitions are created with [ufz/ogs-container-maker](https://github.com/ufz/ogs-container-maker). Built images can be found at [Docker Hub](https://hub.docker.com/u/ogs6/).
To build an image by yourself create a Dockerfile:
```
FROM ubuntu:14.04
MAINTAINER Jon Doe <jon.doe@foo.com>
FROM ubuntu:17.10
RUN ...
```
......@@ -31,9 +32,10 @@ RUN ...
Run the `build` command:
```bash
$ docker build -t repo/image_name path/to/directory
$ docker build --rm -t repo/image_name path/to/directory
```
- `--rm` Cleans up after exiting the container
- `-t` specifies a name for the image, can be arbitrary chosen (but should match the corresponding image on Docker Hub if there is one)
- The path should specify the directory where the Dockerfile is located
......@@ -44,37 +46,38 @@ Now you can see your build image with `$ docker images`.
To run commands inside a container:
```bash
$ docker run -t image_name command_to_run
$ docker run --rm -t image_name command_to_run
```
To run an interactive shell add the `-i`-switch:
```bash
$ docker run -i -t image_name /bin/bash
$ docker run --rm -i -t image_name
```
It is useful to mount folders from the host operating system in the Docker container, e.g. to edit source code on your host with your favorite editor:
```bash
$ docker run -i -t -v /host/directory:/container/directory image_name /bin/bash
$ docker run --rm -i -t -v /host/directory:/container/directory image_name
```
## Prebuilt OGS-6 Docker images
There are docker images provided on [Docker Hub](https://hub.docker.com/u/ogs6/) which include everything necessary to build OGS-6.
There are images for `gcc`, `clang` and `mingw`.
There are images for `gcc` and `clang`.
E.g. to start developing OGS:
```bash
docker pull ogs6/gcc
docker run -t -i -v /path/to/ogs/source/on/host:/usr/src/ogs ogs6/gcc
docker run --rm -t -i -v /path/to/ogs/source/on/host:/tmp/ogs ogs6/gcc
```
You are now in the Docker container the ogs source code from your host computer mounted at `/usr/src/ogs`. Now you can build and run OGS:
```bash
cd /tmp
mkdir build; cd build
cmake ../ogs
make ogs
......@@ -86,4 +89,5 @@ make ogs
The following images are used by Jenkins:
- `ogs6/gcc`, defined in [scripts/docker/Dockerfile.gcc.full](https://github.com/ufz/ogs/blob/master/scripts/docker/Dockerfile.gcc.full)
- `ogs6/gcc:gui`, defined in [scripts/docker/Dockerfile.gcc.gui](https://github.com/ufz/ogs/blob/master/scripts/docker/Dockerfile.gcc.gui)
- `ogs6/clang`, defined in [scripts/docker/Dockerfile.clang.full](https://github.com/ufz/ogs/blob/master/scripts/docker/Dockerfile.clang.full)
+++
date = "2018-09-21T11:00:13+01:00"
title = "Singularity"
author = "Lars Bilke"
weight = 1034
[menu]
[menu.devguide]
parent = "advanced"
+++
## Introduction
[Singularity](https://www.sylabs.io) is a Linux container runtime similar to Docker. Key advantages over Docker are
- Container don't run with root privileges
- You are the same user with the same privileges inside the container as on the host
- Container can run on HPC systems and seamlessly integrate with resource managers and MPI
- Container can leverage NVidia GPUs
Singularity per default mounts your home directory and also passes your current working directory when starting a container. Therefore it is easy to use it for development.
### Prerequisites
- Linux only!
- [Install Git with LFS]({{< ref "prerequisites" >}}/#step-install-git)
- [Install Singularity](https://www.sylabs.io/guides/2.6/user-guide/quick_start.html#quick-installation-steps)
### Build OGS inside a container
```bash
[git clone ogs]
singularity pull docker://ogs6/gcc # Downloads the image to gcc.simg
singularity shell gcc.simg
[Now inside the container]
mkdir build; cd build
cmake ../ogs -DCMAKE_BUILD_TYPE=Release
make
./bin/ogs
```
### Run OGS inside a Container (called from outside)
Once ogs executable is built it can be called from **outside** the container:
```bash
singularity exec gcc.simg build/bin/ogs some/path/project.prj
```
This starts the container, mounts your home directory inside the container, passes the current working directory and runs the ogs executable (which is in your home directory which is mounted inside the container) with the passed project file. Everything works as expected and is transparent to the user. When ogs finishes the container stops and you returns to the host system.
## Container generator
You can download a prebuilt container from Docker Hub as shown above (e.g. `singularity pull docker://ogs6/gcc`). But we also provide a [container generator]({{< ref "container.pandoc" >}}) to create a specific container for your needs.
......@@ -20,7 +20,8 @@ The following explanation is taken from an [in-depth article](https://www.atlass
> The main advantage of the Forking Workflow is that contributions can be integrated without the need for everybody to push to a single central repository. Developers push to their own server-side repositories, and only the project maintainer can push to the official repository. This allows the maintainer to accept commits from any developer without giving them write access to the official codebase.
>
> The result is a distributed workflow that provides a flexible way for large, organic teams (including untrusted third-parties) to collaborate securely. This also makes it an ideal workflow for open source projects.
> <cite> https://www.atlassian.com/git/tutorials/comparing-workflows#!workflow-forking </cite>
>
> <cite><a href="https://www.atlassian.com/git/tutorials/comparing-workflows#!workflow-forking">www.atlassian.com/git/tutorials/comparing-workflows#!workflow-forking</a> </cite>
>
The workflow is summarized in the following image from the [GitHub blog](https://github.com/blog/2042-git-2-5-including-multiple-worktrees-and-triangular-workflows):
......
+++
date = "2018-11-14T15:00:13+01`:00"
title = "Running OGS in a container"
author = "Lars Bilke"
weight = 10
[menu]
[menu.userguide]
parent = "basics"
+++
## With Singularity
### Prerequisites
* Linux (you may run Singularity with [Vagrant](https://app.vagrantup.com/sylabs) on macOS or Windows as well)
* A running [installation](https://www.sylabs.io/guides/2.6/user-guide/quick_start.html#quick-installation-steps) of Singularity 2.6
### Get a container image
TODO: Download prebuilt images
Build images with [ogs-container-maker](https://github.com/ufz/ogs-container-maker) on [Jenkins](https://jenkins.opengeosys.org/job/ufz/job/ogs-container-maker/job/master/build) (login required, ask Lars Bilke for access):
![](../ogs-container-maker-params.png){width=450px}
It will build all combinations of `format`, `openmpi_versions` and `pm`. When the build finishes you can download the container (`*.simg` files) at the jobs page under `Build Artifacts`.
### Run OGS inside a Container (called from outside)
```bash
singularity exec ogs-openmpi-2.1.1-conan.simg ogs some/path/project.prj
```
This starts the container, mounts your home directory inside the container, passes the current working directory and runs the ogs executable (which is in your home directory which is mounted inside the container) with the passed project file. Everything works as expected and is transparent to the user. When ogs finishes the container stops and you returns to the host system.
```bash
# Create output directories
mkdir -p _out _out_mpi
# Run serial benchmark
singularity exec ogs-openmpi-2.1.1-conan.simg ogs -o _out [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj
# Run serial benchmark with output validation (via vtkdiff)
singularity exec ogs-openmpi-2.1.1-conan.simg -o _out -r [ogs-sources]/Tests/Data/Mechanics/Linear [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj
# Run parallel benchmark with MPI
mpirun -np 4 singularity exec ogs-openmpi-2.1.1-conan.simg -o _out_mpi [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj
```
You can run other contained executables, e.g. `vtkdiff`:
```bash
singularity exec ogs-openmpi-2.1.1-conan.simg vtkdiff --help
```
You can interactively explore the container with `singularity shell` (you can see that you are **in** the container because of the `Singularity [container image file]:...>` prefix of the shell):
```bash
# Shell into container
singularity shell ogs-openmpi-2.1.1-conan.simg
# List files in the container
Singularity ogs-openmpi-2.1.1-conan.simg:...> ls /usr/local/ogs/bin
... ogs tetgen vtkdiff
# Exit the container and get back to your hosts shell
Singularity ogs-openmpi-2.1.1-conan.simg:...> exit
```
web/content/docs/userguide/basics/ogs-container-maker-params.png

130 B

......@@ -9,8 +9,8 @@
"dependencies": {
"autoprefixer": "^9.0.0",
"hugo-algolia": "^1.2.13",
"postcss-cli": "^5.0.1",
"postcss-import": "^11.1.0",
"tailwindcss": "^0.6.4"
"postcss-cli": "^6.1.1",
"postcss-import": "^12.0.1",
"tailwindcss": "^0.7.4"
}
}
No preview for this file type
{"Target":"main.min.93b4253c1a53bde830275549bec6a3159fd4fdff10a82a4c3d035f26915f058f.css","MediaType":"text/css","Data":{"Integrity":"sha256-k7QlPBpTvegwJ1VJvsajFZ/U/f8QqCpMPQNfJpFfBY8="}}
\ No newline at end of file
{"Target":"main.min.2ae350b937be7c2840ce93fd86eff932de7f1c643a0dd9f1be580575e9b4a61c.css","MediaType":"text/css","Data":{"Integrity":"sha256-KuNQuTe+fChAzpP9hu/5Mt5/HGQ6DdnxvlgFdem0phw="}}
\ No newline at end of file
No preview for this file type
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment