Resource requirements

The keywords “MUST”, “MUST NOT”, “SHOULD”, etc. are to be interpreted as described in RFC 2119.

1 Use of labels in modules

An appropriate resource label MUST be provided for the module as listed in the nf-core pipeline template.

The template (since nf-core/tools:4.1.0) defines two kinds of labels:

  • Bundled labels set CPU, memory and time together. Use exactly one per module: process_single, process_low, process_medium, or process_high.
  • Modifier labels override a single axis and SHOULD be stacked on top of a bundled label: process_long (extends time), process_low_memory (drops memory), process_high_memory (raises memory).

When a process matches more than one withLabel: block, Nextflow applies them in the order they appear in the config file. The order of the label directives in the process itself does not affect precedence. The nf-core template defines bundled labels first and modifier labels after, so modifier labels always overwrite the corresponding bundled value.

2 Source of multiple threads or cores value

If the tool supports multi-threading, provide the appropriate parameter using the Nextflow task variable. For example, --threads $task.cpus.

If the tool does not support multi-threading, consider process_single unless large amounts of RAM are required.

3 GPU acceleration

Modules that support GPU acceleration SHOULD use task.accelerator to detect whether a GPU has been requested. The module SHOULD NOT set the accelerator directive itself; pipelines control GPU allocation by setting accelerator = 1 in their process config.

Tools that accept a GPU count SHOULD pass task.accelerator.request in the command so users can override it via their pipeline config. This value SHOULD NOT be hardcoded.

For container patterns, CUDA version pinning, runtime configuration, and worked examples, see the GPU-capable modules guide.

4 Specifying multiple threads for piped commands

If a module contains multiple tools that support multi-threading (e.g., piping output into a samtools command), assign CPUs per tool:

  • [task.cpus] is supplied unchanged when a process uses multiple cores.
  • If one tool is multi-threaded and another uses a single thread, specify directly in the command itself. For example, with ${task.cpus}.