-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[docs] minor doc tweak to use mp.spawn in example #30381
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
Conversation
| for p in processes: | ||
| p.join() | ||
| nprocs = 2 | ||
| mp.spawn(_run_process, args=(i, (i + 1) % 2, file_name), nprocs) |
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.
It seems we should drop the first arg i in the args tuple? Otherwise, the actual args passed to fn would be i, i, (i + 1) % 2?
The function is called as
fn(i, *args), where i is the process index and args is the passed through tuple of arguments.
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.
Also, specify nprocs as kwarg (after another kwarg).
| .. code:: | ||
| import multiprocessing as mp | ||
| import torch.multiprocessing as mp |
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.
move this line to after import torch?
pietern
left a comment
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.
Thanks for updating, @rohan-varma.
| for p in processes: | ||
| p.join() | ||
| nprocs = 2 | ||
| mp.spawn(_run_process, args=(i, (i + 1) % 2, file_name), nprocs) |
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.
Also, specify nprocs as kwarg (after another kwarg).
pietern
left a comment
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. Thanks, @rohan-varma.
facebook-github-bot
left a comment
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.
@rohan-varma has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
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.
@rohan-varma has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
💊 CircleCI build failures summary and remediationsAs of commit b29bfad:
Detailed failure analysisOne may explore the probable reasons each build failed interactively on the Dr. CI website. 🕵️ 1 new failure recognized by patternsThe following build failures do not appear to be due to upstream breakage:
|
|
Failure is unrelated: |
|
@rohan-varma merged this pull request in a561a84. |
Summary: Per pietern's comment in pytorch#30022, we can make this example launcher a bit simpler by using `torch.multiprocessing`. Pull Request resolved: pytorch#30381 Differential Revision: D19292080 Pulled By: rohan-varma fbshipit-source-id: 018ace945601166ef3af05d8c3e69d900bd77c3b
Per @pietern's comment in #30022, we can make this example launcher a bit simpler by using
torch.multiprocessing.