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 set which GPU to use? #19

Closed
kli-casia opened this issue Jul 13, 2018 · 9 comments
Closed

How to set which GPU to use? #19

kli-casia opened this issue Jul 13, 2018 · 9 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@kli-casia
Copy link

Thank you very much!

@madhawav madhawav self-assigned this Jul 14, 2018
@madhawav
Copy link
Owner

Hi,
Currently this feature is not implemented in YOLO34Py. It would choose the GPU chosen by Darknet. I will look into implementing it in the future.
Thanks

@jantman
Copy link

jantman commented Jul 16, 2018

I was also looking into this, but my really poor C knowledge doesn't make it easy.

It looks like the darknet example script both sets the gpu_index int and calls cuda_set_device(). It appears that this can also be used to disable using the GPU even if the code was compiled for GPU support, by setting the gpu_index to -1

@kli-casia
Copy link
Author

still waiting for this feature, thx

@madhawav
Copy link
Owner

madhawav commented Aug 4, 2018

@kli-nlpr The new merge request #25 has this feature implemented. Can you try it out and let me know whether it works as expected? Then I would merge it to master and do a new release. Unfortunately, I do not have multiple GPUs to test the code.

  1. Uninstall the version you have installed right now (pip uninstall yolo34py-gpu)
  2. Clone the code in merge request Added set_cuda_device #25
  3. Set environment variables GPU=1 and OPENCV=1.
  4. Run pip install .
  5. Use pydarknet.set_cuda_device to change the GPU.

@jantman Thank you for your support. The link you mentioned helped me!

@madhawav madhawav added enhancement New feature or request question Further information is requested labels Aug 4, 2018
@jantman
Copy link

jantman commented Aug 4, 2018

Sure! For what it's worth, I was actually hoping to get this so that (I hope) it would work like the darknet option and setting the GPU device to zero would disable GPU mode and use CPU instead.

I've been having some issues with the detections using yolov3-tiny on GPU, and was looking to write something that comes back after-the-fact and runs my images through the full yolov3 in CPU mode using otherwise the same code.

@madhawav
Copy link
Owner

madhawav commented Aug 4, 2018

Hi @jantman, I believe setting the GPU to zero would make it use the Primary GPU. Why don't you use the version without GPU? (pip install yolo34py instead of pip install yolo34py-gpu).

@jantman
Copy link

jantman commented Aug 4, 2018

@madhawav That's what I'm doing now, but it means that I need to use two different virtualenvs... my goal is to compare the results of the tiny GPU and non-tiny CPU.

For the command-line darknet binary, at least, setting GPU 1 is primary GPU and GPU 0 disables GPU mode.

@madhawav
Copy link
Owner

Option to select GPU is implemented with #25

@woojeonghoon
Copy link

have eight GPUs.

By the way, 'python3 video_demo' only uses the first GPU and nothing else

What should I do??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants