# How to Scale Bioinformatics Workflows on HPC

Scaling up your bioinformatics analyses is the point where most projects stall. The pipeline that processed three genomes on a laptop crashes, slows to a crawl, or fills the disk the moment you feed it thirty. This guide walks you through the transition to a high-performance computing (HPC) cluster in a deliberate, step-by-step way. By the end you will be able to profile a workload, package your tools in containers, run a Nextflow pipeline through a SLURM scheduler, size the resources each step needs, and diagnose the failures that come back when jobs run at scale.

Here is what you need before starting:

- An account on an HPC cluster that uses SLURM (Simple Linux Utility for Resource Management), the scheduler used by most academic clusters
- Comfort with the Unix command line, including moving between directories and editing text files
- Nextflow installed on the cluster login node, plus either Apptainer (formerly Singularity) or an Anaconda or Miniconda environment for tool management
- A pilot dataset, roughly a handful of samples, that you can run end to end before touching the full cohort

## What Scaling Actually Means in Bioinformatics

Scaling has two directions. Vertical scaling means giving one task more resources, for example moving an assembler from 8 cores to 64 cores on a single large-memory node. Horizontal scaling means running many tasks at once, for example aligning 200 samples in parallel across a cluster. Sequencing projects require both. Next-generation sequencing has pushed modern biology into a regime where experiments are simultaneously data intensive and computationally intensive, which is why HPC architectures have become progressively more recognized by bioinformaticians rather than being the concern of computational centers alone [1].

A typical setup involves several challenges beyond raw compute speed. Reviews of large-scale sequencing analysis setups consistently flag the appropriate selection of analytical tools, parallelization and acceleration on HPC systems, automation strategies, and data storage solutions as the core engineering problems researchers face [2]. Scaling is therefore not one decision. It is a sequence of decisions about workflow structure, scheduling, containers, and storage that reinforce each other.

## Choosing Your Software: A Research Software Comparison for Workflow Managers

The single highest-leverage decision in scaling bioinformatics workflows on HPC is which [workflow management](/knowledge/bioinformatics/snakemake-vs-nextflow-workflow-architectures) system (WMS) you adopt. A WMS chains individual tools into a reusable pipeline, handles retries, and maps tasks onto the cluster scheduler for you. A recent scoping review evaluated 55 currently available WMSs and synthesized evaluation criteria from 21 published papers, extracting twelve themes that matter to users: Basic Computing, Functions, Security, Scalability, Cost/Efficiency, Sustainability, Usability, Learnability, Reproducibility, FAIRness, Flexibility, and Support [3]. Two patterns from that review matter for anyone choosing between tools. Evaluations focused on noncomputational users favored graphical user interfaces and platforms with heavy guidance, while papers prioritizing developers favored text-based interfaces [3].

A separate systematic evaluation compared Nextflow, CWL, and WDL alongside their executors, plus Swift/T, a manager common in high-scale physics applications. The authors tested each on a variant-calling genomic pipeline and a scalability framework run locally, on an HPC cluster, and in the cloud, scoring them on language expressiveness, modularity, scalability, robustness, reproducibility, interoperability, ease of development, and adoption. Their conclusion was that the right choice is a function of the language and engine features and, in bioinformatics specifically, of adoption within large collaborating labs, because analysts there are a mix of dry and wet lab scientists [4].

| System | Interface style | Best fit when |
|--|--|--|
| Nextflow | Text-based DSL, strong HPC and container support | You want the most widely adopted option for genomics on SLURM clusters |
| CWL | Declarative YAML descriptions | Your institution requires portable, standards-based workflow descriptions |
| WDL | Declarative, Broad Institute heritage | You work in environments already built around WDL pipelines |
| GUI platforms | Graphical, guided | Team members have limited command-line experience [3] |

For most researchers starting to scale, Nextflow is the pragmatic default because of its executor for SLURM, built-in container support, and resume capability. That said, R users can reach the same goal differently. The BLIT package lets R users wrap command-line tools as validated R6 objects with Micromamba-based environment management, and it can hand constructed command workflows off to HPC schedulers, which replaces fragile system() calls with a structured framework [5]. Image-based projects have an equivalent option in BioImageIT, a Python-based workflow system with a node-based GUI and a Python API that captures metadata at every processing step to support FAIR principles [6].

## Scaling Bioinformatics Workflows on HPC Step by Step

The walkthrough below assumes a Nextflow pipeline for read alignment, but the same sequence applies to variant calling, transcriptome assembly, or any other analysis. The principles come straight from production experience with large-scale pipelines [7], [4].

### Step 1. Profile One Sample Before You Scale Anything

Never scale a pipeline you have not timed. Log in to the cluster and check what partitions exist:

```bash
sinfo -N -l
```

Expected output looks like this:

```
NODELIST     PARTITION  CPUS  MEMORY  STATE
node001      short      64    251G    idle
node002      long       64    251G    idle
gpu001       gpu        32    500G    idle
```

Then run one sample interactively on a compute node with srun so you can measure CPU use, peak memory, and wall time:

```bash
srun -p short -c 8 -t 2:00:00 bwa mem -t 8 ref.fa sample_R1.fq.gz sample_R2.fq.gz > sample.sam
```

The parameters here are `-p` for the partition (the queue name), `-c` for CPUs per task, and `-t` for the wall-clock time limit in hours and minutes. While the job runs, watch memory use with the `maxRSS` column of the accounting system later. Record three numbers for each stage of your pipeline: elapsed time, peak memory, and output size. These three numbers drive every resource request you write afterwards.

### Step 2. Containerize the Tools

Containers solve the dependency problem that surfaces the moment your pipeline moves from laptop to cluster. On HPC you will almost always use Apptainer rather than Docker, because running the Docker daemon requires root privileges that cluster users do not have. Pull a test image and confirm it works:

```bash
apptainer pull alpine.sif docker://alpine:latest
apptainer exec alpine.sif echo "container works"
```

Expected output:

```
container works
```

The value of this approach at scale was demonstrated in the ICGC PanCancer Analysis of Whole Genomes project, where over 5,800 whole human genomes were aligned and variant called across 14 cloud and HPC environments. The project relied on highly portable Docker images to encapsulate complex alignment and variant calling workflows across highly variable environments, and the experience motivated the Dockstore registry, which provides a standardized way to describe and execute containerized tools and workflows [8]. In practical terms, pin the exact version of every tool in a container so a rerun two years from now produces the same result.

### Step 3. Write the Pipeline With Per-Process Resources

Nextflow lets you declare resources per process, which is what makes horizontal scaling work. A minimal process block:

```nextflow
process ALIGN {
    tag "${meta.id}"

    input:
    tuple path(reads), val(meta)

    output:
    tuple val(meta), path("${meta.id}.bam"), emit: bam

    script:
    """
    bwa mem -t ${task.cpus} ref.fa ${reads} ${reads[9]} | samtools sort -o ${meta.id}.bam
    """
}
```

The `${task.cpus}` placeholder passes the requested core count into the tool itself, so the software parallelism matches the scheduler allocation. A mismatch here is one of the most common ways researchers waste allocation time, requesting 16 cores while the tool runs on one.

### Step 4. Configure the SLURM Executor

Next, define a configuration file, `nextflow.config`, that tells Nextflow how to talk to SLURM and what each stage needs:

```groovy
profiles {
    slurm {
        process.executor = 'slurm'
        apptainer.enabled = true
    }
}

process {
    errorStrategy = { task.attempt <= 2 ? 'retry' : 'terminate' }

    withLabel: fastqc {
        cpus   = 2
        memory = 4.GB
        time   = 1.h
    }

    withLabel: align {
        cpus     = 8
        memory   = 32.GB
        time     = 4.h
        queue    = 'short'
        maxRetries = 2
    }
}
```

Each directive maps directly to a scheduler request. `cpus` becomes the CPU allocation, `memory` becomes the memory reservation, `time` becomes the wall-clock limit, and `queue` selects the partition. The `errorStrategy` block above is a practical tip worth adopting early. A transient node failure at hour three of a ten-hour job should not kill the whole run. Retry logic tells the scheduler to resubmit failed tasks up to twice before giving up.

