fix: fix sft-llama3.1-70b-8n8g-tp4pp2-long-megatron - #3073
Merged
Conversation
Signed-off-by: Yuki Huang <yukih@nvidia.com>
Contributor
Author
|
/ok to test 855a7f8 |
terrykong
approved these changes
Jul 6, 2026
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
Restore
torch.distributed.init_process_group("nccl")withoutdevice_id=.device_id=was added in #2355 and empirically slows downsft-llama3.1-70b-8n8g-tp4pp2-long-megatrontraining. Removing it restores throughput.torch.cuda.set_device(local_rank)is already called inMegatronPolicyWorker.__init__beforesetup_distributed(), so device binding is unaffected.Yellow: before #2355. Blue: after #2355, before this PR. Red: this PR.

Tests
Validated these tests passed:
sft-llama3.1-70b-8n8g-tp4pp2-long-megatrongrpo-llama3.2-1b-instruct-1n8g-megatron_generation(added in 2355)grpo-llama3.2-1b-instruct-2n8g-megatron_generation-noncolocated(added in 2355)grpo-nanov3-30BA3B-2n8g-megatron_generation(added in 2355)This test has unrelated error:
grpo-nanov3-30BA3B-2n8g-megatron_generation-async-gym(added in 2355)Concrete differences from PyTorch/NCCL docs
Passing
device_id=toinit_process_grouphas two documented effects and one known runtime regression:ncclCommInit*runs insideinit_process_group()instead of lazily on the first collective. Only benefit is earlier NCCL error reporting.ncclCommSplitinstead ofncclCommInitRankConfig. However, PyTorch does not setsplitShare=1on the split config, so:new_group()calls can OOM (see pytorch#129865).device_id=causes NCCL to randomly hang during communications, tracked in pytorch#153960. torch 2.6 was fine. Workaround is to omitdevice_id=.Under the current PyTorch implementation there is no measurable benefit to passing
device_id=for training workloads, and it triggers the hang regression.