-
Notifications
You must be signed in to change notification settings - Fork 160
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
Properly cleanup processes and queues for MPRS and Fix pause
for prefetch (#1075)
#1096
Closed
Conversation
This file contains 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
…efetch (pytorch#1075) Summary: Fixes issue about `MPRS.finalize` when `dataloader2.shutdown()` is called ### Changes - DataLoader2 should always clean up `datapipe_iter` at shutdown - Guard `MPRS` to finalize once - Fix the problem of `ConnectionError` when DataLoader early exits - This is caused by `queue` is joined when main/worker/dispatching process exits. No more request/response can be passed across processes. - Consumer process shouldn't join the `req_queue` at exit to make sure producer process can still access the remaining request. And, consumer will close `req_queue` after clean up to prevent any further request sent to queue. - Produce process shouldn't join the `res_queue` at exit to make sure consumer process can still access response. And, producer will close `res_queue` after clean up to prevent any further response sent to queue. - Main (Consumer) <-> Worker (Producer) - Worker (Consumer) -> Dispatching (Producer) - Fix `pause` API for DataLoader2 - Invoke `pause` lazily until the `limit+1` iteration is reached to align with python's iterator behavior. - Make `prefetch.pause` blocking unless there might be potential racing issue. Main thread is paused but prefetch worker is still trying to fetch data from `iter`. - Add tests to validate Pull Request resolved: pytorch#1075 Differential Revision: D44168655 Pulled By: ejguan fbshipit-source-id: 4fa8c34438414cad7f46527355eb0d51866e6b15
This pull request was exported from Phabricator. Differential Revision: D44168655 |
This is the reland of #1075. To fix the internal test failures, I have to remove the optional |
NivekT
approved these changes
Mar 17, 2023
NivekT
pushed a commit
that referenced
this pull request
Apr 19, 2023
…efetch (#1096) Summary: Pull Request resolved: #1096 Fixes issue about `MPRS.finalize` when `dataloader2.shutdown()` is called ### Changes - DataLoader2 should always clean up `datapipe_iter` at shutdown - Guard `MPRS` to finalize once - Fix the problem of `ConnectionError` when DataLoader early exits - This is caused by `queue` is joined when main/worker/dispatching process exits. No more request/response can be passed across processes. - Consumer process shouldn't join the `req_queue` at exit to make sure producer process can still access the remaining request. And, consumer will close `req_queue` after clean up to prevent any further request sent to queue. - Produce process shouldn't join the `res_queue` at exit to make sure consumer process can still access response. And, producer will close `res_queue` after clean up to prevent any further response sent to queue. - Main (Consumer) <-> Worker (Producer) - Worker (Consumer) -> Dispatching (Producer) - Fix `pause` API for DataLoader2 - Invoke `pause` lazily until the `limit+1` iteration is reached to align with python's iterator behavior. - Make `prefetch.pause` blocking unless there might be potential racing issue. Main thread is paused but prefetch worker is still trying to fetch data from `iter`. - Add tests to validate Pull Request resolved: #1075 Reviewed By: NivekT Differential Revision: D44168655 Pulled By: ejguan fbshipit-source-id: fdfee5c27b512b5c0d5308e53a81b1cb2db70a43
ejguan
added a commit
that referenced
this pull request
Apr 20, 2023
…efetch (#1096) Summary: Pull Request resolved: #1096 Fixes issue about `MPRS.finalize` when `dataloader2.shutdown()` is called ### Changes - DataLoader2 should always clean up `datapipe_iter` at shutdown - Guard `MPRS` to finalize once - Fix the problem of `ConnectionError` when DataLoader early exits - This is caused by `queue` is joined when main/worker/dispatching process exits. No more request/response can be passed across processes. - Consumer process shouldn't join the `req_queue` at exit to make sure producer process can still access the remaining request. And, consumer will close `req_queue` after clean up to prevent any further request sent to queue. - Produce process shouldn't join the `res_queue` at exit to make sure consumer process can still access response. And, producer will close `res_queue` after clean up to prevent any further response sent to queue. - Main (Consumer) <-> Worker (Producer) - Worker (Consumer) -> Dispatching (Producer) - Fix `pause` API for DataLoader2 - Invoke `pause` lazily until the `limit+1` iteration is reached to align with python's iterator behavior. - Make `prefetch.pause` blocking unless there might be potential racing issue. Main thread is paused but prefetch worker is still trying to fetch data from `iter`. - Add tests to validate Pull Request resolved: #1075 Reviewed By: NivekT Differential Revision: D44168655 Pulled By: ejguan fbshipit-source-id: fdfee5c27b512b5c0d5308e53a81b1cb2db70a43
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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
topic: improvements
topic category
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:
Fixes issue about
MPRS.finalize
whendataloader2.shutdown()
is calledChanges
datapipe_iter
at shutdownMPRS
to finalize onceConnectionError
when DataLoader early exitsqueue
is joined when main/worker/dispatching process exits. No more request/response can be passed across processes.req_queue
at exit to make sure producer process can still access the remaining request. And, consumer will closereq_queue
after clean up to prevent any further request sent to queue.res_queue
at exit to make sure consumer process can still access response. And, producer will closeres_queue
after clean up to prevent any further response sent to queue.pause
API for DataLoader2Invoke(Breaking internal tests)pause
lazily until thelimit+1
iteration is reached to align with python's iterator behavior.prefetch.pause
blocking unless there might be potential racing issue. Main thread is paused but prefetch worker is still trying to fetch data fromiter
.Pull Request resolved: #1075
Differential Revision: D44168655
Pulled By: ejguan