...
If you only want to run your MPI job on a single node, then you don’t have to call mpirun before the singularity call. This will use MPI installed inside the container only and not use Artemis’s MPI at all, and will still have performance equivalent to “bare metal” on Artemis.
Example to run a Dockerfile on Artemis with Singularity
Start with a Dockerfile, like this one
, which contains the Trinity platform. View file name Dockerfile height 250
To run this on your computer where you have root access, you probably only need to:
Code Block |
---|
#In the directory where you have saved the Dockerfile
docker build Dockerfile
#Then this particular Dockerfile can be interfaced/run like so
sudo docker run --rm -v`pwd`:`pwd` trinityrnaseq/trinityrnaseq Trinity --seqType fq --single `pwd`/reads.fq.gz --max_memory 1G --CPU 4 --output `pwd`/trinity_out_dir |
But if we want to run it with Singularity we need to do a few more steps.
Firstly, we must convert the Dockerfile to a Singularity image, an easy way is to use the Python package Spython, https://vsoch.github.io/singularity-cli/recipes
Then as per Spython's instructions you can convert the Dockerfile by:
Code Block |
---|
spython recipe Dockerfile >> Singularity.trinity |
Next, edit the newly created Singularity image. Add the Artemis-specific changes to your new singularity image, i.e.
Code Block |
---|
Bootstrap: docker
From: ubuntu:16.04
%files
%Dockerfile $SRC/Dockerfile.$TRINITY_VERSION
%labels
MAINTAINER bhaas@broadinstitute.org
%post
mkdir /project /scratch
|
Next use Singularity to build the image (~30 minutes on my local laptop)
Code Block |
---|
sudo singularity build Singularity.trinity.build Singularity.trinity |
Now move the build to Artemis and run it with a PBS script
Code Block |
---|
#!/bin/bash
#PBS -P PROJECT
#PBS -l select=1:ncpus=4:mem=4gb
#PBS -l walltime=0:10:00
module load singularity/2.6.1
cd "$PBS_O_WORKDIR"
singularity exec Singularity.trinity.build Trinity --seqType fq --single `pwd`/reads.fq.gz --max_memory 4G --CPU $NCPUS --output `pwd`/trinity_out_dir |