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

Selecting which GPU to use #39

Open
prybicki opened this issue Apr 15, 2022 · 1 comment
Open

Selecting which GPU to use #39

prybicki opened this issue Apr 15, 2022 · 1 comment
Assignees

Comments

@prybicki
Copy link

prybicki commented Apr 15, 2022

TL;DR: Is it / could it be possible to enforce which GPU will be used (e.g. by env variable)?

I compiled dataviz from sources and ran examples. All of them except gui were displaying blank window.
After some time I discovered DVZ_LOG_LEVEL and noticed the following output:

prybicki@titan:/tmp/datoviz$ ./manage.sh demo mandelbrot                                                                                                                                                               
19:02:28.075 D           vklite.c:0137: found device #0: Intel(R) UHD Graphics (CML GT2)                                                                                                                                                      
19:02:28.075 D           vklite.c:0137: found device #1: NVIDIA GeForce RTX 3060 Laptop GPU                                                                                                                                                   
19:02:28.075 D           vklite.c:0137: found device #2: llvmpipe (LLVM 12.0.0, 256 bits)    

I have a dual-gpu machine, with NVIDIA gpu active (I'm using Linux Mint builtin feature to switch between them, which I guess uses prime). I thought that dataviz may choose the first device (Intel), while the second is active and that causes blank window (?).
I modified vklite.c:0137 to skip gpus 0 and 2. After that, all examples worked correctly!

Therefore, my suggestion is to provide (or document/expose) a way to select which GPU is used. For example, cuda driver (libcuda) respects env variable CUDA_VISIBLE_DEVICES which allows to influence which GPU is selected as the default. Perhaps it is possible to implement similar mechanism in datoviz?

@rossant
Copy link
Contributor

rossant commented Apr 18, 2022

Thank you for the bug report!

  1. The logic for choosing the best GPU automatically might fail in your case. Does the logging output (with level 0) give you some information? I'd be curious to understand why device 1 isn't considered as the "best" GPU on your system. Feel free to investigate if you have some time, I'm happy to help...
  2. In any case, Datoviz should provide an environment variable as you suggest, i.e. DVZ_GPU_INDEX=1 ./myapp. Perhaps this could be implemented directly in dvz_gpu_best() reporting with log_debug() when the automatic GPU selection is overridden by the environment variable. I'll try to do it soon, otherwise please feel free to have a go and propose a PR :)

@rossant rossant self-assigned this Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants