% Container 101 on Lawrencium % June 10, 2020 % Wei Feinstein
- Lawrencium Supercluster overview
- Lawrencium resources & services
- Container technology overview
- How to build singularity containers
- How to run singularity containers on Lawrencium
- Lawrencium is a LBNL Condo Cluster Computing resources
- Significant investment from LBNL
- Individual PIs purchase nodes and storage
- Computational cycles are shared among all lawrencium users
- Share the same supercluster infrastructure:
- OTP authentication
- High speed infiniBand parallel file system for fast inter-node communication
- OS and security updates, software module farm, job scheduler SLURM
- Home/project storage, lustre parallel file system and backend network infrastructure.
- PI Computing Allowance (PCA) account: free 300K SUs per year (pc_xxx)
- Condo account:
- PIs purchase and contribute compute nodes to the general condo pool (lr_xxx)
- Run jobs within their condo contributions for free
- Recharge account: with minimal recharge rate ~ $0.01/SU (ac_xxx)
- $25 per user per month
- Refer to detailed information at here
- User account request
- User agreement consent
- Check here for details
- module purge: clear user’s work environment
- *module availablev: check available software packages
- module load xxx: load a package
- module list: check currently loaded software
- Users may install their own software
- More information
- sbatch: submit a job to the batch queue system
sbatch myjob.sh
- srun: request an interactive node(s) and login automatically
srun -A ac_xxx -p lr5 -q lr_normal -t 1:0:0 --pty bash
- salloc : request an interactive node(s)
salloc –A pc_xxx –p lr6 –q lr_debug –t 0:30:0
- sinfo:view information about partitions and nodes (idle, allocated, drain, down )
sinfo –r –p lr6
- squeue: check the current jobs in the batch queue system
squeue –u $USER
- sacct: information on jobs
sacct -X -o ‘jobid,user,partition,nodelist,stat’
- scancel : cancel a job
scancel jobID
- More information
- Data Transfer node lrc-xfer.lbl.gov
- scp -r your/source/file $[email protected]:/cluster/path
- rsync -avzh your/source/file $USER @lrc-xfer.lbl.gov:/cluster/path
- scp -r your/source/file $[email protected]:/cluster/path
- Globus Online provide secured unified interface for data transfer
- endpoint lbn#lrc, Globus Connect, AWS S3 connect
- Visualization and remote desktop
- Detailed information
- Technology of putting an application and all of its dependencies into a single package.
- Portable, shareable, and reproducible.
- Your application brings its environment with it.
- Package an analysis pipeline so that it runs on your laptop, in the cloud, and in a high performance computing (HPC) environment to produce the same result.
- Publish a paper and include a link to a container with all of the data and software that you used so that others can easily reproduce your results.
- Install and run an application that requires a complicated stack of dependencies with a few keystrokes.
- Create a pipeline or complex workflow where each individual program is meant to run on a different operating system.
- Open-source computer software that encapsulates an application and all its dependencies into a single image
- Bring containers and reproducibility to scientific computing and HPC
- Developed by Greg Kurtzer
- Singularity assumes that you will have a build system where you are the root user, but that you will also have a production system where you may or may not be the root user.
- Install Singularity on a local machine
- Build Singularity images/containers on the local machine
- Transfer images/containers to LRC clusters
- Run images /containers on the cluster
- Root privilege is not permitted
Three OS platforms: - Linux - Mac - Window Installation instructions
$ singularity --version
$ singularity run docker://godlovedc/lolcow
-
Directly from existing containers
-
Build from a definition file or recipes
- No root/sudo privilege is needed
- Create immutable squashfs containers
singularity pull --help
- Docker Hub: Pull a container from Docker Hub.
singularity pull docker://ubuntu:18.04
singularity pull docker://gcc:7.2.0
- Singularity Hub: If no tag is specified, the master branch of the repository is used
singularity pull shub://singularityhub/hello-world
-
shell sub-command: invokes an interactive shell within a container
singularity shell hello-world_latest.sif
-
run sub-command: executes the container’s runscript
singularity run hello-world_latest.sif
-
exec sub-command: execute an arbitrary command within container
singularity exec hello-world_latest.sif cat /etc/os-release
- Root/sudo privilege is needed
singularity build --help
- Build from a definition file
sudo singularity --debug build mycontainer.sif Singularity
Bootstrap: docker
From: ubuntu�
# used singularity run-help
%help
Hello. I'm in the container.�
# executed on host after the base OS is installed.
%setup
touch ${SINGULARITY_ROOTFS}/tacos.txt
echo “I love avocado” >> avocados.txt
# copy files from your host system into the container
%files
avocados.txt /opt
%environment
export NAME=avocado
# executed within the container after the base OS is installed at build time
#install new software and libraries, config files, directories, etc
%post
echo 'export Avocado=TRUE >> $SINGULARITY_ENVIRONMENT�
# executed when the container image is run: singularity run
%runscript
echo "Hello! Arguments received: $* \n"
exec echo "$@"
- library (images hosted on the Container Library)
- docker (images hosted on Docker Hub)
- shub (images hosted on Singularity Hub)
- localimage (images saved on your machine)
- yum (yum based systems such as CentOS and Scientific Linux)
- debootstrap (apt based systems such as Debian and Ubuntu)
- arch (Arch Linux)
- busybox (BusyBox)
- zypper (zypper ba
sudo singularity build --sandbox build test-box Singularity
sudo singularity build --sandbox build gccbox docker://gcc:7.2.0
- Can be built from a recipe or existing image
- Used to develop, test, and make changes, then build or convert it into a standard image
- When you want to alter your image, you can use commands like shell, exec, run, with the --writable option `sudo singularity shell --writable test-box```
- Convert a sandbox to an immutable final image:
sudo singularity build test-box.sif test-box
To check how a images is built, running script and environment variables.
singularity inspect [options] image_name
--lablels
--runscript
--deffile
--environment
- Python API for Singularity containers
- File transfer to LRC cluster
scp xxx.sif [email protected]:/your/path
- Run your container interactively
- Request an interactive compute node
-
singularity shell/run/exec container.sif
- Request an interactive compute node
-
- Submit a slurm job
#!/bin/bash -l
#SBATCH --job-name=container-test
#SBATCH --partition=lr5
#SBATCH --account=ac_xxx
#SBATCH --qos=lr_normal
#SBATCH --nodes=1
#SBATCH --time=1-2:0:0
cd $SLURM_SUBMIT_DIR
singularity exec your-container-name.sif CMD PARMs
singularity shell --nv --bind ${CUDA_HOME} ...
- Virtual Office Hours:
- Time: 10:30am - noon (Wednesdays)
- Request online
- Sending us tickets at [email protected]
- More information, documents, tips of how to use LBNL Supercluster http://scs.lbl.gov/
- DLab consulting: https://dlab.berkeley.edu/consulting