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 train on multi GPU #148

Closed
KaleidoZhouYN opened this issue Nov 10, 2017 · 3 comments
Closed

How to train on multi GPU #148

KaleidoZhouYN opened this issue Nov 10, 2017 · 3 comments

Comments

@KaleidoZhouYN
Copy link

Hi:
I have trained with your code on single GPU and get a pretty nice result,excellent job!!!!

also I met something trouble when i want to accelerate with Multi GPU:

multigpu

And the source code with multiGPU makes me confused:
options/base_options.py: if len(self.opt.gpu_ids) > 0:
options/base_options.py: torch.cuda.set_device(self.opt.gpu_ids[0])

Any advice?Thank you very much

@junyanz
Copy link
Owner

junyanz commented Nov 10, 2017

You can set the gpu_ids as 0,1,2. len(self.opt.gpu_ids) > 0
checks if there are more than one gpu ids.
torch.cuda.set_device(self.opt.gpu_ids[0]) sets the main device as the first gpu.
See here for more discussion. The multi-GPU code should work with instancenorm. We haven't implemented the synchronized batchnorm as mentioned here

@KaleidoZhouYN
Copy link
Author

@junyanz Yes,I append the args --gpu_ids=0,1,2 and did not change the type of "norm".
will there be some trouble with pytorch version or something else?

@junyanz
Copy link
Owner

junyanz commented Nov 10, 2017

it should be fine. You can see which norm you are using, from the output log.

@junyanz junyanz closed this as completed Nov 10, 2017
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