Public | Automated Build

Last pushed: 3 days ago
Short Description
Debian 9 with CUDA Toolkit and cuDNN
Full Description

docker-debian-cuda

docker-debian-cuda is a minimal Docker image built from Debian 9 (amd64) with CUDA Toolkit and cuDNN using only Debian packages.

Although the nvidia-docker tool can run CUDA inside Docker images, it uses yet another wrapper command and is based on Ubuntu images. To make the whole process more transparent, we explicitly expose GPU devices and build from official Debian images. All installations are performed through the Debian package manager, also because the official Nvidia CUDA Toolkit does not support Debian without hacks.

Open source project:

Available tags (based on Debian 9/stretch packages):

  • 8.0.44-3_5.1.10-1_375.39-1, 8.0_5.1, latest [2017-03-27]: CUDA Toolkit <small>(8.0.44-3)</small> + cuDNN <small>(5.1.10-1)</small> + CUDA library <small>(375.39-1)</small> (Dockerfile)
  • 8.0.44-2_5.1.5-1_375.20-4 [2016-12-21]: CUDA Toolkit <small>(8.0.44-2)</small> + cuDNN <small>(5.1.5-1)</small> + CUDA library <small>(375.20-4)</small>
  • 7.5.18-4_5.1.3_361.45.18-2, 7.5_5.1 [2016-09-19]: CUDA Toolkit <small>(7.5.18-4)</small> + cuDNN <small>(5.1.3)</small> + CUDA library <small>(361.45.18-2)</small>
  • 7.5.18-2 [2016-07-20]: CUDA Toolkit <small>(7.5.18-2)</small> + cuDNN <small>(4.0.7)</small> + CUDA library <small>(352.79-8)</small>

Usage

Host system requirements (eg. Debian 8 or 9):

  • CUDA-capable GPU
  • nvidia-kernel-dkms <small>(same as CUDA library, see below for a workaround)</small>
  • optionally nvidia-cuda-mps, nvidia-smi

To utilize your GPUs this Docker image needs access to your /dev/nvidia* devices, like:

$ docker run -it --rm $(ls /dev/nvidia* | xargs -I{} echo '--device={}') gw000/debian-cuda

Host system

List of devices that should be present on the host system:

$ ll /dev/nvidia*
crw-rw---- 1 root video 250,   0 Jul 13 15:56 /dev/nvidia-uvm
crw-rw---- 1 root video 250,   1 Jul 13 15:56 /dev/nvidia-uvm-tools
crw-rw---- 1 root video 195,   0 Jul 13 15:56 /dev/nvidia0
crw-rw---- 1 root video 195, 255 Jul 13 15:56 /dev/nvidiactl

In case /dev/nvidia0 and /dev/nvidiactl are not present, ensure the kernel module nvidia is automatically loaded, properly configured and optimized, and there is a udev rule to create the devices:

$ echo 'nvidia' > /etc/modules-load.d/nvidia.conf
$ cat > /etc/udev/rules.d/70-nvidia.rules << __EOF__
KERNEL=="nvidia", RUN+="/bin/bash -c '/usr/bin/nvidia-smi -L && /bin/chmod 0660 /dev/nvidia* && /bin/chgrp video /dev/nvidia*'"
__EOF__

For OpenCL support the devices /dev/nvidia-uvm and /dev/nvidia-uvm-tools are needed. Ensure the kernel module nvidia-uvm is automatically loaded, and add a custom udev rule to create the device:

$ echo 'nvidia-uvm' > /etc/modules-load.d/nvidia-uvm.conf
$ cat > /etc/udev/rules.d/70-nvidia-uvm.rules << __EOF__
KERNEL=="nvidia_uvm", RUN+="/bin/bash -c '/usr/bin/nvidia-modprobe -c0 -u && /bin/chmod 0660 /dev/nvidia-uvm* && /bin/chgrp video /dev/nvidia-uvm*'"
__EOF__

If you would like to monitor real-time temperatures on your host system use something like:

$ watch -n 5 'nvidia-smi; echo; sensors; for hdd in /dev/sd?; do echo -n "$hdd  "; smartctl -A $hdd | grep Temperature_Celsius; done'

In case your Nvidia kernel driver and CUDA library versions differ an error appears in kernel messages (dmesg) or using nvidia-smi inside the container. Possible solutions:

  • upgrade your Nvidia kernel driver on the host directly from Debian 9 packages: nvidia-kernel-dkms, nvidia-alternative, libnvidia-ml1, nvidia-smi
  • upgrade your Nvidia kernel driver on the host by compiling it yourself
  • inject the correct version of CUDA library into the container (if it is installed on the host) with:
$ docker run -it --rm $(ls /dev/nvidia* | xargs -I{} echo '--device={}') $(ls /usr/lib/x86_64-linux-gnu/{libcuda,libnvidia}* | xargs -I{} echo '-v {}:{}:ro') gw000/debian-cuda

Feedback

If you encounter any bugs or have feature requests, please file them in the issue tracker or even develop it yourself and submit a pull request over GitHub.

License

Copyright © 2016-2017 gw0 [http://gw.tnode.com/] <gw.2017@ena.one>

This library is licensed under the GNU Affero General Public License 3.0+ (AGPL-3.0+). Note that it is mandatory to make all modifications and complete source code of this library publicly available to any user.

Docker Pull Command
Owner
gw000
Source Repository

Comments (0)