You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Problems with scientific software

Singularity addresses a number of problems encountered with scientific software:

  • Often, scientific software has a longer lifetime than the libraries it depends on.
  • Scientific software may depend on a larger number of libraries which are regularly updated.
  • Scientific results may need to be reproduced years later.

For these reasons, it is desirable to be able to freeze an application together with its entire environment in time, so that the functionality of the scientific software is preserved. However, often scientific software is run on supercomputers, where users typically do not have the root rights required to install software (e.g., one can not use `apt-get' in order to install a working set of libraries).

Singularity containers

Singularity allows one to create a virtual operating system (OS) inside of a so-called container (in the form of a file or folder). Inside of the virtual OS we install the necessary libraries, compile our scientific software, and then ship (=copy) the container to a different host system. The only software required on the other machine is Singularity, and perhaps an MPI library in the important case one wants to run parallel applications.

In effect, Singularity swaps the environment of the host system against that of the virtual OS. As a result, applications compiled on the virtual OS are independent of the host system and do not refer to any libraries or applications installed on it, except for Singularity itself (and MPI if applicable).

Basic commands

Only four basic commands are required to use Singularity:

  • sudo singularity build [container] [recipe]
  • singularity shell [container]
  • singularity exec [container] [command]
  • singularity run [container]

Using `build' we create a container based on a recipe (see below) or on an existing container. The `shell' command opens the shell within the virtual OS. Using `exec' we can execute applications installed on the virtual OS. The `run' command allows to use a container as an executable, provided that it defines a runscript telling the container what to do when the `run' command is called on it.

Importantly, a user has the same rights inside of the virtual OS as on the host system. For this reason, creating a container using the `build' command requires root rights (and this is typically done on one's own machine). In contrast, running applications does not usually require root rights and hence the `shell', `exec', and `run' commands can be used without `sudo'.

Recipe files




  • No labels