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

Applications not using GPU inside docker container #406

Open
kmr1wz opened this issue Mar 12, 2024 · 4 comments
Open

Applications not using GPU inside docker container #406

kmr1wz opened this issue Mar 12, 2024 · 4 comments

Comments

@kmr1wz
Copy link

kmr1wz commented Mar 12, 2024

Hi everyone,
I've been trying to make my GPU be utilized when using any graphical application from inside of the docker container, but with no success so far. Posting this as an issue since I've followed the instructions here to the letter but still failed to make progress.

My setup:

Ubuntu on the host: 20.04.6 LTS
Nvidia driver version: 525.147.05
Cuda version: 12.0
kernel version: 5.15.0-97-generic
nvidia-container-toolskit version: 1.15.0-rc.3
docker version: 24.0.4
nvidia-docker2 version: 2.14.0-1

I've been trying to run the container as follows:
docker run -it --rm --privileged -e DISPLAY=$DISPLAY --runtime=nvidia --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix nvidia/cuda:11.6.2-base-ubuntu20.04 bash

after which, when I run nvidia-smi I do get the expected output:

Tue Mar 12 15:10:54 2024       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.147.05   Driver Version: 525.147.05   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA RTX A300...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   53C    P8    13W /  80W |    552MiB /  6144MiB |     17%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

However, when I install glmark2 and run it it does not utilize the GPU at all. Moreover, after installing nvidia-settings and nvidia-prime I do not see an option to switch nvidia prime to performace mode in the nvidia settings (I should not that after switching that on my host the GPU started being utilized).

Anyone has any ideas on what is going on and what I might be doing wrong? I'd appreciate any help, running out of ideas here.

Thanks in advance,
Michal

@Queequeg92
Copy link

@kmr1wz same issue. Have you found the solution? #426

@kmr1wz
Copy link
Author

kmr1wz commented Mar 25, 2024

Unfortunately no fix yet - will post here if I figure anything out. Would appreciate anyone else having any advice too.

@elezar
Copy link
Member

elezar commented Mar 25, 2024

Note that the graphics or display libraries are only injected if NVIDIA_DRIVER_CAPABILIES include display and / or graphics. Could you try run the container with -e NVIDIA_DRIVER_CAPABILITIES=all?

@kmr1wz
Copy link
Author

kmr1wz commented Mar 25, 2024

@elezar Wow, that was literally it. Now glmark2 is using the driver from within the container. Thanks so much man!

For reference, full command I'm running (with success):

docker run -it --rm     --privileged     -e DISPLAY=$DISPLAY -e NVIDIA_DRIVER_CAPABILITIES=all --runtime=nvidia --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix nvidia/cuda:11.6.2-base-ubuntu20.04 bash

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

3 participants