Repository navigation
Fix: CPE-19432: Get GPUs per node and use value for tool daemon launches - #2
Merged
Merged
Conversation
added 4 commits
November 20, 2026 20:35
- Print a warning naming the node groups whose GPU count exceeds the per-node --gres request: one srun applies the same --gres=gpu:N to every node, so on uneven allocations tool daemons only get N GPUs on the larger nodes and GPU debugging there may fail. - Split allocation parsing (get_job_node_gpus) from the --gres choice so the warning can name the affected nodes.
…ON_GRES_SPLIT - On uneven allocations, expand the job's node lists (scontrol show hostnames) and look up the GPU count of each node in the sattach step layout, then size --gres=gpu:N from the application's nodes: an application on the larger nodes of a 4+2 job got only 2 GPUs per daemon. - Remove SLURM_GPUS from every daemon srun that carries CTI's --gres: the inherited -G total made single-node and subset daemon steps fail with "Invalid generic resource (gres) specification". - With CTI_SLURM_DAEMON_GRES_SPLIT=1, launch daemons as a heterogeneous step with one component per GPU count, so every node gets all its GPUs; off by default and recommended by the uneven-allocation warning. - Split only CTI's own allocation-based request (tracked, not string-compared) and never inside heterogeneous jobs (HetJobId= in scontrol show job -d), where Slurm rejects heterogeneous steps.
- Return no --gres from get_gres_setting when CTI_SLURM_DAEMON_GPUS_PER_NODE is set: launches without a GPU request fell back to --gres=none, which next to --gpus-per-node gave tool daemons no GPUs. - Document that the knob also replaces a --gres taken from the launcher.
johnlvogt
approved these changes
Nov 23, 2026
| **srun** command. If *CTI_SLURM_DAEMON_GRES* is also set, both are passed. | ||
|
|
||
| - *CTI_SLURM_DAEMON_GRES_SPLIT*: Set to `1` when the job's nodes have | ||
| different numbers of GPUs, to give tool daemons all of the GPUs on each |
Contributor
There was a problem hiding this comment.
I don't think this comma should be here.
|
|
||
| - *CTI_SLURM_DAEMON_GRES_SPLIT*: Set to `1` when the job's nodes have | ||
| different numbers of GPUs, to give tool daemons all of the GPUs on each | ||
| node. CTI then starts tool daemons as a heterogeneous job step with one |
Contributor
There was a problem hiding this comment.
Try this on:
"If set, CTI creates a separate job step component for each distinct gpu count to provide the correct --gres option for each."
Is this not the default behavior because it can't be applied no heterogenous jobs?
Collaborator
Author
There was a problem hiding this comment.
Yes, it doesn't work with heterogeneous jobs. There are some other cases too where it's incompatible, I'd rather put it behind a flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a step requests a total job GPU count (instead of per node), Slurm
allocates the GPUs for each node:
maximum number of GPUs on that node and subtract from total
doesn't have enough GPUs, it fails with "Insufficient GRES"
This is causing CTI tool daemon launches (using `--overlap) to fail, and in turn TotalView MRNet launches to fail on Perlmutter (Slurm 25.11.8). CTI currently has GRES workarounds:
--gresoption,CTI_SLURM_DAEMON_GRESis ignored.--gres=noneunless the user's srun has--gres=gpu:.... The daemons start but can't see any GPUs.Behavior changes
The old
ceil(SLURM_GPUS / SLURM_NNODES)GPU count setting did not fully fix the problem. Indeed, this PR does not fix all problems with GRES GPU allocation, but it gets closer. Nodes can have different numbers of GPUs per nodes, but even with the old workaround, the tool daemon launchescould only supply a fixed number of GPUs per node. This PR implements an additional option to use heterogeneous srun syntax to supply multiple
GPU counts in a single tool daemon launch.
CTI_SLURM_DAEMON_GRES_SPLITdisabled (default)By default, CTI will pick the safe solution and request the minimum number of GPUs per node that satisfies the allocation settings. Depending on whether Slurm ended up allocating an even number of GPUs per node, or uneven, this can either work fine (even allocation), or result in some GPUs not being visible to the tool daemons (uneven allocation).
Even GPUs (e.g. 4+4)
srunwith--gres=gpu:4on every node, and CTI removesSLURM_GPUSfrom thatsrun's environment.Uneven GPUs (e.g. 4+2)
scontrol show job -dwithscontrol show hostnames. Itmatches them against the node names in the step layout (
sattach --layout), and chooses the number of GPUs to request:srunwith--gres=gpu:4, no warning.counts: one
srunwith the smallest count on every node (--gres=gpu:2). Daemons on the larger nodes see only some of that node's GPUs. CTI prints a warning, listing those nodes and recommendingCTI_SLURM_DAEMON_GRES_SPLIT=1, or an even GPU allocation.CTI_SLURM_DAEMON_GRES_SPLIT=1This enables using a heterogeneous job launch to start the tool daemon. It relies on more hostname parsing, so can fail (thus behind the flag), but supports tool daemons running on nodes with an uneven GPU allocation split with full GPU visibility.
Even GPUs (e.g. 4+4)
srunwith--gres=gpu:4and no warning.Uneven GPUs (e.g. 4+2)
srunwith a separate component per count, and removesSLURM_GPUSfrom its environment:srun --nodes=1 --gres=gpu:2 --nodelist=<2-GPU nodes> … : --nodes=1 --gres=gpu:4 --nodelist=<4-GPU nodes> …job launch workaround, it tries the default single smallest GPU request and prints a warning that the flag couldn't be used.
HetJobId=inscontrol show job -d)CTI_SLURM_DAEMON_GRESCode changes
Per-node GPU request from the job allocation
SLURMApprunsscontrol show job -dfor both launch and attach, and turns the per-node GPU counts into a per-node--gres, using the smallest count seen on the nodes:When CTI launches the application itself,
get_gres_setting()returns the request together with a flag if the GRES was from an allocation (i.e. from Slurm, and not calculated by CTI as part of the previous fallback).Later on, it will only apply the split GRES request if the GRES setting
was from CTI.
Optional split GRES request for tool daemon launches
With
CTI_SLURM_DAEMON_GRES_SPLIT=1,generateDaemonLauncherArgv()builds a heterogeneous
sruncommand, one per GPU count, so that it canproperly supply the GPU counts for each specific node (instead of the
global minimum GPU setting without the flag).