### Step 5. Submit, Monitor, and Read the Output

Launch the pipeline:

```bash
nextflow run main.nf -profile slurm -with-trace -with-report
```

The `-with-trace` flag writes a `pipeline_trace.txt` file with one row per task, including real memory and time usage. That file is your feedback loop for tuning resource requests. While the run is active, check the scheduler queue:

```bash
squeue -u $USER
```

Expected output:

```
JOBID  PARTITION  NAME          ST  TIME    NODES
10122  short      nf-align_1a   R   3:12    1
10123  short      nf-align_1b   R   3:11    1
10124  short      nf-align_1c   PD  0:00    1
```

Jobs in state R are running. Jobs in state PD are pending, which usually means they are waiting for resources or for upstream tasks to finish. To inspect a finished or failed job:

```bash
sacct -j 10122 -o JobID,State,Elapsed,MaxRSS
```

Expected output:

```
JobID    State   Elapsed   MaxRSS
10122    COMPLETED  04:01:12  28.45G
```

`MaxRSS` is the peak resident set size, the true memory the process used. If it is far below the requested `memory`, lower the request. If the job died, raise it.

### Step 6. Scale Out and Verify With a Worked Calculation

![Calculation showing 640 cores divided by 8 cores per task gives 80 parallel tasks, so 200 samples run in 3 waves of about 12 hours total.](/article-images/illustrations/scaling-bioinformatics-workflows-hpc-scale-out-waves.webp)

Suppose you have 200 samples, each alignment task needs 8 cores, 32 GB of memory, and roughly 4 hours based on your Step 1 measurements. Your cluster has 10 compute nodes with 64 cores each, so 640 cores total.

- Maximum concurrent alignment tasks: 640 cores divided by 8 cores per task equals 80 tasks
- Waves needed: 200 samples divided by 80 per wave rounds up to 3 waves
- Total wall time: 3 waves times 4 hours equals roughly 12 hours
- Serial baseline: 200 samples times 4 hours equals 800 hours

That is the whole point of scaling bioinformatics workflows on HPC, a job that would take over a month run serially finishes in half a day. Once the run completes, verify it. Check the exit status in `sacct`, confirm every sample appears in `pipeline_trace.txt`, and inspect the `.command.err` files for any silent partial output. For multi-sample reports, a quality-control aggregation step at the end of the pipeline makes systematic failures visible across all samples at once rather than sample by sample.

### Step 7. Use Resume Capability When Things Change

If you add samples or fix a bug in one later stage, rerun with the resume flag:

```bash
nextflow run main.nf -profile slurm -resume
```

Nextflow reuses cached outputs for every task whose inputs and code are unchanged and recomputes only what changed. On a 200-sample pipeline where you fixed only the final reporting step, this turns a 12-hour rerun into minutes of compute.

## Storage and Data Movement: The Constraint Nobody Budgets For

Compute gets the attention, but storage quietly decides whether scaled analyses succeed. Setup guides for large-scale sequencing analysis consistently list data storage as one of the defining challenges alongside parallelization and automation [2]. Three habits prevent the most common failures.

First, know your quota structure. Home directories on most clusters hold a few gigabytes and are meant for scripts, not sequencing data. Stage raw reads and large outputs to a project or scratch filesystem. Second, do not assume scratch is permanent. Many clusters purge scratch periodically, so move final results and the pipeline's checkpoint directory to long-term storage. Third, the design of your storage tier matters as much as its size. The UVRI framework in Uganda combined optimized storage and networking configurations with a phased capacity-building strategy to support high-throughput genomic workflows in a resource-limited setting, treating storage as an engineering problem in its own right rather than an afterthought [9].

A concrete example of what happens when storage and portability are designed together comes from cloud-scale genomics. In the PCAWG project, running the analysis locally would have monopolized a typical academic data center for many months and presented major challenges for data storage and distribution, so the project moved containers to the data instead of moving terabytes of data to the containers [8]. The same instinct applies on smaller HPC systems: keep data reads local to the node doing the compute.

