Repository navigation
Conversation
Contributor
Author
This was referenced Oct 28, 2026
This branch has not been deployed
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.
Summary:
The single-host RL launcher used to assign physical GPUs starting at zero to every spawned role, even when the controller was launched with CUDA_VISIBLE_DEVICES=4,5,6,7. The bootstrap environment for the trainer and generators replaced that parent setting with 0,1 and 2,3. On a shared devgpu this could place a run on GPUs already in use, making startup appear stuck.
Read the controller-visible GPU list before spawning actors and pass it to PerHostProvisioner. Allocate successive slices of that list to the trainer and generators, preserving the specified order. When CUDA_VISIBLE_DEVICES is absent, retain the previous allocation starting at GPU 0. Reject empty, duplicate, or insufficient device lists before spawning any process. Explicit multi-host mesh allocation retains its existing behavior.
Document the single-host launch pattern and cover default selection, nonzero/reordered devices, extra visible GPUs, malformed lists, and multi-host behavior with CPU tests.
Test Plan:
pytest -q tests/rl/unit_tests/cpu/test_shutdown.py (25 passed)
flake8 torchtitan/rl/actors/monarch/provisioning.py tests/rl/unit_tests/cpu/test_shutdown.py
git diff --check HEAD
Four-GPU toy dense job (from the repository root):
CUDA_VISIBLE_DEVICES=4,5,6,7
VLLM_ALLREDUCE_USE_SYMM_MEM=0
VLLM_ALLREDUCE_USE_FLASHINFER=0
PYTHONPATH="$PWD:${PYTHONPATH:-}"
python -m torchtitan.rl.train
--module torchtitan_recipes.rl.alphabet_sort
--config rl_grpo_qwen3_0_6b_flex
--output-dir outputs/rl/alphabet_sort_0_6b_flex_nccl