Singularity/Apptainer
Singularity/Apptainer
Section titled “Singularity/Apptainer”We support Apptainer/Singularity containers as an alternative way to bring your scientific application to UBELIX instead of installing it using EasyBuild.
If you are familiar with Docker containers, Apptainer containers are essentially the same thing, but are better suited for multi-user HPC systems such as UBELIX. The main benefit of using a container is that it provides an isolated software environment for each application, which makes it easier to install and manage complex applications.
This page provides guidance on preparing your Apptainer containers for use with UBELIX. Please consult the container jobs page for guidance on running your container on UBELIX.
Pulling container images from a registry
Section titled “Pulling container images from a registry”Apptainer allows pulling existing container images (Apptainer or Docker)
from container registries such as DockerHub.
Pulling container images from registries can be done on
UBELIX. For instance, the Ubuntu image ubuntu:22.04 can be pulled from
DockerHub with the following command:
$ apptainer pull docker://ubuntu:22.04This will create the Apptainer image file ubuntu_22.04.sif in the directory
where the command was run. Once the image has been pulled, the container can be
run. Instructions for running the container may be found on the container jobs
page.
Building Apptainer/Singularity SIF containers
Section titled “Building Apptainer/Singularity SIF containers”As an example, consider building a container that is compatible with the MPI stack on UBELIX.
The following Singularity definition file
mpi_osu.def, installs OpenMPI-4.1.5, which is compatible with the
Cray-MPICH found on UBELIX. That OpenMPI will be used to compile the OSU
micro-benchmarks. Finally, the OSU point to point bandwidth test
is set as the “runscript” of the image.
bootstrap: dockerfrom: ubuntu:22.04
%post # Install software apt-get update apt-get install -y file g++ gcc gfortran make gdb strace wget ca-certificates --no-install-recommends
# Install OpenMPI wget -q https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz tar xf openmpi-4.1.5.tar.gz cd openmpi-4.1.5 ./configure --prefix=/usr/local make -j make install ldconfig
# Build osu benchmarks wget -q http://mvapich.cse.ohio-state.edu/download/mvapich/osu-micro-benchmarks-5.3.2.tar.gz tar xf osu-micro-benchmarks-5.3.2.tar.gz cd osu-micro-benchmarks-5.3.2 ./configure --prefix=/usr/local CC=$(which mpicc) CFLAGS=-O3 make make install cd .. rm -rf osu-micro-benchmarks-5.3.2 rm osu-micro-benchmarks-5.3.2.tar.gz
%runscript /usr/local/libexec/osu-micro-benchmarks/mpi/pt2pt/osu_bwThe image can be built with
$ apptainer build mpi_osu.sif mpi_osu.defSee the container jobs MPI documentation
page
for instructions on running this mpi_osu.sif MPI container on UBELIX.