8

I have cuda-10.1 installed on my PC. Currently, the latest version of cuda is cuda11.0. I am considering using docker cuda version 11.0 without changing the cuda version on my PC. In this case, will the cuda used in the container be 11.0?

musako
  • 897
  • 2
  • 10
  • 26

2 Answers2

13

The CUDA version used in the container will be whatever CUDA version is installed in the container. It doesn't have any connection to the CUDA version installed on the PC (i.e. the base machine). However, the GPU driver version installed on the PC must support the CUDA version you intend to use in the container.

(If you also have CUDA installed on the PC, and want to use it there also, outside of any container use, then the GPU driver version installed on the PC must also be sufficient to support that version of CUDA as well.)

You can see the minimum driver versions required to support specific CUDA versions in table 2 here.

If you're going to use CUDA in a container you are strongly encouraged to use the NVIDIA container toolkit.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
0

Let me add an illustrative example to the accepted answer, the host machine with driver 510.47 and Tesla T4:

(base) maciej.skorski@shared-notebooks:~$ nvidia-smi 
Sat Aug 19 20:10:42 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.47.03    Driver Version: 510.47.03    CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| 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  Tesla T4            Off  | 00000000:00:04.0 Off |                    0 |
| N/A   52C    P0    29W /  70W |      0MiB / 15360MiB |     11%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

I can run an NVIDIA container with higher yet compatible (!) CUDA Toolkit, as documented in the release notes

(base) maciej.skorski@shared-notebooks:~$ docker ps -a
CONTAINER ID   IMAGE                                    COMMAND                  CREATED         STATUS                      PORTS                NAMES
a3b1b391117a   nvcr.io/nvidia/pytorch:23.07-py3         "/opt/nvidia/nvidia_…"   5 minutes ago   Up 5 minutes                6006/tcp, 8888/tcp   torch-maciej
(base) maciej.skorski@shared-notebooks:~$ docker exec -it torch-maciej nvidia-smi
Sat Aug 19 20:12:33 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.47.03    Driver Version: 510.47.03    CUDA Version: 12.1     |
|-------------------------------+----------------------+----------------------+
| 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  Tesla T4            Off  | 00000000:00:04.0 Off |                    0 |
| N/A   52C    P0    29W /  70W |      0MiB / 15360MiB |     11%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
Maciej Skorski
  • 2,303
  • 6
  • 14