Redirected from page "Singularity"

Clear message

Overview

Singularity or Apptainer allow instantiating an alternative operating system environment on our Linux systems.

In other words:

And all this without significant overhead. Sounds like fiction? It's fact. Right now. Some caveats do apply though.

Credit: Singularity was and is being developed at Berkeley Lab. Please see https://apptainer.org/docs-legacy for upstream information.

Apptainer is the new name of Singularity, developed under the umbrella of Linux Foundation. For documentation, see https://apptainer.org/docs .

News

Invocation

There are several ways to instantiate an Apptainer container and run software in it. The two most important ones are:

Availability

Apptainer containers can be instantiated on any current user accessible Linux system at DESY Zeuthen. In particular, Apptainer is available on all

The current set of standard images available in /project/apptainer/images includes

These short image names are symbolic links to the current versions of the standard images for these operating systems. The specific images are being kept around for a few months, but not forever.

Note users can copy a current image to any location to make sure this exact version will remain available.

Also note users can bring their own images and thus don't have to rely on the ones provided by DV. Creating those is rather simple and documented upstream. It currently requires root access though, so cannot be done on supported Linux systems in Zeuthen. But have a look at https://singularity-hub.org .

Since Release 2.3, it's also possible to import docker images without root privileges. Note that the environment variable APPTAINER_CACHEDIR is used to place downloaded image layers, and it defaults to ~/.apptainer. Change the variable to something more sensible to avoid wasting a lot of home space.

Batch system support

In case you want to run your batch jobs directly under the standard images available in /project/apptainer/images, it is possible with these lines in the HTCondor submit file

universe=container
container_image=/project/apptainer/images/<os>.sif

whereas <os> defines the image to be used.

Filesystems shared between Host and Container

Subject to availability on the host:

Users can specify additional folders on the host to be bind mounted inside the container when the container is started. This shouldn't be required. But if it is, please see apptainer help run for info how to do it - and let DV know why you need to do this.

Docker image support

It is recommended to create an image file from docker before running it, for instance:

export APPTAINER_CACHEDIR=/tmp/$(USER)/apptainer-cache
apptainer build /tmp/gpt.sif docker://gptdev/notebook
apptainer run /tmp/gpt.sif

CUDA support

To run CUDA code in apptainer, the CUDA libraries must be available both inside and outside the container. Apptainer can automatically bind the needed directories into the container like this:

apptainer exec --nv -B /etc/OpenCL/vendors yourprogram

Caveats

Apptainer (last edited 2024-04-02 08:45:54 by GötzWaschk)