# Singularity

## 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.

### Build OGS inside a container

[git clone ogs]
# OR: Pull the docker://ogs6/gcc:gui image for compiling the Data Explorer
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:

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

Previous

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.54.0. Last revision: July 12, 2019