## Scaling Well in Resource-Limited Settings

You do not need a top-tier supercomputing center to scale bioinformatics analyses. The UVRI experience is instructive because it documents what works under constraint. The framework there integrates open-source HPC management tools, infrastructure automation, and reproducible configuration management, and it distills the implementation experience into ten practical design and operational rules. Those rules emphasize strategic investment in human capacity, structured planning, leveraging collaborations, adoption of open-source technologies, and service management [9]. The message for any small lab is that people and process scale the pipeline, and hardware follows.

Institutional programs lower the barrier further. The ELIXIR-IT HPC@CINECA pilot, launched in April 2016, offered streamlined access to HPC resources for bioinformaticians through two routes: web front-ends to dedicated workflows, and direct command-line access to the computing systems tailored for bioinformatics data analysis, with reference datasets and tools kept continuously updated [1]. Researchers without a local cluster can look for analogous national node programs, computing-time calls, or shared institutional facilities before purchasing anything.

Domain-specific pipelines also remove the need to build scaling machinery yourself. HPC-T-Assembly, for example, handles de novo transcriptome assembly for large multi-species RNA-seq datasets on HPC infrastructure through a web-oriented interface, generating the parallel computing configuration automatically once the analysis is defined [7]. Similarly, a validated Oxford Nanopore sequencing workflow for mycobacteria used a platform-agnostic bioinformatics pipeline for human read removal and taxonomic assignment, achieving 98.3 percent concordance with Illumina for species classification and a median of zero SNP differences between platforms for the target pathogen after masking, an example of how a well-constructed pipeline keeps results consistent regardless of the underlying sequencing platform [10].

## Common Errors on the Cluster and How to Fix Them

![Flowchart from a failed job through checks on exit code 137, missing tools, partition names and pending state to the matching fix.](/article-images/illustrations/scaling-bioinformatics-workflows-hpc-job-failure-triage.webp)

| Error message | What it means | Fix |
|--|--|--|
| `slurmstepd: error: Exceeded job memory limit` | The task used more memory than the directive requested | Read MaxRSS for the job with sacct, raise the `memory` directive by roughly 20 percent above peak use |
| Process `ALIGN` terminated with an error exit status (137) | Exit code 137 signals the process was killed, almost always an out-of-memory kill | Same as above, the request was too low for the input size |
| `bwa: command not found` in `.command.err` | The tool is not in the container or environment for that task | Confirm the container or conda profile is enabled in `nextflow.config` for that run |
| `Invalid partition name 'short'` | The queue name in the config does not match any partition on your cluster | Run `sinfo` and use an exact partition name |
| Docker daemon connection errors | Docker does not run on HPC nodes for non-root users | Switch the profile to `apptainer.enabled = true` |
| Tasks stuck in state PD indefinitely | Resources are not available, or the request exceeds partition limits | Check partition limits with `sinfo`, lower per-task requests, or ask the administrators about fair-share limits |

## Common Mistakes and Limitations

These are the errors that most often derail scaling bioinformatics workflows on HPC in practice.

**Requesting resources based on guesswork.** Guessing 64 GB of memory for every task wastes allocations and stretches queue times across your whole group. Profile one sample first, as in Step 1, then size requests to measured peak use with headroom.

**Mismatching tool threads to scheduler allocation.** If your Nextflow process asks for 16 CPUs but the tool inside runs single-threaded, 15 cores sit idle for the whole job. Set the tool's thread flag to `${task.cpus}` and confirm from the tool's documentation that it parallelizes that way.

**Underestimating I/O.** A pipeline where 80 concurrent tasks each write tens of gigabytes to the same network filesystem can bottleneck on disk bandwidth rather than compute. Writing intermediate files to local or scratch storage, and reading shared references in read-only mode, keeps throughput up.

**Running everything as one giant script.** A 500-line shell script that processes all samples in a loop cannot resume, cannot retry individual failed samples, and cannot parallelize across the scheduler. Workflow managers exist precisely because this approach stops working at scale [3], [4].

