Using Singularity on SeaWulf

To read more about Singularity : https://sylabs.io/guides/3.0/user-guide/

To read more about Docker : https://www.docker.com/why-docker

To get started with Anaconda : https://it.stonybrook.edu/help/kb/installed-software-on-seawulf

Audience: Faculty, Postdocs, Researchers, Staff and Students

This KB Article References: High Performance Computing
This Information is Intended for: Faculty, Postdocs, Researchers, Staff, Students
Last Updated: March 27, 2023
Average Rating: Not Rated
Your feedback is important to us, help us by logging in to rate this article and provide feedback.

'Singularity' is a containerization tool that facilitates virtualization of applications for HPC environments. This Knowledge Base (KB) article will help you run your own Singularity containers on SeaWulf. If you are unfamiliar with using Singularity in an HPC environment, please read on. Links to resources for further learning are provided at the end.


Note: Loading the Singularity 3 module is no longer necessary. All the system nodes now contain an installation of Singularity.

You can download a Singularity Image from a pre-built external resource as follows :

singularity pull shub://<singularity_hub_path_for_image> 

or 

singularity pull library://<singularity_library_path_for_image>

To run a Singularity Image, use the run command as follows : 

singularity run <image_name>.sif

To use a Singularity Image on a GPU node, to take advantage of the GPUs available use the --nv flag as follows :

singularity run --nv <image_name>.sif

This is recommended for running Containers with Deep Learning frameworks for Machine Learning/ Computer Vision/ NLP applications. Some popular examples are Tensorflow, PyTorch, Theano, Keras among others which can be accessed from the NVIDIA GPU Cloud repository. See https://ngc.nvidia.com 


To test that Singularity works you can try the following example :

First, download the image:

singularity pull library://sylabsed/examples/lolcow

Next, run the image:

singularity run lolcow_latest.sif

More Singularity containers can be found here:  https://cloud.sylabs.io/library


Note: Using the "singularity build" command to either build or download custom images from a public repositories is not currently enabled on SeaWulf:


To build your own custom Singularity container, you will need a local machine where you have administrator (root) privileges. We recommend using a Linux instance on VirtualBox (https://www.virtualbox.org) for your local machine, so that you can insulate your system from unwanted changes. We will refer to this as 'local machine' in the rest of this KB. 

To get an interactive shell as root user, type the following command at the $ prompt of your local machine.

sudo -i

Enter the root account password and if successful your $ prompt now becomes a # prompt to indicate you have root access.

Once you have root access to a local machine, install singularity on your local machine (https://singularity.lbl.gov/docs-installation).

For Ubuntu you can use the following command :

apt-get update && \
    sudo apt-get install \
    python \
    dh-autoreconf \
    build-essential \
    libarchive-dev

Choose a base image and build a writeable singularity container to ensure that changes made are persistent. (https://singularity.lbl.gov/docs-build-container)

singularity build --writable <image_name>.sif shub://<singularity_hub_path_for_image>

You can use version control software like git to clone an existing repository inside this container and install libraries you require. Please ensure you have set appropriate file permissions with the chmod command.

You can also use Singularity to pull Docker images from the repository and save it as a Singularity container as follows:

singularity pull --name <custom_name_for_image> docker://<image_path_on_docker_repository>

Once you have created the custom Singularity image, upload it to your Singularity repository for use.

Alternatively, copy it over to Seawulf using the sftp or scp utility.

scp <local_path>/<image_name>.sif <net_id>@login.seawulf.stonybrook.edu:<path_on_seawulf>/.

Recommended Reading :

For a quick guide to using Singularity : https://sylabs.io/guides/3.0/user-guide/quick_start.html


If you have issues / concerns / difficulties not addressed by the above article:

Submit a ticket

Additional Information


There are no additional resources available for this article.

Provide Feedback


Your feedback is important to us, help us by logging in to rate this article and provide feedback.

Sign in with NetID

Getting Help


The Division of Information Technology provides support on all of our services. If you require assistance please submit a support ticket through the IT Service Management system.

Submit A Quick Ticket

For More Information Contact


IACS Support System