Skip to main content

accelerator

The accelerator directive defines the number of hardware accelerators (e.g. GPUs) required by each task execution. For example:

process hello {
accelerator 4, type: 'nvidia-tesla-k80'

script:
"""
your_gpu_enabled --command --line
"""
}

The above example requests 4 GPUs of type nvidia-tesla-k80 for each task.

note

This directive is only used by certain executors. Refer to the Executors page to see which executors support this directive.

note

Additional options may be required to fully enable the use of accelerators. When using containers with GPUs, you must pass the GPU drivers through to the container. For Docker, this requires the option --gpus all in the docker run command. For Apptainer/Singularity, this requires the option --nv. The specific implementation details depend on the accelerator and container type being used.

The following options are available:

request: Integer

The number of requested accelerators.

Specifying this directive with a number (e.g., accelerator 4) is equivalent to the request option (e.g., accelerator request: 4).

type: String

The accelerator type.

The meaning of this option depends on the target execution platform. See the platform-specific documentation for more information about the available accelerators:

This option is not supported for AWS Batch. You can control the accelerator type indirectly through the allowed instance types in your Compute Environment. See the AWS Batch FAQs for more information.

On this Page