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
Add timeout for master store if clients do not join #111805
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/111805
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit d66d416 with merge base 236472b (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! This behavior is better than a silent fail. Let me import and see internal CI signals before landing
@XilunWu has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@@ -371,7 +372,13 @@ void TCPStore::waitForWorkers() { | |||
const auto elapsed = std::chrono::duration_cast<std::chrono::seconds>( | |||
std::chrono::steady_clock::now() - start); | |||
if (timeout_ != kNoTimeout && elapsed > timeout_) { | |||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting we didn't have timeout error previously?
break; | ||
C10_THROW_ERROR( | ||
DistStoreError, | ||
fmt::format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love fmt format as well. But someone trying to do this in #107268 had the PR reverted. I am not sure if this PR will have the same issue, I added the ci flag here.
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Currently, if the master_store does not have all clients join in the `timeout` time, it will just continue silently which could lead to errors down the road. However, if a client does not connect with the master within the specified time then an exception will be raised. This change will have master_store error out if not all clients have joined, making server and client consistent with each other. Since this is changing the default behavior of master store I am open to suggestions. Example: ```python import torch.distributed as dist import torch.multiprocessing as mp from datetime import timedelta def main(rank, world_size): if rank == 0: print("creating store") # world size is 2 so this eventually times out store = dist.TCPStore("localhost", 1234, 2, True, timeout=timedelta(seconds=5)) print("finished creating store") if __name__ == "__main__": world_size = 2 mp.spawn(main, (world_size,), nprocs=world_size) ``` Previous ``` print("creating store") print("finished creating store") ``` Now ``` print("creating store") torch.distributed.DistStoreError: Timed out after 6 seconds waiting for workers. 1/2 workers joined. ``` Pull Request resolved: pytorch#111805 Approved by: https://github.com/XilunWu, https://github.com/fduwjj
Currently, if the master_store does not have all clients join in the `timeout` time, it will just continue silently which could lead to errors down the road. However, if a client does not connect with the master within the specified time then an exception will be raised. This change will have master_store error out if not all clients have joined, making server and client consistent with each other. Since this is changing the default behavior of master store I am open to suggestions. Example: ```python import torch.distributed as dist import torch.multiprocessing as mp from datetime import timedelta def main(rank, world_size): if rank == 0: print("creating store") # world size is 2 so this eventually times out store = dist.TCPStore("localhost", 1234, 2, True, timeout=timedelta(seconds=5)) print("finished creating store") if __name__ == "__main__": world_size = 2 mp.spawn(main, (world_size,), nprocs=world_size) ``` Previous ``` print("creating store") print("finished creating store") ``` Now ``` print("creating store") torch.distributed.DistStoreError: Timed out after 6 seconds waiting for workers. 1/2 workers joined. ``` Pull Request resolved: pytorch#111805 Approved by: https://github.com/XilunWu, https://github.com/fduwjj
Currently, if the master_store does not have all clients join in the `timeout` time, it will just continue silently which could lead to errors down the road. However, if a client does not connect with the master within the specified time then an exception will be raised. This change will have master_store error out if not all clients have joined, making server and client consistent with each other. Since this is changing the default behavior of master store I am open to suggestions. Example: ```python import torch.distributed as dist import torch.multiprocessing as mp from datetime import timedelta def main(rank, world_size): if rank == 0: print("creating store") # world size is 2 so this eventually times out store = dist.TCPStore("localhost", 1234, 2, True, timeout=timedelta(seconds=5)) print("finished creating store") if __name__ == "__main__": world_size = 2 mp.spawn(main, (world_size,), nprocs=world_size) ``` Previous ``` print("creating store") print("finished creating store") ``` Now ``` print("creating store") torch.distributed.DistStoreError: Timed out after 6 seconds waiting for workers. 1/2 workers joined. ``` Pull Request resolved: pytorch#111805 Approved by: https://github.com/XilunWu, https://github.com/fduwjj
Currently, if the master_store does not have all clients join in the
timeout
time, it will just continue silently which could lead to errors down the road. However, if a client does not connect with the master within the specified time then an exception will be raised. This change will have master_store error out if not all clients have joined, making server and client consistent with each other.Since this is changing the default behavior of master store I am open to suggestions.
Example:
Previous
Now