**Ignoring the retry pattern.** Clusters are shared systems, nodes get preempted, and transient filesystem glitches happen. Pipelines without `errorStrategy` retry logic fail wholesale for reasons unrelated to your science.

**Treating software versions as a detail.** Unpinned tool versions are the leading cause of irreproducible reruns. Containers address this directly, which is why container registries with standardized workflow descriptions emerged for large-scale genomics [8].

**Assuming more parallelism always helps.** Some stages, like certain assembly steps, gain little beyond a few cores because the algorithm does not decompose well. De novo transcriptome assembly remains a computationally expensive task even when well parallelized on HPC [7]. Profile before assuming a bigger allocation will shorten wall time.

A final limitation worth stating plainly: cluster conventions vary between institutions, so partition names, module names, and quota policies differ from the examples here. Read your own cluster's documentation, and when a specific project's data or analysis has high stakes for individual conclusions, confirm the analysis design with a bioinformatics core or a senior colleague before committing large allocations.

## Frequently Asked Questions

### How many cores should I request per task?

Request the number of cores your tool can genuinely use, which you determine by profiling a single sample as shown in Step 1. Many bioinformatics tools scale well from 1 to 8 cores and then flatten, so 8 is a common sweet spot for alignment and QC steps while assemblers and some variant callers benefit from more.

### Do I need containers on an HPC cluster?

Yes, in practice. Containers pin exact tool versions so your reruns are reproducible, and they sidestep the permission restrictions that prevent installing software system-wide on shared clusters. Use Apptainer rather than Docker on HPC because Apptainer runs without root privileges.

### Which workflow manager is the best software for researchers new to scaling?

For command-line users on SLURM clusters, Nextflow is the most pragmatic starting point given its executor support, container integration, and resume capability. The choice among Nextflow, CWL, and WDL depends on engine features and, critically, on what your collaborating labs already use [4]. Researchers who prefer graphical interfaces should look at guided platforms instead [3].

### How do I run the same pipeline on hundreds of samples at once?

Structure the pipeline so each sample is an independent task, then let the workflow manager submit them in parallel to the scheduler. Nextflow handles this automatically from a sample sheet, and the scheduler packs concurrent tasks onto nodes up to your resource limits, as in the worked calculation in Step 6.

### What do I do when a job fails with an out-of-memory error?

Check the peak memory the task actually used using `sacct` and the `MaxRSS` column, then raise the `memory` directive above that peak with some headroom and enable the retry strategy so the task resubmits automatically. Exit code 137 is the usual fingerprint of a memory kill.

### Can I scale bioinformatics analyses without writing my own pipeline?

Often yes. Shared facilities provide web front-ends to maintained workflows and direct command-line access with curated tools and reference datasets, as the ELIXIR-IT HPC@CINECA program has done since 2016 [1]. Domain-specific systems such as HPC-T-Assembly for transcriptome assembly also hide the parallel-computing configuration behind a web interface [7].

### How do I estimate how long my full analysis will take on the cluster?

Time one sample, multiply by the number of samples, divide by the number of tasks that can run concurrently given your cluster's core count and your per-task resource request, then add queue-waiting time as a margin. The worked calculation in Step 6 shows the arithmetic for a 200-sample run.

### Is the cloud a better option than an HPC cluster for scaling?

