Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage NVIDIA GPU slots in local executor #5850

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bentsherman
Copy link
Member

@bentsherman bentsherman commented Mar 4, 2025

Experimenting with GPU slots for the local executor.

When a pipeline runs multiple GPU-enabled tasks on the same node, each task will see all GPUs and will not try to coordinate which task should use which GPU.

NVIDIA provides the CUDA_VISIBLE_DEVICES / NVIDIA_VISIBLE_DEVICES environment variables to control which tasks can see which GPUs, and users generally have to manage this variable themselves. Some HPC schedulers can assign this variable automatically, or use cgroups to control GPU visibility at a lower level.

Nextflow should be able to manage this variable for the local executor, so that the user doesn't have to add complex pipeline logic to do the same. Running a GPU workload locally on a multi-GPU node is a common use case, so it might be worth doing.

To use this feature, set executor.gpus in your config to the total number of available GPUs. Then Nextflow will automatically set the CUDA_VISIBLE_DEVICES for each task based on the accelerator directive.

To use with containers, you might have to add CUDA_VISIBLE_DEVICES to docker.envWhitelist.

  • I don't remember if CUDA_VISIBLE_DEVICES works with containers or if you have to set NVIDIA_VISIBLE_DEVICES.
  • I don't remember if you have to set --gpus for the docker command in order to use the GPUs at all, that can be set in docker.runOptions

See also: #5570

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Copy link

netlify bot commented Mar 4, 2025

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit 4f7b7ab
🔍 Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/67d554239590420008266872
😎 Deploy Preview https://deploy-preview-5850--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
bentsherman and others added 2 commits March 4, 2025 13:42
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants