Running solutions on clusters and in the cloud

Where

How

HPC cluster

Album installed on a shared filesystem, album run in your job scripts

Cloud VM or any other Docker host

A container image of the solution, built with album-docker, or the official Album image

Many inputs of one solution

album-distributed in one job or on one VM

Several Album processes can use the same Album installation at the same time, for example the jobs of a job array. For how album run behaves in job scripts - exit codes, logs, arguments - see Using solutions in data workflows.

HPC cluster

  1. Choose a shared filesystem path that is mounted at the same absolute path on the login nodes and on all compute nodes, with enough quota for several solution environments - for example an S3 bucket that is mounted on the login node and on every compute node. Solution environments cannot be moved later.

  2. Install Album there and keep Album’s data on the same filesystem:

    micromamba create -p /project/my-lab/album-env album -c conda-forge
    micromamba activate /project/my-lab/album-env
    export ALBUM_BASE_CACHE_PATH=/project/my-lab/album
    
  3. Install the solutions on a node with internet access, for example a login node:

    album add-catalog https://gitlab.com/my-lab/my-catalog
    album install my-catalog:my-group:segment:0.1.0
    
  4. Run them in jobs, with the same ALBUM_BASE_CACHE_PATH in every job script.

SLURM job scripts

A CPU job:

#!/bin/bash
#SBATCH --job-name=segment
#SBATCH --cpus-per-task=8
#SBATCH --mem=32G
#SBATCH --time=02:00:00
#SBATCH --output=segment-%j.log

eval "$(micromamba shell hook --shell bash)"
micromamba activate /project/my-lab/album-env
export ALBUM_BASE_CACHE_PATH=/project/my-lab/album

album run my-catalog:my-group:segment:0.1.0 \
    --input /project/my-lab/data/stack.tif \
    --output /project/my-lab/results/stack_seg.tif

A GPU job differs only in the resource request (the partition name depends on your cluster):

#!/bin/bash
#SBATCH --job-name=segment-gpu
#SBATCH --partition=gpu
#SBATCH --gres=gpu:1
#SBATCH --cpus-per-task=8
#SBATCH --mem=32G
#SBATCH --time=02:00:00
#SBATCH --output=segment-gpu-%j.log

eval "$(micromamba shell hook --shell bash)"
micromamba activate /project/my-lab/album-env
export ALBUM_BASE_CACHE_PATH=/project/my-lab/album

album run my-catalog:my-group:segment:0.1.0 \
    --input /project/my-lab/data/stack.tif \
    --output /project/my-lab/results/stack_seg.tif

Submit with sbatch segment.sh. micromamba has to be on the PATH of the job, otherwise call it by its full path. The job log contains the output of Album and the solution, and the job fails if album run fails.

Many inputs in one job

album-distributed processes all files that match a pattern in one job, with one task per file in parallel threads:

album run-distributed my-catalog:my-group:segment:0.1.0 \
    --input "/project/my-lab/data/*.tif" \
    --output "/project/my-lab/results/*_seg.tif" \
    --mode queue --threads "$SLURM_CPUS_PER_TASK"

Using a different micromamba

Album downloads micromamba into $ALBUM_BASE_CACHE_PATH/micromamba the first time it needs it. To use a micromamba that is already available, place it at $ALBUM_BASE_CACHE_PATH/micromamba/bin/micromamba before that, or set ENVIRONMENT_DEBUGGING_MICROMAMBA_PATH to its path. With the variable, micromamba keeps its package cache under its own root prefix (MAMBA_ROOT_PREFIX) - make sure that location has enough space.

Cloud VM

  1. Create a Linux x86_64 VM - with a GPU if your solution needs one - with free disk space of at least twice the size of the image archive.

  2. Install Docker Engine. For GPUs, also install the NVIDIA driver and the NVIDIA Container Toolkit.

  3. Copy the image archive of your solution to the VM and load it, or pull the image from your registry - see Album Docker.

  4. Copy or mount your data and run the container as described in Album Docker.

  5. Copy the results back before you delete the VM.

Without a solution image

Use the official Album image from Docker Hub and keep Album’s data in a Docker volume, so the installed solutions are kept between containers. Everything after the image name is an album command:

docker volume create album
docker run --rm -v album:/root/.album albumsolutions/album:1.0.0 add-catalog https://gitlab.com/my-lab/my-catalog
docker run --rm -v album:/root/.album albumsolutions/album:1.0.0 install my-catalog:my-group:segment:0.1.0
docker run --rm -v album:/root/.album -v /data:/data albumsolutions/album:1.0.0 run my-catalog:my-group:segment:0.1.0 --input /data/stack.tif --output /data/stack_seg.tif

Case study: ari3d

ari3d wraps a whole Snakemake workflow as one solution and runs as one container image on GPU machines, see the case study.