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

process_group: wait for futher_thread join before creating new one #68

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

dwancn
Copy link
Contributor

@dwancn dwancn commented Jan 13, 2025

This modified the configure behavior in ProcessGroupBaby so that we wait for the futher thread to be terminated before we create new ones. This fixed a race condition where futher queue might be closed while futher thread was still trying to get item from it.

Test plan:
Added test cases for reconfiguring ProcessGroupBaby and included assertions to make sure internal state is set as expected.

@facebook-github-bot
Copy link

Hi @dwancn!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 13, 2025
Copy link
Member

@d4l3k d4l3k left a comment

Choose a reason for hiding this comment

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

Would also be nice to add a PR description and test plan as well

Thanks for contributing!

torchft/process_group.py Outdated Show resolved Hide resolved
torchft/process_group.py Outdated Show resolved Hide resolved
@dwancn dwancn requested a review from d4l3k January 15, 2025 02:52
Copy link
Member

@d4l3k d4l3k left a comment

Choose a reason for hiding this comment

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

Changes look good but looks like lint is failing

@dwancn
Copy link
Contributor Author

dwancn commented Jan 17, 2025

Changes look good but looks like lint is failing

thanks a lot. fixed the lint issue.

@dwancn dwancn requested a review from d4l3k January 21, 2025 10:56
@d4l3k
Copy link
Member

d4l3k commented Jan 22, 2025

@dwancn lint is still failing -- are you using lintrunner?

CONTRIBUTING.md has details on how to run this locally

self.assertNotEqual(futher_queue_1, futher_queue_2)
self.assertNotEqual(p_1, p_2)

# pyre-ignore[16]: optional
Copy link
Member

Choose a reason for hiding this comment

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

FYI in the future the easier thing to do is to just assert that it's not None after you grab it above

i.e.

futher_thread_1 = ...
assert futher_thread_1 is not None

...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! Updated the patch again with suggested changes. Fixed some typos as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW, I found I was unable to run lintrunner -a directly as suggested by CONTRIBUTING.md. pyre check works for me.

Copy link
Member

Choose a reason for hiding this comment

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

@dwancn can you open an issue for that? Good to know if there's any issues with it.

Not great to having to have multiple back and forths just for some small lint issues and lintrunner usually solves that pretty easily

@d4l3k d4l3k merged commit e177f9c into pytorch:main Jan 27, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants