Skip to content

batch_job: request the GPUs of a task from sbatch - #4547

Merged
btovar merged 1 commit into
cooperative-computing-lab:masterfrom
ZacKienzle2:fix/batch-slurm-gpus
Oct 27, 2026
Merged

btovar merged 1 commit into
cooperative-computing-lab:masterfrom
ZacKienzle2:fix/batch-slurm-gpus

Conversation

@ZacKienzle2

Copy link
Copy Markdown
Contributor

Proposed Changes

The SLURM branch of cluster_set_resource_string in batch_job/src/batch_queue_cluster.c passes the memory, wall time and cores of a task to sbatch, but not its GPUs. A Makeflow rule or a vine_factory --gpus worker that declares GPUs is therefore submitted without a GPU request, and on a cluster that confines devices with cgroups the job runs on a node where it sees no GPU.

This adds --gpus=N when the task declares GPUs, in the same way as the other resources. --gpus is the total number of GPUs that sbatch(1) documents for a job. The HTCondor module already requests GPUs the same way (request_gpus in batch_queue_condor.c).

Checked on a Slurm cluster with a one-rule JX workflow declaring "gpus": 1, run with makeflow --jx -T slurm, with no GPU option in -B:

  • sacct shows ReqTRES and AllocTRES with gres/gpu=1.
  • nvidia-smi -L inside the job lists the allocated GPU.

Merge Checklist

  • make test Run local tests prior to pushing. (0 of 128 tests failed, 9 skipped, built with packaging/build-conda.)
  • make format Format source code to comply with lint policies.
  • make lint Run lint on source code prior to pushing.
  • Manual Update: The SLURM section of the Makeflow manual lists the sbatch options as -N 1 -n 1 -c ${CORES} --mem=${MEMORY}M --time=${WALL_TIME_in_minutes}; it could add --gpus=${GPUS}, which this change passes when a rule requests GPUs. Happy to add it if you would like it in this PR.
  • Type Labels: bugfix
  • Product Labels: Makeflow, TaskVine
  • PR RTM: Mark your PR as ready to merge.

The SLURM branch of cluster_set_resource_string passed the memory, wall time and cores
of a task to sbatch, but not its GPUs, so a task or worker that declared GPUs ran on a
node without one. Pass them as `--gpus`, the total number of GPUs that sbatch(1)
documents for a job, in the same way as the other resources.
@btovar
btovar merged commit 11d8c10 into cooperative-computing-lab:master Oct 27, 2026
13 checks passed
@btovar

btovar commented Oct 27, 2026

Copy link
Copy Markdown
Member

Thanks @ZacKienzle2!

@btovar btovar added this to the 7.17.5 milestone Oct 27, 2026
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