====== Singularity ====== * Article written by Markus Stöhr (VSC Team) ===== Containerization (historical, pre 1955) ===== {{.:hafenarbeiter_bei_der_verladung_von_sackgut_-_ms_rothenstein_ndl,_port_sudan_1960.png}} {{.: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/about-the-industry/history-of-containerization|http:%%//%%www.worldshipping.org]]) ===== HPC Situation ===== {{.:personal-container-mngmnt2.jpg}} (picture from [[http://www.bricoleurbanism.org/whimsicality/personal-container-management/|http:%%//%%www.bricoleurbanism.org]]) ===== Virtualization vs. Containerization ===== {{.:virtualization.png}} ===== Docker vs. Singularity ===== **Singularity:** * container runs in user namespace * no privilege escalation * can be used in a multi-user environment ===== Container concepts ===== {{.:containerconcepts.png}} * image: stored in a single file * build images with ‘recipes’ * work interactively within container ===== Recipes in Singularity ===== ^section ^ ^ |setup |executed before post | |post |install commands | |files |executed after post | |environment|add 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 ===== * Copy image to VSC-3 * Job script: #!/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 =====






http://singularity.lbl.gov