Singularity¶
Singularity is an optional tool on our cluster that lets you run software inside portable containers without needing root access.
Each container runs under your own account, sees your usual home and scratch directories, and works smoothly with the scheduler.
Use it when you need software versions that aren’t already provided as modules.
Note
In our cluster Singularity is always accessible without need to load it using Lmod.
Running Image¶
This example downloads and run the image from public library.
Searching In Public Library¶
This example allows you to search in public library for existing images.
Building Image¶
First create singularity container definition my_container.def file using standard editor nano or vim.
Example content of my_container.def file:
Bootstrap: docker
From: ubuntu:20.04
%post
apt-get update && apt-get install -y python3 python3-pip
pip3 install numpy
%runscript
echo "This container has Python and NumPy installed!"
python3
Now you can build the container:
After successfull build you can run the container:
Example output:
This container has Python and NumPy installed!
Python 3.8.10 (default, May 3 2021, 08:55:58)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Example¶
This PBS Pro job script submits a job to a high-performance computing (HPC) cluster to run a Python script (my_script.py) inside a Singularity container (my_container.sif).