-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add automatic GPU choice to trainer #1426
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
Add automatic GPU choice to trainer #1426
Conversation
|
Hello @ahendriksen! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-04-10 08:00:40 UTC |
0b98dab to
2d5db37
Compare
|
I don't think the backoff would work because lightning scopes the visible GPUs no? so this needs to work with our auto-gpu scoping. ie: do backoff first to id the GPUs... THEN set the cuda flags |
|
If I understand correctly, this PR does backoff first to id the GPUs and THEN sets the cuda flags.
GPUs are determined here: https://github.com/PyTorchLightning/pytorch-lightning/blob/2d5db37eb7ade5ae1c4a861bfb231c1db08e512e/pytorch_lightning/trainer/trainer.py#L404 Nvidia flags are set a couple lines later: Is there something I am missing? |
|
@ahendriksen makes sense! |
|
what about just |
|
This pull request is now in conflict... :( |
This commit adds the `gpu_choice` parameter to Trainer. By default, this parameter is set to 'manual' which causes no observable difference in behavior. When `gpu_choice` is set to "auto" and `gpus` is an int, then the trainer will automatically allocate the first available GPU. This is especially useful when GPUs are configured to be in "exclusive mode", which means that only one process at a time can use them.
2d5db37 to
0a18f3d
Compare
0a18f3d to
db89a2c
Compare
Codecov Report
@@ Coverage Diff @@
## master #1426 +/- ##
======================================
- Coverage 92% 91% -0%
======================================
Files 66 66
Lines 3509 3542 +33
======================================
+ Hits 3213 3232 +19
- Misses 296 310 +14 |
|
really cool! @ahendriksen |
|
Nice! Thanks for merging. I had fun 🎉 |
* Add automatic GPU choice to trainer This commit adds the `gpu_choice` parameter to Trainer. By default, this parameter is set to 'manual' which causes no observable difference in behavior. When `gpu_choice` is set to "auto" and `gpus` is an int, then the trainer will automatically allocate the first available GPU. This is especially useful when GPUs are configured to be in "exclusive mode", which means that only one process at a time can use them. * Rename gpu_choice -> auto_select_gpus
This commit adds the
gpu_choiceparameter to Trainer. By default,this parameter is set to 'manual' which causes no observable
difference in behavior.
When
gpu_choiceis set to "auto" andgpusis an int, then thetrainer will automatically allocate the first available GPU.
This is especially useful when GPUs are configured to be in "exclusive
mode", which means that only one process at a time can use them.
Before submitting
What does this PR do?
Fixes #951
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Comments:
pick_gpufunctions should be placed indistrib_parts.py. I chose this because determine_root_gpu_device` is defined there.Did you have fun?
Make sure you had fun coding 🙃