Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary NCCL collective coalescing in distributed optimizer #1847

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

timmoon10
Copy link
Contributor

@timmoon10 timmoon10 commented Sep 28, 2024

I've been experiencing some data corruption in distributed optimizer checkpoints because PyTorch is not properly synchronizing the NCCL stream with the main CUDA stream. All indications point to a bug in PyTorch's infrastructure for coalesced NCCL calls and I've isolated it down to cases where we enter PyTorch's _coalescing_manager but do not perform any NCCL collectives. The debugger suggests that _coalescing_manager sets this flag when it enters the context and fails to unset it, resulting in weird behavior in later NCCL calls. I haven't fully bottomed out this bug, but this PR fixes the issue for me.

Signed-off-by: Tim Moon <tmoon@nvidia.com>
Copy link
Collaborator

@crcrpar crcrpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me, thank you

@crcrpar crcrpar merged commit 6102d2c into NVIDIA:master Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants