By ULHPC Licence GitHub issues Github Documentation Status GitHub forks

UL HPC Tutorial: HPC Containers with Singularity

 Copyright (c) 2018- UL HPC Team <>

The objective of this tutorial is to practice using Singularity containers on the UL HPC iris cluster.

It's important that you read the slides first.

They review:

  1. setting up Singularity on your workstation
  2. common Singularity commands
  3. how to download existing Docker registry images
  4. how to create and customize containers locally
  5. how to run Singularity containers on the UL HPC platform

Practice using Singularity containers

Part 1 - using existing containers

  1. Connect to the Iris cluster, reserve a GPU node with 2 GPUs, load the Singularity module.
  2. Download using Singularity the official Docker image of Tensorflow (GPU version)
  3. Download the Git repository of Tensorflow models and examples
  4. Run the LeNet-5-like convolutional MNIST model example tutorials/image/mnist/ with Singularity
  5. note the usage of the --nv flag to enable support for Nvidia GPUs
    (access-iris)$> srun -p gpu -N 1 -n 1 -c 14 --gres=gpu:2 -t 1:0:0 --pty bash -i
    (node)$> mkdir singularity-tests
    (node)$> git clone
    (node)$> module load swenv/default-env/devel
    (node)$> module load tools/Singularity 
    (node)$> singularity pull docker://tensorflow/tensorflow:latest-gpu-py3-jupyter
    (node)$> singularity exec --nv tensorflow_latest-gpu-py3-jupyter.sif python models/tutorials/image/mnist/

Part 2 - building a container

  1. Set up Singularity on your workstation or laptop
  2. Create a definition file to create a CentOS 7 container
  3. Customize the definition file to install Python, NumPy, SciPy and Seaborn
  4. Build the container as production SIF image
  5. Transfer the image to the Iris cluster
  6. Use the container's embedded python and libraries to run a Seaborn plot example

Part 3 - MPI parallel execution with containers

  1. On your workstation or laptop set up a new definition file for a CentOS 7 container
  2. Build the container as a sandbox directory
  3. Install OpenMPI 3.1.3 within the sandbox
  4. Install the OSU Microbenchmarks in the sandbox, see instructions within the dedicated UL HPC tutorial
  5. Build the sandbox into a production SIF image
  6. Transfer the image to the Iris cluster
  7. Run the mpi/one-sided/osu_get_bw benchmark within the container on 2 MPI processes in parallel

Part 4 - use your own

Extra challenge - embed your own code / software in a container and use it on the UL HPC platform :-)