Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

Containers available from other repositories or webpages must be  first downloaded on O2 and then submitted with the --image-path flag.

Note: The testing process can take from several minutes to a few hours, depending on the type of container tested.

...

When installing a pre-built container directly from a repository the easiest approach is to create a Singularity definition file and bootstrap the Singularity container from the desired Docker container.

For example, if you want needed to install the Docker container nvcr.io/nvidia/tensorflow:21.09-tf1-py3 ubuntu:latest you can create a Singularity definition file (my_container.def in this example) containing the following lines:

Code Block
Bootstrap: docker
From:  nvcr.io/nvidia/tensorflow:21.09-tf1-py3ubuntu:latest

%setup

%files

%post

apt update -y
apt-get upgrade -y

%environment

%runscript

...

this will build the singularity container starting from the desired Docker container but will also update all system libraries from the original container. You can use the above template to install your desired Docker container.

How to run Singularity containers in O2

...

Code Block
#!/bin/bash
#SBATCH -p short 
#SBATCH -t 2:00:00
#SBATCH -c 1 
#SBATCH --mem=4G


singularity exec /n/app/singularity/containers/$USER/your_container.sif tool_to_run



Note 1:

By default only /tmp and /home/$USER are available inside the singularity container. 

...

Access permissions for those filesystem is preserved inside the container.

Note 2:

By default not all env variables might be ported inside the singularity container. If a variable defined outside Singularity needs to be ported inside the container and it is not available by default, it can be pre-set  outside the container with the prefix SINGULARITYENV_.  For example the variable FOO can be ported inside the singularity container by presetting it as SINGULARITYENV_FOO

Code Block
compute-a-16-21:~ FOO="something"
compute-a-16-21:~ export SINGULARITYENV_FOO=$FOO 


Note 3:

If you plan to use one or more GPU cards inside the container you need to submit the O2 job to a partition that supports GPU computing and add the flag --nv to your singularity command, for example:

...