Singularity

Z MetaCentrum
Přejít na: navigace, hledání
Singularity logo.svg

Singularity enables users to have full control of their environment. This means that a non-privileged user can “swap out” the operating system on the host for one they control. So if the host system is running RHEL6 but your application runs in Ubuntu, you can create an Ubuntu image, install your applications into that image, copy the image to another host, and run your application on that host in it’s native Ubuntu environment!



Availability

Singularity is installed on all Metacentrum nodes and to be installed on all Cerit nodes. There are two images prepared for our users - Debian 8, mimicing Metacentrum compute node installation (all deb packages preinstalled, AFS, NFS and SW modules working) and Centos image, mimicing Cerit compute node installation.

Images are located at:

/software/singularity/images/debian/debian8-meta.img

and

/software/singularity/images/centos/centos.img

respectively.

Basic usecases

Some basic usecases covering the singularity usage are bellow. Please note, that mentioning all nuances (especially usage of various versions of MPI or running parallel job on different infiniband HW) is beyond scope of this section.

Interactive session

[dexter@ungu1 ~]$ singularity shell /software/singularity/images/debian/debian8-meta.img
Singularity: Invoking an interactive shell within container...
(SINGULARITY_JESSIE)dexter@ungu1:~$

Running command

[dexter@ungu1 ~]$ singularity exec /software/singularity/images/debian/debian8-meta.img bash -c "module add jdk-8; java -version"
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

PBS Pro: singularity interactive session

qsub -I -l select=1 -l walltime=24:00:00 -- /usr/bin/singularity shell /software/singularity/images/debian/debian8-meta.img

PBS Pro: running script inside singularity container

qsub -l select=1 -l walltime=24:00:00 -- /usr/bin/singularity exec /software/singularity/images/debian/debian8-meta.img bash -c "/path/to/script.sh"

PBS Pro: running parallel job using singularity

The scenario for this setup is: two nodes with common scratch dir

 #!/bin/bash
 #PBS -l select=2:ncpus=2:mem=1gb:scratch_shared=4gb
 #PBS -l walltime=04:00:00
 #PBS -l place=scatter
 # modify/delete the above given guidelines according to your job's needs

 module add openmpi-2.0.1-gcc
 cat $PBS_NODEFILE |uniq >nodes.txt

 # run job over ethernet or infiniband (mpirun autoselects better)
 mpirun -n 2 --hostfile nodes.txt singularity exec /software/singularity/images/debian/debian8-meta.img /path/to/program

More information about parallelization and different setups (specially for programs supporting MPI and OpenMP together) can be found in How_to_compute/Parallelization.

Preparing your own singularity image

Preparing your own singularity image is intended for experienced users hence machine with root access is may be needed and reading singularity documentation singularity documentation is a good idea too :) In general, you do not need root privileges if you can (re)use existing docker image.

Without root privileges you can do simply:

singularity create -s size_in_mb image.img
singularity import image.img docker://tensorflow/tensorflow:latest

However, if you want to change something or make your own image from scratch, you'll need root privileges to be able to write (-w) into container image:

singularity create -s size_in_mb image.img
singularity import image.img docker://ubuntu:latest # import base image from Docker hub
singularity shell -w image.img
apt-get install my_software

Documentation

http://singularity.lbl.gov/user-guide

License

https://raw.githubusercontent.com/singularityware/singularity/development/LICENSE.md

Program administrator

meta@cesnet.cz