How to use docker / singularity on the HPC cluster


module load singularity/singularity

Create a singularity image <project_name>

Test a singularity image (run on your PC or hpc-login)

singularity run <project_name>.sif

Submit a singularity image (run on cluster nodes)

This is a simple sbatch script example:


#SBATCH -n 8 # Request 8 cores

module load singularity/singularity
singularity run <project_name>.sif

Submit the sbatch script:

sbatch my_script

Singularity with intel18

Create image <project_name>
singularity run --bind /opt/intel/compilers_and_libraries_2018.1.163:/opt/intel/compilers_and_libraries_2018.1.163 <project_name>.sif

Singularity with GPU

Create image <project_name>
singularity run --nv <project_name>.sif

Singularity with MPI

Create image <project_name>
singularity run --bind /usr/local/openmpi/openmpi-3.1.3-i18:/usr/local/openmpi/openmpi-3.1.3-i18 --bind /opt/intel/compilers_and_libraries_2018.1.163:/opt/intel/compilers_and_libraries_2018.1.163 <project_name>.sif

Transform a docker image to singularity (without MPI)

From the docker hub

From a docker image available on docker hub, create your <project_name>.def file with:

Bootstrap: docker
From: <my_image>:<my_tag>

From a docker local image

docker image save -o my_image.tar image_name:version
Bootstrap: docker
From:<my_image> <project_name>

Singularity help pages

Singularity official documentation