Singularity

Singularity is a container system designed for use on High Performance Computing (HPC) systems. It allows users to run both Docker and Singularity containers.

From the Docker website: "A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings."

Availability and Restrictions

Versions

Singularity is available on Ruby, Owens and Pitzer clusters. Only one version is available at any given time. To find out the current version:

singularity version

Access

Singularity is available to all OSC users.

Publisher/Vendor/Repository and License Type

SyLabs, Inc., 3-clause BSD License

Usage

Set-up

No setup is required. You can use Singulairty directly on all clusters.

Using Singularity

See HOWTO: Use Docker and Singularity Containers at OSC for information about using Singularity on Ruby, Owens and Pitzer clusters, including some site-specific caveats.

Example:  Run a container from the Singularity hub

[owens-login01]$ singularity run library://godlovedc/funny/lolcow
INFO:    Downloading library image
Progress |===================================| 100.0%
 _______________________________________
/ You never have to change anything you \
| got up in the middle of the night to  |
| write.                                |
|                                       |
\ -- Saul Bellow                        /
 ---------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

[owens-login01]$

Known Issues

    Failed to run a local image from $HOME that have restricted access permissions

    Update: 03/08/2019 
    Version: 3.0.0

    You might encounter a sittuation like

    [owens-login01]$ cd $HOME
    [owens-login01]$ singularity pull shub://vsoch/hello-world
    WARNING: Authentication token file not found : Only pulls of public images will succeed
    Progress |===================================| 100.0%
    [owens-login01]$ singularity run hello-world_latest.sif
    FATAL: container creation failed: mount error: can't mount image /proc/self/fd/9: failed to find loop device: could not attach image file too loop device: No loop devices available

    Check if your home directory has the restricted permissions drwx------ or drwxr-x---

    [owens-login01]$ ll -d $HOME
    drwx------ 29 tester PXX0000 4096 Mar 8 10:50 /users/PXX0000/tester

    Due to root squash of home directory file system, you are not able to run an image from home directory with restricted permissions. It is recommended to place your container images  in project or scratch directories which have faster image loading speed.

    If you would like to place Singularity images in home directory, you may consider to change the permission:

    [owens-login01]$ chmod 711 $HOME
    [owens-login01]$ ll -d $HOME
    drwx--x--x 29 tester PXX0000 4096 Mar 8 10:50 /users/PXX0000/tester

    Failed to run a container directly or pull an image from Singularity or Docker hub

    Update: 03/08/2019 
    Version: all

    You might encounter an error while run a container directly from a hub:

    [owens-login01]$ singularity run shub://vsoch/hello-world
    Progress |===================================| 100.0%
    FATAL: container creation failed: mount error: can't mount image /proc/self/fd/13: failed to find loop device: could not attach image file too loop device: No loop devices available
    

    One solution is to remove the Singularity cached images from local cache directory $HOME/.singularity/cache. If the singularity version is prior to 3.0:

    [owens-login01]$ cd $HOME/.singularity/cache
    [owens-login01 cache]$ rm -rf *
    

    If the singularity version is 3.1 and above:

    [owens-login01]$ singulariy cache clean -a
    

    Alternatively, you can change the Singularity cache directory to different location by setting the variable SINGULARITY_CACHEDIR. For example, in a batch job:

    #PBS -N singularity_teset
    #PBS -l nodes=1:ppn=1
    #PBS -j oe
    
    export SINGULARITY_CACHEDIR=$TMPDIR
    singularity run shub://vsoch/hello-world
    

     

    Further Reading

    Supercomputer: