Skip to content
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

Fix conditions about using single GPU #841

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sousquared
Copy link

@sousquared sousquared commented Nov 11, 2020

A better condition for single GPU (when your machine has only one GPU)
I found that even if your machine has only one GPU and you don't specify GPU id (e.g. --gpu 0), model is passed to DataParallel.
So I added a condition so that your model is not parallel even when you don't use --gpu option.

elif torch.cuda.device_count() == 1:
        model = model.cuda()
if args.gpu is not None or torch.cuda.device_count() == 1:
    images = images.cuda(args.gpu, non_blocking=True)

@facebook-github-bot
Copy link
Contributor

Hi @sousquared!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@sousquared sousquared changed the title fixed conditions about using single GPU Fix conditions about using single GPU Nov 11, 2020
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@msaroufim
Copy link
Member

@mrshenli @rohan-varma @cbalioglu do we want to deprecate the DP example and create an updated DDP one

@cbalioglu
Copy link

@msaroufim ideally for each DP example we should create a counterpart example that uses DDP. We haven't deprecated DP yet, since we don't have enough resources right now to work on feature parity. However we already encourage our users to migrate to DDP if they can. We would be sending a mixed signal if we had examples covered by DP, but not DDP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants