SHPC is a utility that allows the installation of software containers in the form of container modules.
Prerequisites
Familiarity with:
What is SHPC?
SHPC allows the installation of software containers in the form of so-called container modules, for transparent usage of containerised applications. An automated process generates a system module for an application, hiding the specificities of the Singularity syntax behind shell functions that take the same name as the corresponding executables.
For containerised applications that are already available in the SHPC registry, installing and using them via SHPC is much simpler than using Singularity itself. For applications that are not yet in the registry, writing a custom container recipe may still be faster than learning how to use Singularity.
SHPC at Pawsey
SHPC has been configured by Pawsey staff to work out-of-the-box; the following aspects have been set up:
- Directory trees for installed containers and modules
- Default registry for installation recipes
- Use of Singularity as the container runtime
- Naming convention and features of generated modulefiles
- Configuration for MPI and GPU containers
SHPC is used by Pawsey staff to deploy some of the available scientific softwares, in particular bioinformatics applications.
Using SHPC
Installing a container for a software included in the SHPC registry requires no knowledge of containers and Singularity: all you need are the software name and version.
The key commands of SHPC are show
and install
; let's see them in action with an example. Suppose we want to install the bioinformatics package BWA. We can use the shpc show
command to browse the SHPC registry of available containers:
$ module load shpc/0.0.53 # load SHPC module $ shpc show -f bwa # search for a package in SHPC registry (string search) biocontainers/bwa ghcr.io/autamus/bwa $ shpc show biocontainers/bwa # inspect specific container recipe docker: biocontainers/bwa url: https://hub.docker.com/r/biocontainers/bwa maintainer: '@vsoch' description: BWA is a software package for mapping low-divergent sequences against a large reference genome, such as the human genome. latest: 0.7.15: sha256:6f76c11a816b10440fd9d2c64c7183a31cc104a729f31a373c9b2b068138305e tags: 0.7.15: sha256:6f76c11a816b10440fd9d2c64c7183a31cc104a729f31a373c9b2b068138305e v0.7.17_cv1: sha256:9479b73e108ded3c12cb88bb4e918a5bf720d7861d6d8cdbb46d78a972b6ff1b aliases: bwa: /opt/conda/bin/bwa
The information of interest in this output is the list of available versions (or tags), in this case: 0.7.15
and v0.7.17_cv1
. Let's install the former:
$ shpc install biocontainers/bwa:0.7.15 singularity pull --name /software/projects/projectcode/rsrchr/setonix/containers/sif/biocontainers/bwa/0.7.15/biocontainers-bwa-0.7.15-sha256:6f76c11a816b10440fd9d2c64c7183a31cc104a729f31a373c9b2b068138305e.sif docker://biocontainers/bwa@sha256:6f76c11a816b10440fd9d2c64c7183a31cc104a729f31a373c9b2b068138305e INFO: Converting OCI blobs to SIF format INFO: Starting build... Getting image source signatures [..] INFO: Creating SIF file... /software/projects/projects/projectcode/rsrchr/setonix/containers/sif/biocontainers/bwa/0.7.15/biocontainers-bwa-0.7.15-sha256:6f76c11a816b10440fd9d2c64c7183a31cc104a729f31a373c9b2b068138305e.sif Module biocontainers/bwa:0.7.15 was created.
That's it!
By default SHPC downloads containers under:
/software/projects/<project-id>/<user-name>/setonix/containers/sif/
and creates modulefiles under:
/software/projects/<project-id>/<user-name>/setonix/containers/modules/
You are able to use module avail
, module load
, and module unload
: (as these are system modules, note the slash "/
" for the version, instead of the colon ":
" above for the tags):
$ module avail bwa # search module -------------------------------------------------------- /software/projects/projectcode/rsrchr/setonix/containers/modules --------------------------------------------------------- biocontainers/bwa/0.7.15/module $ module load biocontainers/bwa/0.7.15/module # load module $ bwa # test command Program: bwa (alignment via Burrows-Wheeler transformation) Version: 0.7.15-r1140 Contact: Heng Li <lh3@sanger.ac.uk> Usage: bwa <command> [options] Command: index index sequences in the FASTA format mem BWA-MEM algorithm fastmap identify super-maximal exact matches pemerge merge overlapping paired ends (EXPERIMENTAL) aln gapped/ungapped alignment samse generate alignment (single ended) sampe generate alignment (paired ended) bwasw BWA-SW for long queries shm manage indices in shared memory fa2pac convert FASTA to PAC format pac2bwt generate BWT from PAC pac2bwtgen alternative algorithm for generating BWT bwtupdate update .bwt to the new format bwt2sa generate SA from BWT and Occ Note: To use BWA, you need to first index the genome with `bwa index'. There are three alignment algorithms in BWA: `mem', `bwasw', and `aln/samse/sampe'. If you are not sure which to use, try `bwa mem' first. Please `man ./bwa.1' for the manual.
Loading a module created by SHPC
As of version 0.0.53 of SHPC, modules created using this tool require the suffix /module
to be loaded correctly.
For instance:
module load biocontainers/bwa/0.7.15/module
Failing to add the /module
will result in an error, and no module will be loaded.
This behaviour is going to be improved in future SHPC versions.
The full list of SHPC commands can be shown by using one of the help commands:
$ shpc -h
$ shpc <subcommand> -h
Writing an SHPC container recipe
What if a software container is not in the SHPC registry? In this case, you can either write your own container recipe (see terminal 5), or email the Pawsey helpdesk for help.
Suppose you want to install the bioinformatics tool Velvet. For the sake of this example, we know already that there's a container available for Velvet at quay.io/biocontainers/velvet (external site).
$ module load shpc/0.0.53 # load SHPC module $ shpc show -f velvet $
As you can see from the empty output, there's no pre-existing entry in the SHPC Container Registry.
Let's see how to create one; in practice, we need to create a YAML container recipe inside the registry tree of SHPC. First, let's get the location of the registry, and then create an appropriate directory structure using the known container repo quay.io/biocontainers/velvet that was postulated above.
$ shpc config get registry # get registry location registry /software/projects/projectcode/rsrchr/shpc/registry # create directory tree for desired Velvet container recipe $ mkdir -p /software/projects/projectcode/rsrchr/shpc/registry/quay.io/biocontainers/velvet # create a new YAML container recipe in the new path (using vi as text editor here) $ vi /software/projects/projectcode/rsrchr/shpc/registry/quay.io/biocontainers/velvet/container.yaml
Let's see how a possible recipe for Velvet might look:
docker: quay.io/biocontainers/velvet latest: "1.2.10--h5bf99c6_4": "sha256:7fc2606a1431883dcd0acf830abcfeddb975677733d110a085da0f07782f5a27" tags: "1.2.10--h5bf99c6_4": "sha256:7fc2606a1431883dcd0acf830abcfeddb975677733d110a085da0f07782f5a27" "1.2.10--hed695b0_3": "sha256:b17fd98d802c1e78dde5fd2c5431efc1969db35a279f3a5ca7afcb46efc66e4a" maintainer: "@marcodelapierre" # these are optional description: "Velvet is a sequence assembler for short reads." url: https://quay.io/repository/biocontainers/velvet aliases: velvetg: /usr/local/bin/velvetg velveth: /usr/local/bin/velveth
Let's comment on the key components of this YAML file:
docker
is the repository path for the container, without version tagstags
is a list of container tags (versions) with the corresponding SHA message digest (shasum); these need to be manually collected from the repository website, in this case https://quay.io/repository/biocontainers/velvet?tab=tagslatest
is a copy-paste of the tag from above, to be used as "latest" versionmaintainer
is the Github username of the creator (required to contribute the recipe back to the Github repository of SHPC; put any name if you don't have one)aliases
is a list of command names that will be made available by the SHPC module, with the corresponding commands from inside the container; these need to be manually provided, either by reading through the documentation of the package, or by downloading and inspecting the container
Does this recipe work? Let's give it a go!
Advanced: adding features to your recipe
You can add advanced features to your recipe using Features.
The SHPC authors outline this functionality in their documentation.
Currently*, the following features are supported:
Name | Description | Default | Options |
---|---|---|---|
gpu | If the container technology supports it, add flags to indicate using gpu. | null | nvidia, amd, null |
x11 | Bind mount ~/.Xauthority or a custom path | null | true (uses default path ~/.Xauthority), false/null (do not enable) or a custom path to an x11 file |
home | Specify and bind mount a custom homepath | null | custom path for the home, or false/null |
*Correct as of 11/8/2023
Note that you can use the home
feature to allow your container module to bind mount a home of your choosing. This might be needed for some containers that expect to access a certain directory. For example, the aws-cli container expects to have read/write access to your ~/.aws
directory. See the following SHPC recipe as an example which would bind mount the user's home directory:
Related pages
- Review Software Stack Policies before proceeding with local installations.
External links
- More information on SHPC can be found in the Singularity Registry (HPC) documentation.