Align ddp and ddp-spawn strategies in setting up the environment
What does this PR do?
Aligns the regular ddp strategy and the ddp spawn strategy in setting up the environment (through the method setup_environement which is called in the Trainer._run).
Before:
DDP: Setup environment in setup_environment method/hook.
DDPSpawn: At spawn time, in worker_setup function (slightly earlier than setup_environment method/hook
Now:
Both DDP and DDPSpawn set the same variables in setup_environment method.
Before submitting
- [x] Was this discussed/approved via a GitHub issue? (not for typos and docs)
- [x] Did you read the contributor guideline, Pull Request section?
- [x] Did you make sure your PR does only one thing, instead of bundling different changes together?
- [x] Did you make sure to update the documentation with your changes? (if necessary)
- [x] Did you write any new necessary tests? (not for typos and docs)
- [x] Did you verify new and existing tests pass locally with your changes?
- [x] Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)
PR review
Anyone in the community is free to review the PR once the tests have passed. Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
- [x] Is this pull request ready for review? (if not, please submit in draft mode)
- [x] Check that all items from Before submitting are resolved
- [x] Make sure the title is self-explanatory and the description concisely explains the PR
- [x] Add labels and milestones (and optionally projects) to the PR so it can be classified
Did you have fun?
I made sure I had fun coding 🙃
cc @justusschock @awaelchli @rohitgr7 @kaushikb11 @akihironitta
I believe this will be a prerequisite for further consolidation efforts like https://github.com/PyTorchLightning/pytorch-lightning/pull/11021 and https://github.com/PyTorchLightning/pytorch-lightning/pull/11020 by moving up the setup_environment of DDP and TPU spawn
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.
Hey @awaelchli. What is the status on this PR ?
The status is that I'm currently working on this and once #11163 is merged this will pretty much be ready.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.
This pull request is going to be closed. Please feel free to reopen it create a new from the actual master.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.
This pull request is going to be closed. Please feel free to reopen it create a new from the actual master.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.
@awaelchli is this important for Lite? Do you want to apply these changes to the Lite versions already in #14670 and #14675?
@carmocca I would say quite important for #14707. Yes, I can integrate this into the two PRs. The PR was ready long before starting with Lite, I should have pushed harder to get this merged 😅
@awaelchli mind checking the conflicts... :otter:
:tada:
🥳