﻿# Slurm GPU allocations and steps: verify the device seen by each task

Separate Slurm job GPU allocation, step resource requests and task-visible device mapping before treating a reserved accelerator as correctly assigned work.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/slurm-allocation-jobstep-gpu-binding/
Language: en

A batch job reserves several GPUs, but concurrent steps unexpectedly wait or select a device the operator did not expect. The allocation succeeded; assignment to steps and tasks still needs verification. Treat the job, step and runtime-visible device as separate scopes.

## Preserve the allocation request

Record job identity, allocated nodes, requested GPU type and quantity, and the site's relevant selection and confinement settings. The [GRES guide](https://slurm.schedmd.com/gres.html) distinguishes a job's generic resources from resources allocated to its steps. Typed and untyped requests must remain consistent across these boundaries. A step that asks for a differently typed resource is not justified merely because a physically suitable device appears somewhere in the parent allocation.

## Inspect each step's resource shape

The GRES guide explains that steps obtain resources from the job allocation and can specify a different count within that scope. Preserve the effective request for each concurrent step rather than assuming every step receives an independent copy of the whole job's reservation. Include CPU-only preparation steps. Resources assigned to one step can affect what is available to another, so waiting does not necessarily indicate that the scheduler forgot a GPU or that physical utilization is high.

## Verify task binding separately

The [srun reference](https://slurm.schedmd.com/srun.html) documents GPU binding and step launch controls. A step's resource count and each task's device mapping are related but different facts. Record task identity, process, node and the actual visible device environment at execution. Do not infer bindings from the batch shell's environment alone. Check application device-selection behavior too, because a framework interpreting a visible ordinal can legitimately select a different host ordinal after confinement or remapping.

## Join telemetry by persistent identity

Match runtime-visible devices to stable device identifiers under the configured environment. The [Slurm/DCGM measurement guide](/journal/slurm-gpu-highwater-dcgm-fairshare-measurement-proposal/) explains why a local ordinal is insufficient for independent telemetry joins. Keep physical memory demand separate from resource accounting, as discussed in [logical accelerator sharing](/journal/fg2-ray-tune-fractional-gpu-vram-isolation/). A valid assignment does not establish a memory partition, a favorable interconnect path or enough capacity for every concurrent model phase.

## Exercise a small multi-step allocation

In a disposable allocation, launch distinguishable steps with explicitly planned subsets and collect their task-level device identities. Include a step that intentionally requests no accelerator. Compare the observed mapping and waiting state with the prewritten resource plan. Acceptance should explain every assigned device and blocked step. This proposed check establishes assignment semantics; it does not assert a measured throughput gain, a completed cluster test or a general guarantee that all steps begin together.

## Retain the hierarchy in the result

Store allocation, step and task evidence together with the actual runtime configuration. Recheck after changes to GPU discovery, cgroup confinement or launch options. A successful job submission is not proof that each process used its intended accelerator. The useful conclusion is an auditable resource path from reservation to task-visible device. It does not establish correctness of model output, isolation from every privileged process or the interpretation of later utilization counters without their own measurement scope.
