Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Select gpu ID #80

Closed
yaoliUoA opened this issue Oct 31, 2018 · 1 comment
Closed

Select gpu ID #80

yaoliUoA opened this issue Oct 31, 2018 · 1 comment

Comments

@yaoliUoA
Copy link

❓ Questions and Help

Hi

How to select gpu IDs to run experiments? I have multiple experiments to run on different gpus. It is not clear how to select gpu ID in the config file and there is no documentation about this. I think it is better to
add a "gpu id" option in config file.

@fmassa
Copy link
Contributor

fmassa commented Oct 31, 2018

Hi,

The recommended way of selecting the GPU ids is to use the environment variable CUDA_VISIBLE_DEVICES.

So you'd run your experiments as follows:

CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 tools/train_net.py --config-file configs/e2e_faster_rcnn_R_50_FPN_1x.yaml
CUDA_VISIBLE_DEVICES=2,3 python -m torch.distributed.launch --nproc_per_node=2 tools/train_net.py --config-file configs/e2e_faster_rcnn_R_50_FPN_1x.yaml
CUDA_VISIBLE_DEVICES=4,5,6,7 python -m torch.distributed.launch --nproc_per_node=4 tools/train_net.py --config-file configs/e2e_faster_rcnn_R_50_FPN_1x.yaml
CUDA_VISIBLE_DEVICES=0 python tools/train_net.py --config-file configs/e2e_faster_rcnn_R_50_FPN_1x.yaml

Because of that, I believe it's better not to add any option in the cfg to select the GPU ids.

But it would be a good idea to have a note in the README explaining this. Would you be willing to send a PR?

Given that the solution I mentioned is the best one I believe, I'm closing this issue. Please let me know if you have further questions.

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

No branches or pull requests

2 participants