nf-core/configs: vsc_ugent
Configuration profile for execution of Nextflow pipelines on the VSC UGhent HPC.
University of Ghent High Performance Computing Infrastructure (VSC)
Setup
[!IMPORTANT] You will need an account to use the HPC cluster to run the pipeline.
Make sure you have an environment variable setup similar to the one below in ~/.bashrc
. If you’re not already part of a VO, ask your admin to add you or use VSC_DATA_USER
instead of VSC_DATA_VO_USER
.
For more installation help, read the documentation of a Nextflow workshop on VSC infrastructure like this one.
# Needed for Tier1 accounts, not for Tier2
export SLURM_ACCOUNT={FILL_IN_NAME_OF_YOUR_ACCOUNT}
export SALLOC_ACCOUNT=$SLURM_ACCOUNT
export SBATCH_ACCOUNT=$SLURM_ACCOUNT
# Needed for running Nextflow jobs
export NXF_HOME=$VSC_DATA_VO_USER/.nextflow
# Needed for running Apptainer containers
export APPTAINER_CACHEDIR=$VSC_SCRATCH_VO_USER/.apptainer/cache
export APPTAINER_TMPDIR=$VSC_SCRATCH_VO_USER/.apptainer/tmp
First you should go to the cluster you want to run the pipeline on. You can check what clusters have the most free space on this link. Use the following commands to easily switch between clusters:
module purge
module swap cluster/<CLUSTER>
Before running the pipeline you will need to create a PBS script to submit as a job.
#!/bin/bash
module load Nextflow
nextflow run <pipeline> -profile vsc_ugent <Add your other parameters>
All of the intermediate files required to run the pipeline will be stored in the work/
directory. It is recommended to delete this directory after the pipeline has finished successfully because it can get quite large, and all of the main output files will be saved in the results/
directory anyway.
The config contains a cleanup
command that removes the work/
directory automatically once the pipeline has completed successfully. If the run does not complete successfully then the work/
dir should be removed manually to save storage space.
You can also add several TORQUE options to the PBS script. More about this on this link.
To submit your job to the cluster by using the following command:
qsub <script name>.pbs
[!NOTE] The profile only works for the clusters
shinx
,skitty
,kirlia
,doduo
and all tier1 clusters.
[!NOTE] The default directory where the
work/
andsingularity/
(cache directory for images) is located in$VSC_SCRATCH_VO_USER
(when you are part of a VO) or$VSC_SCRATCH
(when you are not part of a VO) for tier2 clusters and$VSC_SCRATCH_PROJECTS_BASE/<tier1_project_name>
for tier1 clusters.
Use Apptainer containers
The VSC does not support Apptainer containers provided via a URL (e.g., shub://… or docker://…). Normally with the right Apptainer cache directory in a SCRATCH folder, you will not see the error apptainer image is not in an allowed configured path
. If you do have this error, you can ensure the container images are in the correct folder manually in two ways:
One solution is to use nf-core download. Make sure the cache directory points to a SCRATCH folder and you amend images instead of copying out of the SCRATCH folder.
Another solution is to download all the containers beforehand, like in this pipeline.
First get the containers.json file from the pipeline you want to run:
nextflow inspect main.nf -profile vsc_ugent > containers.json
Then run a build script (script appended below) to build all the containers. This can take a long time and a lot of space, but it is a one-time cost. For many large images, consider running this as a job.
bash build_all_containers.sh containers.json
build_all_containers.sh
#!/bin/env bash
# avoid that Apptainer uses $HOME/.cache
export APPTAINER_CACHEDIR=/tmp/$USER/apptainer/cache
# instruct Apptainer to use temp dir on local filessytem
export APPTAINER_TMPDIR=/tmp/$USER/apptainer/tmpdir
# specified temp dir must exist, so create it
mkdir -p $APPTAINER_TMPDIR
# pull all containers from the given JSON file
# usage: build_all_containers.sh containers.json [FORCE]
JSON=$1
FORCE=${2:-false}
echo "Building containers from $JSON"
NAMES=$(sed -nE 's/.*"name": "([^"]*)".*/\1/p' $JSON)
CONTAINERS=$(sed -nE 's/.*"container": "([^"]*)".*/\1/p' $JSON)
# default FORCE to false
# paste name and containers together
paste <(echo "$NAMES") <(echo "$CONTAINERS") | while IFS=$'\t' read -r name container; do
# is sif already present, continue unless FORCE is true
if [ -f "$name.sif" ] && [ "$FORCE" != "true" ]; then
continue
fi
# if container is null, skip
if [ -z "$container" ]; then
continue
fi
# if not docker://, add docker://
if [[ $container != docker://* ]]; then
container="docker://$container"
fi
echo "Building $container"
# overwrite the existing container
apptainer build --fakeroot /tmp/$USER/$name.sif $container
mv /tmp/$USER/$name.sif $name.sif
done
Use GPUs for your pipelines
Overwrite the container in your nextflow.config
. If you need GPU support, also apply the label ‘use_gpu’:
process {
withName: DEEPCELL_MESMER {
label = 'use_gpu'
// container "docker.io/vanvalenlab/deepcell-applications:0.4.1"
container = "./DEEPCELL_MESMER_GPU.sif"
}
}
Config file
// Get the hostname and check some values for tier1
def hostname = "doduo"
try {
hostname = ['/bin/bash', '-c', 'sinfo --local -N -h | head -n 1 | cut -d " " -f1'].execute().text.trim()
} catch (java.io.IOException e) {
System.err.println("WARNING: Could not run sinfo to determine current cluster, defaulting to doduo")
}
def tier1_project = System.getenv("SBATCH_ACCOUNT") ?: System.getenv("SLURM_ACCOUNT")
if (! tier1_project && hostname.contains("dodrio")) {
// Hard-code that Tier 1 cluster dodrio requires a project account
System.err.println("Please specify your VSC project account with environment variable SBATCH_ACCOUNT or SLURM_ACCOUNT.")
System.exit(1)
}
// Define the Scratch directory
def scratch_dir = System.getenv("VSC_SCRATCH_PROJECTS_BASE") ? "${System.getenv("VSC_SCRATCH_PROJECTS_BASE")}/$tier1_project" : // Tier 1 scratch
System.getenv("VSC_SCRATCH_VO_USER") ?: // VO scratch
System.getenv("VSC_SCRATCH") // user scratch
// Specify the work directory
workDir = "$scratch_dir/work"
// Perform work directory cleanup when the run has succesfully completed
cleanup = true
// Reduce the job submit rate to about 30 per minute, this way the server won't be bombarded with jobs
// Limit queueSize to keep job rate under control and avoid timeouts
// Extend the exit read timeout to 3 days to avoid timeouts on tier1 clusters
executor {
submitRateLimit = '30/1min'
queueSize = 100
exitReadTimeout = "3day"
}
// Add backoff strategy to catch cluster timeouts and proper symlinks of files in scratch to the work directory
process {
stageInMode = "symlink"
stageOutMode = "rsync"
errorStrategy = { sleep(Math.pow(2, task.attempt ?: 1) * 200 as long); return 'retry' }
maxRetries = 5
// add GPU support with GPU label
// Adapted from https://github.com/nf-core/configs/blob/76970da5d4d7eadd8354ef5c5af2758ce187d6bc/conf/leicester.config#L26
// More info on GPU SLURM options: https://hpc.vub.be/docs/job-submission/gpu-job-types/#gpu-job-types
withLabel: use_gpu {
// works on all GPU clusters of Tier 1 and Tier 2
beforeScript = 'module load cuDNN/8.4.1.50-CUDA-11.7.0'
// TODO: Support multi-GPU configuations with e.g. ${task.ext.gpus}
// only add account if present
clusterOptions = {"--gpus=1" + (tier1_project ? " --account=$tier1_project" : "")}
containerOptions = {
// Ensure that the container has access to the GPU
workflow.containerEngine == "singularity" ? '--nv':
( workflow.containerEngine == "docker" ? '--gpus all': null )
}
}
}
// Specify that singularity should be used and where the cache dir will be for the images
// containerOptions --containall or --no-home can break e.g. downloading big models to ~/.cache
// solutions to error 'no disk space left':
// 1. remove --no-home using NXF_APPTAINER_HOME_MOUNT=true
// 2. increase the memory of the job.
// 3. change the script so the tool does not use the home folder.
// 4. increasing the Singularity memory limit using --memory.
singularity {
enabled = true
autoMounts = true
cacheDir = "$scratch_dir/singularity"
}
env {
APPTAINER_TMPDIR="$scratch_dir/.apptainer/tmp"
APPTAINER_CACHEDIR="$scratch_dir/.apptainer/cache"
}
// AWS maximum retries for errors (This way the pipeline doesn't fail if the download fails one time)
aws {
maxErrorRetry = 3
}
def cluster = System.getenv("HPCUGENT_FAMILY_CLUSTER_VERSION") ?: System.getenv("SLURM_CLUSTERS") ?: ""
if( !cluster ) {
System.err.println("WARNING: Could not get the name of the currently used cluster, defaulting to doduo")
cluster = "doduo"
}
params.config_profile_description = 'Configuration profile for execution of Nextflow pipelines on the VSC UGhent HPC.'
params.config_profile_contact = 'ict@cmgg.be'
params.config_profile_url = 'https://www.ugent.be/hpc/en'
switch(cluster) {
case "skitty":
params {
max_memory = 177.GB
max_cpus = 36
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'skitty'
resourceLimits = [
cpus: 36,
memory: 177.GB,
time: 72.h
]
}
break
case "kirlia":
params {
max_memory = 738.GB
max_cpus = 36
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'kirlia'
resourceLimits = [
cpus: 36,
memory: 738.GB,
time: 72.h
]
}
break
case "doduo":
params {
max_memory = 250.GB
max_cpus = 96
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'doduo'
resourceLimits = [
cpus: 96,
memory: 250.GB,
time: 72.h
]
}
break
case "shinx":
params {
max_memory = 360.GB
max_cpus = 192
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'shinx'
resourceLimits = [
cpus: 128,
memory: 256.GB,
time: 72.h
]
}
break
case "cpu_rome":
params {
max_memory = 256.GB
max_cpus = 128
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/cpu_rome'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 128,
memory: 256.GB,
time: 72.h
]
}
break
case "cpu_rome_512":
params {
max_memory = 512.GB
max_cpus = 128
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/cpu_rome_512'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 128,
memory: 256.GB,
time: 72.h
]
}
break
case "cpu_milan":
params {
max_memory = 256.GB
max_cpus = 128
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/cpu_milan'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 128,
memory: 256.GB,
time: 72.h
]
}
break
case "gpu_rome_a100_40":
params {
max_memory = 256.GB
max_cpus = 48
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/gpu_rome_a100_40'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 48,
memory: 256.GB,
time: 72.h
]
}
break
case "gpu_rome_a100_80":
params {
max_memory = 512.GB
max_cpus = 48
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/gpu_rome_a100_80'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 48,
memory: 512.GB,
time: 72.h
]
}
break
case "debug_rome":
params {
max_memory = 256.GB
max_cpus = 48
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/debug_rome'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 48,
memory: 256.GB,
time: 72.h
]
}
break
case "cpu_rome_all":
params {
max_memory = 250.GB
max_cpus = 128
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/cpu_rome_all'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 128,
memory: 250.GB,
time: 72.h
]
}
break
case "gpu_rome_a100":
params {
max_memory = 384.GB
max_cpus = 48
max_time = "3day"
}
process {
executor = 'slurm'
queue = 'dodrio/gpu_rome_a100'
clusterOptions = "-A ${tier1_project}"
resourceLimits = [
cpus: 48,
memory: 384.GB,
time: 72.h
]
}
break
}
// Define profiles for each cluster
profiles {
skitty {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
kirlia {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
doduo {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
shinx {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
cpu_rome {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
cpu_rome_512 {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
cpu_milan {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
gpu_rome_a100_40 {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
gpu_rome_a100_80 {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
debug_rome {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
cpu_rome_all {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
gpu_rome_a100 {
System.err.println("Using the '-profile vsc_ugent,<cluster>' is deprecated in favor of '-profile vsc_ugent'. The config will now automatically determine the currently used cluster.")
}
}