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

Fix NCCL test hang #9367

Merged
merged 3 commits into from Jul 7, 2023
Merged

Fix NCCL test hang #9367

merged 3 commits into from Jul 7, 2023

Conversation

rongou
Copy link
Contributor

@rongou rongou commented Jul 6, 2023

The NCCL communicator tests sometimes hang because NCCL kernels are blocking, and mixing with LaunchN calls might cause a deadlock. Synchronizing on the stream before LaunchN seems to fix this issue.

@rongou
Copy link
Contributor Author

rongou commented Jul 6, 2023

@trivialfis

Copy link
Member

@trivialfis trivialfis left a comment

Choose a reason for hiding this comment

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

Maybe we can use the per-thread stream here as a future improvement.

* because NCCL kernels are blocking. The extra CUDA stream synchronization makes sure that the
* NCCL kernels are caught up, thus avoiding the deadlock.
*/
explicit NcclDeviceCommunicator(int device_ordinal, bool needs_sync = false);
Copy link
Member

Choose a reason for hiding this comment

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

Can we avoid the default parameter? Would be better if we have a clear reference to who's asking for sync and who is not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@rongou
Copy link
Contributor Author

rongou commented Jul 6, 2023

You mean per-thread default stream? I'm not sure it'll help here. The issue seems to be creating multiple NCCL communicators in the same process and mixing NCCL kernels with ours.

@trivialfis
Copy link
Member

Thank you for the quick fix!

@trivialfis trivialfis merged commit 15ca12a into dmlc:master Jul 7, 2023
25 checks passed
@rongou rongou deleted the fix-nccl-tests branch September 25, 2023 16:40
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.

None yet

2 participants