Perl and Singularity: Difference between pages

From RCSWiki
(Difference between pages)
Jump to navigation Jump to search
Created page with "= General = = Installing your own copy of Perl = <pre> $ mkdir -p ~/src/perl $ cd ~/src/perl $ wget $ tar xvf perl-5.32.0.tar.gz $ cd perl-5.32.0/ $ unset PERL5LIB $ u..."
 
m Added navbox
 
Line 1: Line 1:
= General =
Singularity lets users run applications and jobs inside a Linux container.  This allows for applications that were built to run on a different distribution of Linux or have specific software dependencies that are not compatible with our cluster systems to run. Applications from the [https://singularity-hub.org/ Singularity Hub] or [https://hub.docker.com Docker Hub] can run without needing to install anything.


== Usage ==
Singularity is available on ARC and is installed on all nodes. The most current version of Singularity will be installed at every major upgrade. Currently, Singularity 3.8.0 is installed on all nodes. Older versions can be used from modules (Eg. <code>module load singularity/2.4.1</code>).


= Installing your own copy of Perl =
Singularity can be used interactively. If you wish to enter a specific environment provided by a container, such as Ubuntu:
singularity shell docker://ubuntu


<pre>
= Adding Packages to a Docker Image =
$ mkdir -p ~/src/perl
* Build a "Sandbox" of the dockerhub image -- we'll use the docker centos:7.6.1810 image as an example:
singularity build --sandbox /tmp/centos/ docker://centos:7.6.1810
* Modify the image -- add the emacs editor into the image:
** Note the "-f" which means to use fakeroot which gives root privilege inside the conainer (so you can use yum install)
singularity run -f -w /tmp/centos/ yum -y install emacs
* Package up the sandbox into a singularity 1 file image:
singularity build -f centoswithemacs.simg /tmp/centos/
* Now you can use the container image in a job (replacing <your computation> with the program inside the container that you want to run):
singularity run centoswithemacs.simg <your computation>


$ cd ~/src/perl
== Converting a Docker image into a Singularity image ==
$ wget
You can convert a Docker image that has already been pulled on your system into a Singularity image file with the following command:
{{highlight|lang=text|code=
# singularity build /tmp/output.sif docker-daemon://input:latest
}}


$ tar xvf perl-5.32.0.tar.gz
[[Category:Guides]]
[[Category:Software]]


$ cd perl-5.32.0/
{{Navbox Software}}
 
$ unset PERL5LIB
$ unset PERL5OPT
 
$ DEST="$HOME/software/perl-5.32.0"
$ mkdir -p $DEST
 
$ PREF="-Dprefix=$DEST"
$ OPTS="-Dusethreads"
 
$ ./Configure -de $PREF $OPTS
 
$ make -j 4
 
$ make test |& tee tests.log
 
$ make install
</pre>
 
 
Activation script '''activate-perl.sh''':
<pre>
#! /bin/bash
ROOTDIR="$HOME/bin/perl-5.32.0" 
unset PERL5LIB
unset PERL5OPT
export PATH=$ROOTDIR/bin:$PATH
export MANPATH=$ROOTDIR/man:$MANPATH
</pre>

Latest revision as of 22:29, 20 September 2023

Singularity lets users run applications and jobs inside a Linux container. This allows for applications that were built to run on a different distribution of Linux or have specific software dependencies that are not compatible with our cluster systems to run. Applications from the Singularity Hub or Docker Hub can run without needing to install anything.

Usage

Singularity is available on ARC and is installed on all nodes. The most current version of Singularity will be installed at every major upgrade. Currently, Singularity 3.8.0 is installed on all nodes. Older versions can be used from modules (Eg. module load singularity/2.4.1).

Singularity can be used interactively. If you wish to enter a specific environment provided by a container, such as Ubuntu:

singularity shell docker://ubuntu

Adding Packages to a Docker Image

  • Build a "Sandbox" of the dockerhub image -- we'll use the docker centos:7.6.1810 image as an example:
singularity build --sandbox /tmp/centos/ docker://centos:7.6.1810
  • Modify the image -- add the emacs editor into the image:
    • Note the "-f" which means to use fakeroot which gives root privilege inside the conainer (so you can use yum install)
singularity run -f -w /tmp/centos/ yum -y install emacs
  • Package up the sandbox into a singularity 1 file image:
singularity build -f centoswithemacs.simg /tmp/centos/
  • Now you can use the container image in a job (replacing <your computation> with the program inside the container that you want to run):
singularity run centoswithemacs.simg <your computation>

Converting a Docker image into a Singularity image

You can convert a Docker image that has already been pulled on your system into a Singularity image file with the following command:

# singularity build /tmp/output.sif docker-daemon://input:latest