La Debian Stretch ne dispose que de la version 7.5 de CUDA et du pilote 364.19. Ces versions peuvent rapidement sembler insuffisantes pour ceux qui désirent utiliser les dernières fonctionnalités de CUDA 8 ou simplement utiliser les dernières cartes video Nvidia.
Voici la méthode permettant d'installer à partir d'un rétro-portage les paquets Nvidia ainsi que tout l'environnement associé. Au 29 août 2016, il est possible de récupérer la version 367.44 indispensable pour les cartes GTX1080. 11 se trouvant dans l'archive experimental : le module NVIDIA se construit correctement à l'installation par DKMS. L'environnement de développement, le 6.5.19, sera rétroporté directement de l'archive experimental.
/proc
dpkg -l | egrep "nvidia|cuda|cupti|nvtoolsext|nvvm|nvctrl|nvcuvid|curand|cublas|cufft|cudart|cuinj|cusparse|libnpp" | awk '{ print $2 }' | xargs -I '{}' apt-get -y purge '{}' dpkg -l | grep opencl | grep -v openclip | awk '{ print $2 }' | xargs -I '{}' apt-get -y purge '{}'
Il est nécessaire d'insérer les sources des paquets sid et expérimentaux pour disposer de la dernière version de CUDA packagée.
apt-get install -y pbuilder pciutils debhelper quilt libgtk2.0-dev libjansson-dev libvdpau-dev libxv-dev libxxf86vm-dev dh-autoreconf [ $(grep stretch /etc/apt/sources.list | grep deb-src | wc -l) -gt 0 ] && echo "Already present" || echo "deb-src http://ftp.fr.debian.org/debian/ sid main contrib non-free" >> /etc/apt/sources.list [ $(grep sid /etc/apt/sources.list | grep deb-src | wc -l) -gt 0 ] && echo "Already present" || echo "deb-src http://ftp.fr.debian.org/debian/ sid main contrib non-free" >> /etc/apt/sources.list [ $(grep experimental /etc/apt/sources.list | grep deb-src | wc -l) -gt 0 ] && echo "Already present" || echo "deb-src http://ftp.fr.debian.org/debian/ experimental main contrib non-free" >> /etc/apt/sources.list aptitude -y update
export NVIDIAROOT=/root/nvidia-$(date "+%Y%m%d") mkdir -p $NVIDIAROOT/debian cd $NVIDIAROOT apt-get source glx-alternatives apt-get build-dep glx-alternatives -y cd glx-alternatives-* debuild cd .. ls -1 *.deb mv *.deb debian
Les paquets créés sont les suivants :
glx-alternative-mesa_0.7.3_amd64.deb glx-alternative-nvidia_0.7.3_amd64.deb glx-diversions_0.7.3_amd64.deb update-glx_0.7.3_amd64.deb
cd $NVIDIAROOT apt-get source -y nvidia-xconfig nvidia-support nvidia-modprobe libvdpau-dev apt-get build-dep -y libvdpau-dev cd $NVIDIAROOT/libvdpau-* debuild cd .. dpkg -i libvdpau1_*_amd64.deb libvdpau-dev_*_amd64.deb mv *deb debian # Telechargement des composants nvidia-graphics-drivers apt-get source nvidia-graphics-drivers apt-get -y build-dep nvidia-xconfig nvidia-support nvidia-modprobe nvidia-settings nvidia-graphics-drivers
cd $NVIDIAROOT cd nvidia-graphics-drivers-* debuild cd .. ls -1 *.deb mv *.deb debian
Les paquets créés sont les suivants :
libcuda1_367.44-1_amd64.deb libegl1-glvnd-nvidia_367.44-1_amd64.deb libegl1-nvidia_367.44-1_amd64.deb libegl-nvidia0_367.44-1_amd64.deb libgl1-glvnd-nvidia-glx_367.44-1_amd64.deb libgl1-nvidia-glx_367.44-1_amd64.deb libgldispatch0-nvidia_367.44-1_amd64.deb libgles1-glvnd-nvidia_367.44-1_amd64.deb libgles1-nvidia_367.44-1_amd64.deb libgles2-glvnd-nvidia_367.44-1_amd64.deb libgles2-nvidia_367.44-1_amd64.deb libgles-nvidia1_367.44-1_amd64.deb libgles-nvidia2_367.44-1_amd64.deb libglx0-glvnd-nvidia_367.44-1_amd64.deb libglx-nvidia0_367.44-1_amd64.deb libnvcuvid1_367.44-1_amd64.deb libnvidia-cfg1_367.44-1_amd64.deb libnvidia-compiler_367.44-1_amd64.deb libnvidia-eglcore_367.44-1_amd64.deb libnvidia-egl-wayland_367.44-1_amd64.deb libnvidia-encode1_367.44-1_amd64.deb libnvidia-fatbinaryloader_367.44-1_amd64.deb libnvidia-fbc1_367.44-1_amd64.deb libnvidia-glcore_367.44-1_amd64.deb libnvidia-ifr1_367.44-1_amd64.deb libnvidia-ml1_367.44-1_amd64.deb libnvidia-ptxjitcompiler_367.44-1_amd64.deb libopengl0-glvnd-nvidia_367.44-1_amd64.deb nvidia-alternative_367.44-1_amd64.deb nvidia-cuda-mps_367.44-1_amd64.deb nvidia-detect_367.44-1_amd64.deb nvidia-driver_367.44-1_amd64.deb nvidia-driver-bin_367.44-1_amd64.deb nvidia-driver-libs_367.44-1_amd64.deb nvidia-kernel-dkms_367.44-1_amd64.deb nvidia-kernel-source_367.44-1_amd64.deb nvidia-kernel-support_367.44-1_amd64.deb nvidia-legacy-check_367.44-1_amd64.deb nvidia-libopencl1_367.44-1_amd64.deb nvidia-opencl-common_367.44-1_amd64.deb nvidia-opencl-icd_367.44-1_amd64.deb nvidia-smi_367.44-1_amd64.deb nvidia-vdpau-driver_367.44-1_amd64.deb nvidia-vulkan-common_367.44-1_amd64.deb nvidia-vulkan-icd_367.44-1_amd64.deb xserver-xorg-video-nvidia_367.44-1_amd64.deb
cd $NVIDIAROOT/nvidia-modprobe-*/ debuild cd .. ls -1 *.deb mv *.deb debian
Les paquets créés sont les suivants :
nvidia-modprobe_367.18-1_amd64.deb nvidia-modprobe-dbgsym_367.18-1_amd64.deb
apt-get source -y nvidia-settings apt-get build-dep -y nvidia-settings cd $NVIDIAROOT/nvidia-settings-* debuild cd .. ls -1 *.deb mv *.deb debian
Les paquets créés sont les suivants :
libxnvctrl0_346.59-1_amd64.deb libxnvctrl0-dbgsym_346.59-1_amd64.deb libxnvctrl-dev_346.59-1_amd64.deb nvidia-settings_346.59-1_amd64.deb nvidia-settings-dbgsym_346.59-1_amd64.deb
cd $NVIDIAROOT/nvidia-xconfig-*/ debuild cd .. ls -1 *.deb mv *.deb debian
Le paquet créé est le suivant :
nvidia-xconfig_352.79-1_amd64.deb nvidia-xconfig-dbgsym_352.79-1_amd64.deb
cd $NVIDIAROOT/nvidia-support-*/ debuild cd .. ls -1 *.deb mv *.deb debian
Les paquets créés sont les suivants :
nvidia-installer-cleanup_20151021+4_amd64.deb nvidia-kernel-common_20151021+4_amd64.deb nvidia-support_20151021+4_amd64.deb
cd $NVIDIAROOT/debian rmmod nvidia_drm rmmod nvidia_modeset rmmod nvidia sync rmmod -f nouveau dpkg -i nvidia-installer-cleanup_*_amd64.deb dpkg -i glx-diversions_*_amd64.deb update-glx_*.deb glx-alternative-mesa_*_amd64.deb dpkg -i nvidia-support_*_amd64.deb dpkg -i glx-alternative-nvidia_*_amd64.deb dpkg -i nvidia-modprobe_*_amd64.deb dpkg -i nvidia-legacy-check_*_amd64.deb dpkg -i nvidia-alternative_*_amd64.deb dpkg -i libnvidia-glcore_*_amd64.deb dpkg -i libgl1-nvidia-glx_*_amd64.deb apt-get install -y xserver-xorg-core libaudit1 libxkbfile1 x11-xkb-utils xfonts-base xserver-common dpkg -i nvidia-kernel-common_*_amd64.deb dpkg -i nvidia-kernel-source_*_amd64.deb dpkg -i nvidia-kernel-support_*_amd64.deb dpkg -i nvidia-kernel-dkms_*_amd64.deb ls -1 lib*$(dpkg -l | grep nvidia-kernel-dkms | awk '{ print $3 }')*deb | xargs -I '{}' dpkg -i '{}' apt-get -f install dpkg -i xserver-xorg-video-nvidia_* dpkg -i nvidia-vdpau-driver_*_amd64.deb nvidia-driver_*_amd64.deb nvidia-driver-libs_*_amd64.deb nvidia-driver-bin_*_amd64.deb ls *$(dpkg -l | grep nvidia-kernel-dkms | awk '{ print $3 }')*deb | grep -v ^lib | grep -v nvidia-kernel | grep -v libopencl | xargs -I '{}' dpkg -i '{}' dpkg -i nvidia-driver_*deb nvidia-xconfig* nvidia-settings* libxnvctrl* nvidia-smi_* apt-get -f install
cd $NVIDIAROOT apt-get -y source nvidia-cuda-toolkit apt-get -y build-dep nvidia-cuda-toolkit cd nvidia-cuda-toolkit-* debuild cd .. ls -1 *.deb mv *.deb debian
Les paquets créés sont les suivants :
libcublas7.5_7.5.18-3_amd64.deb libcudart7.5_7.5.18-3_amd64.deb libcufft7.5_7.5.18-3_amd64.deb libcufftw7.5_7.5.18-3_amd64.deb libcuinj64-7.5_7.5.18-3_amd64.deb libcupti7.5_7.5.18-3_amd64.deb libcupti-dev_7.5.18-3_amd64.deb libcupti-doc_7.5.18-3_all.deb libcurand7.5_7.5.18-3_amd64.deb libcusolver7.5_7.5.18-3_amd64.deb libcusparse7.5_7.5.18-3_amd64.deb libnppc7.5_7.5.18-3_amd64.deb libnppi7.5_7.5.18-3_amd64.deb libnpps7.5_7.5.18-3_amd64.deb libnvblas7.5_7.5.18-3_amd64.deb libnvrtc7.5_7.5.18-3_amd64.deb libnvtoolsext1_7.5.18-3_amd64.deb libnvvm3_7.5.18-3_amd64.deb nvidia-cuda-dev_7.5.18-3_amd64.deb nvidia-cuda-doc_7.5.18-3_all.deb nvidia-cuda-gdb_7.5.18-3_amd64.deb nvidia-cuda-toolkit_7.5.18-3_amd64.deb nvidia-nsight_7.5.18-3_amd64.deb nvidia-opencl-dev_7.5.18-3_amd64.deb nvidia-profiler_7.5.18-3_amd64.deb nvidia-visual-profiler_7.5.18-3_amd64.deb
apt-get install -y opencl-headers ocl-icd-opencl-dev cd /root/nvidia/debian ls *7.5.18*deb | grep -v opencl | xargs -I '{}' dpkg -i '{}' # Il arrive que l'installeur rale sur nvidia-cuda-toolkit. Si c'est le cas, la commande suivante s'impose apt-get -f install
cd $NVIDIAROOT apt-get -y build-dep pyopencl apt-get -y install python-setuptools python3-setuptools apt-get source pyopencl cd pyopencl-*/ debuild cd .. ls -1 *.deb mv *.deb debian
Les paquets créés sont les suivants :
python3-pyopencl_2015.2.4-1_amd64.deb python3-pyopencl-dbg_2015.2.4-1_amd64.deb python-pyopencl_2015.2.4-1_amd64.deb python-pyopencl-dbg_2015.2.4-1_amd64.deb python-pyopencl-doc_2015.2.4-1_all.deb
Réinstallation du composant ICD associé au périphérique Nvidia
cd /root/nvidia/debian dpkg -i nvidia-opencl-common_*_amd64.deb nvidia-opencl-icd_*_amd64.deb
Il n'est nécessaire de rétroporter la version la plus récente de pycuda, étant dans la même version.
cd $NVIDIAROOT/debian # Les paquets suivants issus de AMD sont necessaires pour le premier et bien utile pour le second apt-get install -y ocl-icd-libopencl1 ocl-icd-dev opencl-headers apt-get install -y amd-opencl-icd amd-clinfo # Les paquets icd standard ocl-icd-opencl-dev ocl-icd-libopencl1 dpkg -i python-pyopencl*.deb python3-pyopencl*.deb
apt-get install -y python-pytest python3-pytest python3-appdirs python-appdirs apt-get install python-pycuda python3-pycuda python-pycuda-doc
Sur une machine équipée de 3 cartes vidéo et 3 implémentations d'OpenCL pour CPU (AMD, Intel, PortableCL)
python /usr/share/doc/python-pyopencl-doc/examples/benchmark.py
=============================================================== Platform name: AMD Accelerated Parallel Processing Platform profile: FULL_PROFILE Platform vendor: Advanced Micro Devices, Inc. Platform version: OpenCL 2.0 AMD-APP (1800.11) --------------------------------------------------------------- Device name: Fiji Device type: GPU Device memory: 4045 MB Device max clock speed: 1000 MHz Device compute units: 64 Device max work group size: 256 Device max work item sizes: [256, 256, 256] Data points: 8388608 Workers: 256 Preferred work group size multiple: 64 Execution time of test: 0.00037168 s Results OK =============================================================== Platform name: AMD Accelerated Parallel Processing Platform profile: FULL_PROFILE Platform vendor: Advanced Micro Devices, Inc. Platform version: OpenCL 2.0 AMD-APP (1800.11) --------------------------------------------------------------- Device name: Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz Device type: CPU Device memory: 128966 MB Device max clock speed: 2309 MHz Device compute units: 32 Device max work group size: 1024 Device max work item sizes: [1024, 1024, 1024] Data points: 8388608 Workers: 256 Preferred work group size multiple: 1 Execution time of test: 0.0192504 s Results OK =============================================================== Platform name: Intel(R) OpenCL Platform profile: FULL_PROFILE Platform vendor: Intel(R) Corporation Platform version: OpenCL 1.2 LINUX --------------------------------------------------------------- Device name: Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz Device type: CPU Device memory: 128966 MB Device max clock speed: 2400 MHz Device compute units: 32 Device max work group size: 8192 Device max work item sizes: [8192, 8192, 8192] /usr/lib/python2.7/dist-packages/pyopencl/__init__.py:63: CompilerWarning: Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more. "to see more.", CompilerWarning) Data points: 8388608 Workers: 256 Preferred work group size multiple: 128 Execution time of test: 0.00310517 s Results OK =============================================================== Platform name: Portable Computing Language Platform profile: FULL_PROFILE Platform vendor: The pocl project Platform version: OpenCL 1.2 pocl 0.10 --------------------------------------------------------------- Device name: pthread-Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz Device type: CPU Device memory: 128966 MB Device max clock speed: 3100 MHz Device compute units: 32 Device max work group size: 1024 Device max work item sizes: [1024, 1024, 1024] Data points: 8388608 Workers: 256 Preferred work group size multiple: 8 Execution time of test: 0.007638 s Results OK =============================================================== Platform name: NVIDIA CUDA Platform profile: FULL_PROFILE Platform vendor: NVIDIA Corporation Platform version: OpenCL 1.2 CUDA 7.5.20 --------------------------------------------------------------- Device name: GeForce GTX 980 Ti Device type: GPU Device memory: 6143 MB Device max clock speed: 1190 MHz Device compute units: 22 Device max work group size: 1024 Device max work item sizes: [1024, 1024, 64] Data points: 8388608 Workers: 256 Preferred work group size multiple: 32 Execution time of test: 0.000522592 s Results OK =============================================================== Platform name: NVIDIA CUDA Platform profile: FULL_PROFILE Platform vendor: NVIDIA Corporation Platform version: OpenCL 1.2 CUDA 7.5.20 --------------------------------------------------------------- Device name: Quadro 600 Device type: GPU Device memory: 1023 MB Device max clock speed: 1280 MHz Device compute units: 2 Device max work group size: 1024 Device max work item sizes: [1024, 1024, 64] Data points: 8388608 Workers: 256 Preferred work group size multiple: 32 Execution time of test: 0.00468445 s Results OK