-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support DDPPlugin
to be used on CPU
#6208
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6208 +/- ##
=======================================
- Coverage 93% 88% -5%
=======================================
Files 212 212
Lines 13701 13697 -4
=======================================
- Hits 12741 12054 -687
- Misses 960 1643 +683 |
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 like it. Can we maybe raise a Warning for
# this always worked, still works, would use spawn method
Trainer(accelerator="ddp_cpu", num_processes=2)
That this behavior might change in the future in favor of ddp and people should use
Trainer(accelerator="ddp_cpu_spawn", num_processes=2)
instead?
Also in
# this now works too, uses spawn method
Trainer(accelerator="ddp_cpu", num_processes=2, plugins=[DDPSpawnPlugin(find_unused_parameters=True)])
# this now works, uses subprocess ddp
Trainer(accelerator="ddp_cpu", num_processes=2, plugins=[DDPPlugin(find_unused_parameters=True)])
specifying the accelerator is not necessary when specifying the plugin and vice versa, right? So when I do Trainer(num_processes=2, plugins=[DDPPlugin()])
this should work if I don't specify any GPUs?
@awaelchli still in progress? |
I have some problems with RPC tests failing, when I am able to fix the issue, it will be ready for review. |
Removing "Ready to go" as tag as there are still some hangs :( |
Co-authored-by: Kaushik B <[email protected]>
Co-authored-by: Kaushik B <[email protected]>
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 !
What does this PR do?
Before 1.2, the setting
accelerator="ddp_cpu"
would use the DDPSpawnAccelerator and today it is the DDPSpawnPlugin.However, after the refactor we can also support DDPPlugin (non-spawn) to be used with cpu.
This can be interpreted both as a bugfix or a added feature.
Fixes #6121
Related #7810
Introduces a new conftest fixture to all tests to address the following problem:
All ddp tests that init a process group have global side effects, since the process group is a global state in the pytorch library. It means the process group can carry over from one test to the other. This leads to problems when the world size changes or the distributed backend changes from e.g. gloo to nccl, leading to broken pipe and hangs. We address this by force killing the process group after every test. A different teardown approach will be explored in #8080.
Additionally, some test refactoring changes are necessary.
"Special tests" execute one new process per test, but this includes the parameterization. This is not good. We want that each parameterization is it's own new independent run. Otherwise we will just end up with subprocesses trying to launch new processes.
Before submitting
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:
Did you have fun?
No, not on this one.