Difference between revisions of "Containers for CyberShake"
Line 11: | Line 11: | ||
Image Prework: | Image Prework: | ||
Convert Sandbox Director to image file: | Convert Sandbox Director to image file: | ||
− | sudo singularity build new-sif.sif myUbuntu | + | <code>sudo singularity build new-sif.sif myUbuntu</code> |
imageName sandbox directory | imageName sandbox directory | ||
Line 39: | Line 39: | ||
Install Singularity | Install Singularity | ||
− | export VERSION=3.5.2 && # adjust this as necessary \ | + | <code>export VERSION=3.5.2 && # adjust this as necessary \ |
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \ | wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \ | ||
− | tar -xzf singularity-${VERSION}.tar.gz && \ | + | tar -xzf singularity-${VERSION}.tar.gz && \</code> |
cd singularity | cd singularity | ||
Check if Singularity Works | Check if Singularity Works | ||
− | git clone https://github.com/sylabs/singularity.git && \ | + | <code>git clone https://github.com/sylabs/singularity.git && \ |
cd singularity && \ | cd singularity && \ | ||
− | git checkout v3.5.2 | + | git checkout v3.5.2</code> |
Get Image | Get Image | ||
− | singularity pull <source> | + | singularity pull <source>* |
+ | <code>singularity pull library://default/ubuntu:latest</code> | ||
+ | *Sources include Singularity Container Library (library), Singularity Hub (shub) and Docker Hub (docker). | ||
Execute Command in from Outside Container | Execute Command in from Outside Container | ||
Singularity Commands | Singularity Commands | ||
− | singularity exec myPythonContainer.sif cat /etc/lsb-release | + | <code>singularity exec myPythonContainer.sif cat /etc/lsb-release</code> |
imageName command | imageName command | ||
− | singularity exec myPythonContainer.sif python3 helloWorld.py | + | singularity exec image_name command |
− | + | <code>singularity exec myPythonContainer.sif python3 helloWorld.py</code> | |
− | Find Size: | + | Find Size of Container: |
− | singularity cache list | + | <code>singularity cache list</code> |
== Basic Singularity Commands == | == Basic Singularity Commands == |
Revision as of 02:26, 7 August 2020
This page is to document the steps involved in enabling the CyberShake codebase to run in a container environment.
Contents
Selection of Containers
The available HPC Containers at the time of selection were Singularity, Charlie Cloud, and Shifter. Between the 3 of these container technologies, Singularity was widely adapted and had more open source tools. Because of this wide adaptation the module already existed in the Frontera system. Singularity has built-in support for different MPI libraries from OpenMPI, MPICH, IntelMPI to name a few. Shifter is highly reliant on MPICH ABI. This would require site-specific MPI libraries to be copied to the container at run time.
Setting up a serial container
(Explains the steps involved in building and running serial code in a container)
Image Prework:
Convert Sandbox Director to image file:
sudo singularity build new-sif.sif myUbuntu
imageName sandbox directory
User Work:
Install Dependencies
sudo apt-get update && sudo apt-get install -y \
build-essential \
uuid-dev \
libgpgme-dev \
squashfs-tools \
libseccomp-dev \
wget \
pkg-config \
git \
cryptsetup-bin
Download Go
export VERSION=1.13.5 OS=linux ARCH=amd64 && \
wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz && \
sudo tar -C /usr/local -xzvf go$VERSION.$OS-$ARCH.tar.gz && \
rm go$VERSION.$OS-$ARCH.tar.gz
Set Up Go
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \
source ~/.bashrc
Install Singularity
export VERSION=3.5.2 && # adjust this as necessary \
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \
tar -xzf singularity-${VERSION}.tar.gz && \
cd singularity
Check if Singularity Works
git clone https://github.com/sylabs/singularity.git && \
cd singularity && \
git checkout v3.5.2
Get Image
singularity pull <source>*
singularity pull library://default/ubuntu:latest
- Sources include Singularity Container Library (library), Singularity Hub (shub) and Docker Hub (docker).
Execute Command in from Outside Container
Singularity Commands
singularity exec myPythonContainer.sif cat /etc/lsb-release
imageName command
singularity exec image_name command
singularity exec myPythonContainer.sif python3 helloWorld.py
Find Size of Container:
singularity cache list
Basic Singularity Commands
Basic Singularity Commands Pull - pulls a container image from a remote source $ sudo singularity pull <remote source> <remote source> Singularity Container Services
$ sudo singularity pull --name CONTAINER_NAME.sif library://USER/PULL_PATH:VERSION
Singularity Hub $ sudo singularity pull --name CONTAINER_NAME.sif shub://USER/PULL_PATH:VERSION (Note: the path only needs to match the pull card. please see the remote website for example.) Docker Hub $ sudo singularity build CONTAINER_NAME.sif docker://USER/PULL_PATH:VERSION (Note docker images have layers and it needs to be merged into 1 singularity image. For that to happen you MUST use: build)
Exec - executes an EXTERNAL COMMAND $ singularity exec IMAGE_NAME.sif EXTERNAL_COMMAND
Shell - shells into an existing container singularity shell IMAGE_NAME.sif
- Note: Your home directory is mounted by default
Run - runs an image. Run is based on the Run Script parameters that were placed into the container when the image was built based the recipe $ singularity run IMAGE_NAME.sif
Build (BIG TO DO: Very important) $ singularity build IMAGE_NAME.sif <source> Sources include Another Image either docker or singularity Singularity definition file (use to be known as a recipe file), usually denoted with name.def
Note: You can shell into a docker UI - explore different containers without pulling or building $ singularity shell docker://ubuntu
Creating Definition Files: Workflow: Set up complex workflows with Recipe File: Alternatively- Sandbox Directory Prototype Final Container: sudo singularity build --sandbox ubuntu_s docker://ubuntu
Containers on Frontera
Serial Containers
Explain how you got serial containers running on Frontera.
MPI Containers
Explain how you got MPI containers running on Frontera.