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

How to run your codes with multiple GPU? #2

Closed
bluer555 opened this issue Jul 19, 2017 · 1 comment
Closed

How to run your codes with multiple GPU? #2

bluer555 opened this issue Jul 19, 2017 · 1 comment

Comments

@bluer555
Copy link

Hi, thnkim!

I'm using your codes to fine tune our face recognition network in pytorch, it works well when using single GPU (gpuDevice=0), I want to know how to run it with multiple GPU?

thanks!

@thnkim
Copy link
Owner

thnkim commented Aug 2, 2017

Hello, sorry for the belated response.

When you call prepareOpenFace(), you can set useMultiGPU=True, then it should use pyTorch's nn.DataParallel(). If you would like to use some specific GPU device(s), you can modify the line model = nn.DataParallel(model) below.

def prepareOpenFace(useCuda=True, gpuDevice=0, useMultiGPU=False):
    model = netOpenFace(useCuda, gpuDevice)
    model.load_state_dict(torch.load(os.path.join(containing_dir, 'openface.pth')))

    if useMultiGPU:
        model = nn.DataParallel(model)

    return model

But, I guess you've already tried this. Did you have an issue that I am not aware?

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

No branches or pull requests

2 participants