Table of Contents

Singularity

Containerization (historical, pre 1955)

stevedores_ny_1912.jpg

(pictures from Wikipedia)

Containerization (historical, post 1955)

container_ship_loading-700px.jpg

(picture from Wikimedia, see also http:%%//%%www.worldshipping.org)

HPC Situation

personal-container-mngmnt2.jpg

(picture from http:%%//%%www.bricoleurbanism.org)

Virtualization vs. Containerization

Docker vs. Singularity

Singularity:

Container concepts

Recipes in Singularity

section
setup executed before post
post install commands
files executed after post
environmentadd variables for runtime
runscript commands when container is executed
labels metadata
test
apps

OpenMPI example

Filename: OpenMPI-3.0.0

BootStrap: docker
From: centos:7.4.1708

%setup
     cp openmpi-3.0.0.tar.bz2 \
        ${SINGULARITY_ROOTFS}/usr/local/src/openmpi-3.0.0.tar.bz2
%post
    yum install -y gcc gcc-c++ gcc-gfortran 
    yum install -y wget tar make bzip2 gzip perl rsync zip
    yum install -y infinipath-psm-devel infinipath-psm 
    yum install -y libibverbs-devel libibverbs

    cd /usr/local/src 
    tar -xjf openmpi-3.0.0.tar.bz2
    cd openmpi-3.0.0  

    ./configure --prefix=/usr/local --with-hwloc --with-psm --with-verbs
    make -j 16
    make install
    ldconfig

Container build

on your local system as root user:

#singularity must be present
module load singularity/2.4.2

singularity build OpenMPI-3.0.0.img OpenMPI-3.0.0

Derive from existing container

Filename: MPI-Hello

BootStrap: localimage
From: .../OpenMPI-3.0.0.img

%post
    yum install -y git
    mkdir /usr/local/src/git 
    cd /usr/local/src/git  

    git clone https://github.com/wesleykendall/mpitutorial 
    cd mpitutorial/tutorials/mpi-hello-world/code 
    make 
    cp mpi_hello_world /usr/local/bin 

%runscript
    /usr/local/bin/mpi_hello_world $@

singularity build MPI-Hello.img MPI-Hello

Run Container

#!/bin/bash
#SBATCH -J singularity
#SBATCH -N 2


module purge
module load intel/18 openmpi/3.0.0 singularity/2.4.2

mpirun -np 32 ./MPI-Hello.img

MPI call stack

Performance

scaling_vasp.eps.jpg

Further reading

<html><br></html> <html><br></html> <html><br></html> <html><br></html> <html><br></html> <html><br></html> <html><br></html> http://singularity.lbl.gov