Singularity

Important note

This page describes how to build OGS with the help of a Linux container (for developers). To run OGS with the help of a container go to the user guide (for developers).

Introduction

Singularity 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

  • Install Git
  • Linux only!
    • Note: You can run Singularity on Windows inside a lightweight virtual machine using WSL 2 or with Vagrant.

Install Singularity

  • CentOS 6/7 / RedHat: Install via EPEL.

  • Ubuntu 20.04 / Debian Sid:

    wget http://ftp.us.debian.org/debian/pool/main/s/singularity-container/singularity-container_3.9.6+ds1-1_amd64.deb
    sudo apt install containernetworking-plugins squashfs-tools
    sudo dpkg -i singularity-container_3.9.6+ds1-1_amd64.deb
    • OR install Homebrew package singularity.
  • If you do not have one of the above OS versions install Singularity from source.

Build OGS inside a container

[git clone ogs]
singularity pull docker://registry.opengeosys.org/ogs/ogs/gcc # Downloads the image to gcc_latest.sif
# OR: Pull the image docker://registry.opengeosys.org/ogs/ogs/gcc-gui image for compiling the Data Explorer
singularity shell gcc_latest.sif
[Now inside the container]
mkdir build; cd build
cmake ../ogs -DCMAKE_BUILD_TYPE=Release -DOGS_DISABLE_COMPILER_CACHE=ON # OR set env var CCACHE_DIR
ninja
./bin/ogs

Run OGS inside a Container (called from outside)

Once OGS executable is built it can be called from outside the container:

singularity exec gcc_latest.sif 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 to create a specific container for your needs.


This article was written by Lars Bilke. If you are missing something or you find an error please let us know.
Generated with Hugo 0.122.0 in CI job 482627 | Last revision: July 5, 2024
Commit: [T] Are times equivalent for tiny time increments 4bf1ab6  | Edit this page on