Singularity

Written for software version 2.5.2.

Singularity is a virtualization tool that allows users to containerize workflows, applications, and environments to allow for portability, customization, and reproducibility. Additionally, Singularity is integrated with the Message Passage Interface (MPI) to be used in High Performance Computing (HPC) systems as well as CADES OpenStack Virtual Machines (VMs). Lastly, you may also utilize Docker containers with Singularity!

Note: These instructions are adapted from the official Singularity documentation.

Getting Started with Singularity

CADES SHPC Condo

Singularity is already installed on CADES SHPC Condos.

To use it, login to condo and do:

module purge
module load PE-gnu
module load singularity

Singularity Containers over MPI-IB on Condo

By default, singularity does not use the InfiniBand libraries when doing message passing with MPI. In order to make sure Singularity uses the InfiniBand libraries while using MPI, perform the following step after loading the Singularity module:

source sourceme_for_mpioverib

Following the above step, the Singularity containers should use the InfiniBand libraries when running MPI applications.


CADES Cloud VMs

Prerequisites

bash
sudo apt-get update && \
sudo apt-get install \
python \
dh-autoreconf \
build-essential \
libarchive-dev
bash
sudo yum update && \
sudo yum groupinstall 'Development Tools' && \
sudo yum install \
libarchive-devel \
squashfs-tools

Install

The most up-to-date version is housed in a GitHub repository. The software is installed from the source. Use Git to clone the repository and run the following commands.

Clone the repository with the following command:

git clone https://github.com/singularityware/singularity.git

Once you have opened the singularityware folder from the repo, look for INSTALL.md. Follow the instructions in INSTALL.md to install Singularity.


Building a Container using an Existing Container

The following command executes the build command, specifies the path and name of the container (lolcow.simg), and provides the location of the container on the Singularity Hub (shub://GodloveD/lolcow).

singularity build lolcow.simg shub://GodloveD/lolcow

Interacting with Containers

There are three primary ways to interact with a Singularity container.

  1. Run: Creates an ephemeral container that runs a predefined script

    singularity run lolcow.simg or ./lolcow.simg

  2. Shell: Supplies a command line prompt to interface with the container

    singularity shell lolcow.simg

  3. Execute: Sends a command into the container and provides output

    singularity exec lolcow.simg


Congratulations! You have successfully deployed a Singularity container!

As some next steps, navigate to the official Singularity documentation to learn more about the Singularity Hub, Docker Hub and building a container from scratch.