Single-process multi-node CPU training#9603
Merged
carmocca merged 23 commits intoLightning-AI:masterfrom Oct 14, 2021
borchero:patch-2
Merged
Single-process multi-node CPU training#9603carmocca merged 23 commits intoLightning-AI:masterfrom borchero:patch-2
carmocca merged 23 commits intoLightning-AI:masterfrom
borchero:patch-2
Conversation
Enable multi-node CPU-only training without spawning
awaelchli
suggested changes
Oct 10, 2021
Contributor
|
Thanks for the PR. LGTM, just a few changes requested. |
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Contributor
Author
|
Implemented the changes, thanks for the pointers @awaelchli :) |
awaelchli
approved these changes
Oct 10, 2021
Contributor
|
Thanks @borchero <3 |
rohitgr7
reviewed
Oct 11, 2021
SkafteNicki
reviewed
Oct 11, 2021
Contributor
Author
|
Don't think the failing test is caused by my changes. |
carmocca
approved these changes
Oct 14, 2021
Codecov Report
@@ Coverage Diff @@
## master #9603 +/- ##
=======================================
- Coverage 93% 89% -4%
=======================================
Files 179 179
Lines 15805 15807 +2
=======================================
- Hits 14648 14029 -619
- Misses 1157 1778 +621 |
rohitgr7
reviewed
Oct 14, 2021
rohitgr7
pushed a commit
to Tshimanga/pytorch-lightning
that referenced
this pull request
Oct 18, 2021
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com> Co-authored-by: thomas chaton <thomas@grid.ai>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Whenever a model is small, it is not necessarily useful to use a GPU. However, one might still benefit from distributing computations for model training across nodes -- especially when you consider that containers are also "nodes".
This PR sets
DistributedType.DDPinstead ofDistributedType.DDP_SPAWNwheneverDistributedType.DDP_CPUis set and only a single process or a single process per node is used.Does your PR introduce any breaking changes? If yes, please list them.
num_nodes > 1and setsnum_processes = Noneon theTrainer,num_processesnow defaults to 1 andDistributedType.DDPis used. Before,num_processeswas set toos.cpu_count()andDistributedType.DDP_SPAWNwas used. However, it is unlikely that people rely on that behavior, especially sincenum_processesdefaults to1.One could decide to keep the old behavior, however, I would argue that it is far more likely to only want a single process when distributing across nodes (think containers).
Fixes #9877
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list: