nextflow-io / nextflow-io/nextflow
Support for Pyxis
Nobody has claimed this yet.
- Dominant language
- Groovy
- Stars
- 3.5k
- Forks
- 811
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 61
Description
New feature
Add native support for SLURM Pyxis container execution for GPU-enabled workloads
Use case
Nextflow is commonly used on HPC clusters with SLURM job schedulers. Many of these clusters, especially those focused on AI/ML workloads, use NVIDIA's Pyxis extension to run GPU-enabled containers directly through SLURM. Currently, Nextflow has excellent support for Singularity and Docker, but lacks native integration with Pyxis, requiring users to implement manual workarounds that bypass Nextflow's container abstraction.
This feature would benefit researchers and data scientists running GPU-intensive workflows on SLURM clusters where Pyxis is the preferred or only available container runtime. It would enable seamless container execution for deep learning, computational chemistry, and other GPU-accelerated pipelines.
Suggested implementation
-
Add a
pyxisconfiguration block innextflow.configsimilar to existing container engines:pyxis { enabled = true autoMounts = true // Additional Pyxis-specific options } -
Extend the
SlurmExecutorclass to check for Pyxis configuration and modify how container directives are processed:- When a
containerdirective is specified in a process and Pyxis is enabled, translate this to appropriate--container-imageflags - Add container mount handling to ensure work directories are properly accessible
- When a
-
Implement automatic translation of Nextflow's container-related options to Pyxis-specific parameters:
- Map volume mounts to
--container-mounts - Support container working directory with
--container-workdir - Handle other common container options
- Map volume mounts to
-
Ensure compatibility with SLURM array jobs and other advanced SLURM features when using Pyxis containers
-
Add documentation for the new Pyxis integration, with examples showing how to use GPU containers in SLURM environments
Note: An important implementation detail is that Pyxis specifically requires the use of srun to execute containers, unlike other container technologies that can work directly with sbatch. The implementation should handle this distinction automatically so users don't need to manually include srun commands in their process scripts.
Example of current workaround and issues
Here's a minimal example of what we currently need to do to use Pyxis, which is cumbersome and error-prone:
process runInPyxisContainer {
cpus 2
memory '4 GB'
input:
path inputFile
output:
path 'output.txt'
script:
"""
# Need to explicitly capture current directory
CURRENT_DIR=\$(pwd)
# Manually inject srun with container parameters
srun --container-image=pytorch:24.02-py3 --container-mounts=\$CURRENT_DIR:\$CURRENT_DIR --container-workdir=\$CURRENT_DIR bash -c "
python process_data.py $inputFile output.txt
"
"""
}
Key issues I encountered with this approach:
- File paths in symlinks are not properly handled when passed between processes
- Need manual management of mount points for every directory needed
- Hard to debug container startup issues
- No integration with Nextflow's
containerdirective - Process scripts become much more complex with this boilerplate
- When using
clusterOptionsto pass--container-image, it gets sent tosbatchnotsrun, causing failures
A native implementation would let users simply specify container = 'pytorch:24.02-py3' and let Nextflow handle the Pyxis integration automatically.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the SlurmExecutor and the existing container-engine handling, then review the proposed pyxis block in nextflow.config. Done means the container directive can translate to Pyxis options, mounts and working directories work, srun is handled automatically, SLURM array jobs remain compatible, and documentation includes GPU-container examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- hpc
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100