Singularity je kontajnerová platforma. Kontajner je jeden súbor, ktorý obsahuje nastavenie prostredia a všetok potrebný softvér pre spustenie vašej aplikácie.

  • Singularity is an opensource project that was created to run complex applications on HPC clusters.
  • It enables users to have full control of their environment. It allows you to create and run containers that package up pieces of software in a way that is portable and reproducible.
  • You can build a container using Singularity on your laptop, and then run it on HPC clusters.
  • Singularity also allows you to leverage the resources of whatever host you are on. This includes HPC interconnects, resource managers, file systems, GPUs and/or accelerators, etc.

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/RHEL7, you can create an Ubuntu/RHEL7 image, install your applications into that image, copy the image to another host, and run your application on that host in its native Ubuntu/RHEL7 environment.

Singularity containers can be in three different formats:

  • read-only squashfs (default) – vhodný pre produkčný image;
  • writable ext3 (–writable option);
  • writable (ch)root directory (–sandbox option) – vhodný pre vývoj.

Squashfs and (ch)root directory images can be built from Docker source directly on the cluster, no root privileges are needed. It is strongly recommended to create a native Singularity image to speed up the launch of the container. Singularity is available in Kosice cluster.

GPU Example

Tensorflow is commonly used for machine learning projects. The official tensorflow repository on Docker Hub contains NVIDA GPU supporting containers, that will use CUDA for processing.

singularity pull docker://tensorflow/tensorflow:latest-gpu

An example is located in /lustre/home/freeware/EXAMPLE_JOBS/gpu.

Príkazy, ktoré obsahujú run, alebo inak spúšťajú kontajner (shell, exec) môžu použiť prepínač –nv, ktorý nastaví v kontajneri prostredie pre využitie NVIDIA GPU a základné knižnice CUDA a umožní tak spustenie CUDA aplikácií.

You can run CUDA application on compute nodes which have GPUs: comp[17-24,39-56]. There is run script, which is simple tensorflow example. You can run it with command sbatch

OpenMPI Example

An openmpi example is located in /lustre/home/freeware/EXAMPLE_JOBS/singularity/openmpi/.
In this example mpiexec command is executed on singularity container. Inside container is installed the same version of openmpi. Image was built on local linux machine using recipe file openmpi-test.recipe with root privileges: sudo singularity build openmpi.simg openmpi-test.recipe

During the process of creating the image openmpi with infiniband support is built from source code and simple test is compiled. You can run the example with command sbatch

Interaktívny shell v kontajneri môžete spustiť príkazom singularity shell. Je vhodný pre vývojárske účely. Použite prepínač -w | –writable aby sa zmeny v kontajneri uložili natrvalo.

A user home directory is mounted inside the container automatically. If you need access to the /scratch local disk storage for your computation, this must be mounted by the -B | --bind option. /scratch na lokálnom disku, toto spravíte pomocou prepínača -B | –bind.

A complete documentation can be found at the Singularity webpage. Singularity.