For very large or bursty projects, moving containers to cloud-hosted data can be more practical than moving terabytes of data to local compute, as the PCAWG project demonstrated by processing over 5,800 whole human genomes across 14 cloud and HPC environments [8]. For steady day-to-day analysis volumes, an institutional cluster with a scheduler and shared storage remains the standard approach.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "How many cores should I request per task?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Request the number of cores your tool can genuinely use, which you determine by profiling a single sample before scaling. Many bioinformatics tools scale well from 1 to 8 cores and then flatten, so 8 is a common sweet spot for alignment and QC steps while assemblers and some variant callers benefit from more."
      }
    },
    {
      "@type": "Question",
      "name": "Do I need containers on an HPC cluster?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes, in practice. Containers pin exact tool versions so reruns are reproducible, and they sidestep permission restrictions that prevent installing software system-wide on shared clusters. Use Apptainer rather than Docker on HPC because Apptainer runs without root privileges."
      }
    },
    {
      "@type": "Question",
      "name": "Which workflow manager is the best software for researchers new to scaling?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "For command-line users on SLURM clusters, Nextflow is the most pragmatic starting point given its executor support, container integration, and resume capability. The choice among Nextflow, CWL, and WDL depends on engine features and on what your collaborating labs already use. Researchers who prefer graphical interfaces should look at guided platforms instead."
      }
    },
    {
      "@type": "Question",
      "name": "How do I run the same pipeline on hundreds of samples at once?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Structure the pipeline so each sample is an independent task, then let the workflow manager submit them in parallel to the scheduler. Nextflow handles this automatically from a sample sheet, and the scheduler packs concurrent tasks onto nodes up to your resource limits."
      }
    },
    {
      "@type": "Question",
      "name": "What do I do when a job fails with an out-of-memory error?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Check the peak memory the task actually used using sacct and the MaxRSS column, then raise the memory directive above that peak with headroom and enable the retry strategy so the task resubmits automatically. Exit code 137 is the usual fingerprint of a memory kill."
      }
    },
    {
      "@type": "Question",
      "name": "Can I scale bioinformatics analyses without writing my own pipeline?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Often yes. Shared facilities provide web front-ends to maintained workflows and direct command-line access with curated tools and reference datasets, as the ELIXIR-IT HPC@CINECA program has done since 2016. Domain-specific systems such as HPC-T-Assembly for transcriptome assembly also hide the parallel-computing configuration behind a web interface."
      }
    },
    {
      "@type": "Question",
      "name": "How do I estimate how long my full analysis will take on the cluster?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Time one sample, multiply by the number of samples, divide by the number of tasks that can run concurrently given your cluster's core count and your per-task resource request, then add queue-waiting time as a margin."
      }
    },
    {
      "@type": "Question",
      "name": "Is the cloud a better option than an HPC cluster for scaling?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "For very large or bursty projects, moving containers to cloud-hosted data can be more practical than moving terabytes of data to local compute, as the PCAWG project demonstrated by processing over 5,800 whole human genomes across 14 cloud and HPC environments. For steady day-to-day analysis volumes, an institutional cluster with a scheduler and shared storage remains the standard approach."
      }
    }
  ]
}
</script>

## Sources

1. [ELIXIR-IT HPC@CINECA: high performance computing resources for the bioinformatics community.](https://pubmed.ncbi.nlm.nih.gov/32838759/)
2. [Challenges in the Setup of Large-scale Next-Generation Sequencing Analysis Workflows.](https://pubmed.ncbi.nlm.nih.gov/29158876/)
3. [A scoping review of approaches to evaluating workflow management systems for bioinformatics users.](https://pubmed.ncbi.nlm.nih.gov/42476549/)
4. [Design considerations for workflow management systems use in production genomics research and the clinic.](https://pubmed.ncbi.nlm.nih.gov/34737383/)
5. [BLIT: an R package for seamless integration of command-line bioinformatics tool universe.](https://pubmed.ncbi.nlm.nih.gov/42164079/)
6. [BioImageIT: A novel python-based architecture for reproducible bio-image workflows.](https://pubmed.ncbi.nlm.nih.gov/42405690/)
7. [HPC-T-Assembly: a pipeline for de novo transcriptome assembly of large multi-specie datasets.](https://pubmed.ncbi.nlm.nih.gov/40295976/)
8. [The Dockstore: enabling modular, community-focused sharing of Docker-based genomics tools and workflows.](https://pubmed.ncbi.nlm.nih.gov/28344774/)
9. [A scalable HPC framework for bioinformatics in resource-limited settings: design principles, implementation, and sustainability from the UVRI experience.](https://pubmed.ncbi.nlm.nih.gov/41883143/)
10. [Validation of an optimized Oxford Nanopore sequencing workflow versus Illumina for mycobacteria from primary MGIT culture.](https://pubmed.ncbi.nlm.nih.gov/42622428/)