Repository navigation
[ci] Install numactl in the CI images - #6405
Conversation
TrainingEngine binds each rank to its GPU's NUMA node at startup. torch.numa requires the numactl CLI to be on PATH, and the CI images lack it, so every rank logs a RuntimeError traceback twice and continues without binding.
|
@claude review |
There was a problem hiding this comment.
Verdict: Approve -- please address the item below before merging. This is the right fix at the right layer. The training path already calls NUMA binding, and the CI images were simply missing the binary it checks for.
What this PR does. It adds numactl to the apt packages in .ci/docker/common/install_base.sh. Every CI image is built from .ci/docker/ubuntu/Dockerfile, which runs this script, so the default, :rl, and ROCm (build.sh:29-38) variants all get it. TrainingEngine (training_engine.py:343) and the vLLM/SGLang generator wrappers call maybe_apply_numa_binding (distributed/offloading.py:13). With numactl installed, that call should bind instead of logging the traceback and falling back.
Example.
# before, every rank, twice per rank
E torch/numa/binding.py:257] RuntimeError: numactl CLI is required for NUMA binding
W torch/numa/binding.py:259] Continuing executing without applying NUMA binding ...
# after
I CPU affinity for GPU 0: <n> CPUs in <lo>-<hi>
Must fix
- PR description: the "Summary (human-written)" section is empty. Please fill it in before merging.
Details
- Necessity: the logs quoted in the description show the problem on
main. Makingmaybe_apply_numa_bindingskip quietly whennumactlis missing would hide the same misconfiguration on real clusters, where binding matters for CPU-offloaded moments. Fixing the environment is the smaller and more accurate fix. - Scope: the change is one line with no Python change. Numerics should not change, because CPU affinity doesn't touch GPU computation.
- Once binding actually runs, CI ranks will have a narrower CPU affinity (NODE mode intersects the node's CPUs with the current affinity). On multi-NUMA runners this could slightly change CPU-side dataloader throughput. It won't affect loss.
Not verified: I could not inspect torch.numa.binding here because torch isn't installed in the review environment. That leaves two things open. First, whether binding succeeds on the CI VMs, where the GPU's numa_node in sysfs may be -1. Second, whether that case produces a different fallback warning. The post-build check in the description (the CPU affinity for GPU N line appears and numactl CLI is required is gone) will answer both.
Summary (human-written)
Why
TrainingEnginebinds each rank to its GPU's NUMA node at startup (torchtitan/training_engine.py->maybe_apply_numa_bindingintorchtitan/distributed/offloading.py).torch.numa.bindingrefuses to bind unless thenumactlCLI is onPATH, and none of our CI images install it. So every rank of every integration test logs the same traceback twice, once at error level and once at warning level, then continues without binding.Example (
1 GPU Integration (Fake PG),llama3_fsdp+tp+cp, a passing test):The traceback shows up 164 times in one Fake PG log, 820 times in one A10G Real PG models log and 644 times in one ROCm models log. Nothing fails, but people reading failed CI logs take it for the cause (this happened on #6398).
What changed
.ci/docker/common/install_base.sh: addnumactlto the apt packages. All three images (torchtitan-ubuntu-22.04-clang12, its:rlvariant,torchtitan-rocm-ubuntu-22.04-clang12) run this script.torch only checks that the binary exists (
shutil.which("numactl")). The in-process binding torchtitan uses then callssched_setaffinity, so the container needs no extra privileges.Alternatives considered
maybe_apply_numa_bindingwhennumactlis missing: that would hide the same misconfiguration on real clusters, where binding matters for CPU-offloaded optimizer states (torchtitan/components/optim/CPU_OFFLOADED_MOMENTS.md). CI should run the binding path the recipes use.Numerics
None. CPU affinity doesn't affect GPU computation, so golden losses stay the same.
Testing
.ci/dockerchanges the image tag (git rev-parse HEAD:.ci/docker), so this PR needsciflow/dockerto build the images before the GPU jobs can pull them. After the build, check that the GPU job logs no longer containnumactl CLI is requiredand show theCPU affinity for GPU Nline.