Edit Info Other
Login

CUDA"

Differences between revisions 43 and 44
Revision 43 as of 2020-05-15 17:06:14
Size: 6788
Comment:
Revision 44 as of 2020-06-26 09:49:29
Size: 7090
Comment:
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
 * RHEL/CentOS 8 {{{  * RHEL/CentOS 8/Fedora {{{
Line 28: Line 28:
 * Fedora 29 (and later) {{{
sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/fedora29/x86_64/cuda-fedora29.repo
sudo dnf clean all
sudo dnf install cuda
}}}
Line 38: Line 33:


 * RHEL/CentOS 8 / Fedora {{{
sudo dnf install https://developer.download.nvidia.com/compute/machine-learning/repos/rhel8/x86_64/nvidia-machine-learning-repo-rhel8-1.0.0-1.x86_64.rpm
sudo dnf install libcudnn7 libcudnn7-devel libnccl libnccl-devel
}}}
Line 79: Line 80:
# GCC9 Works for Fedora 32 and later (default to GCC10) and compatible with cuda-11
dnf copr enable kwizart/cuda-gcc-11 -y
dnf install cuda-gcc cuda-gcc-c++ -y
}}}

# GCC8 Works up to Fedora 31 for cuda-10.1 and later (up to CUDA 11)

Installation

This Howto provides a way to install the official NVIDIA packages for CUDA.

NVIDIA official repositories

These repositories contain versions of CUDA that are parallel installables along with another version.

CUDA Toolkit

Please use the Official link: https://developer.nvidia.com/cuda-downloads

  • RHEL/CentOS 8/Fedora

    sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
    sudo dnf clean all
    sudo dnf -y install cuda
  • RHEL/CentOS 7

    sudo yum-config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
    sudo yum clean all
    sudo yum install cuda
  • RHEL/CentOS 6

    sudo yum-config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel6/x86_64/cuda-rhel6.repo
    sudo yum clean all
    sudo yum install cuda

Machine Learning repository

Please use the official link: https://developer.nvidia.com/nccl/nccl-download

  • RHEL/CentOS 8 / Fedora

    sudo dnf install https://developer.download.nvidia.com/compute/machine-learning/repos/rhel8/x86_64/nvidia-machine-learning-repo-rhel8-1.0.0-1.x86_64.rpm
    sudo dnf install libcudnn7 libcudnn7-devel libnccl libnccl-devel
  • RHEL/CentOS 7

    sudo yum install https://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
    sudo yum install libcudnn7 libcudnn7-devel libnccl libnccl-devel
  • Fedora

    sudo dnf install https://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
    sudo dnf install libcudnn7 libcudnn7-devel libnccl libnccl-devel

TensorRT repository

You can download the TensorRT component using the appropriate version from https://developer.nvidia.com/nvidia-tensorrt-download

This requires to login with the NVIDIA CUDA program subscription.

Legacy NVIDIA 340xx/CUDA 6.5

This repository contains a legacy version of CUDA 6.5 that will works with the NVIDIA 340xx serie

Please use the Official link: https://developer.nvidia.com/cuda-toolkit-65

  • RHEL/CentOS 6

    sudo yum install http://developer.download.nvidia.com/compute/cuda/repos/rhel6/x86_64/cuda-repo-rhel6-6.5-14.x86_64.rpm
    sudo yum install cuda
  • Fedora 20 (and later)

    sudo yum install install http://developer.download.nvidia.com/compute/cuda/repos/fedora20/x86_64/cuda-repo-fedora20-6.5-14.x86_64.rpm
    sudo yum install cuda

Please verify to have a compatible compiler.

Known issues

GCC version

When using a later version of Fedora than what is supported by the NVIDIA CUDA Official repository, you might be unable to compile. You can either:

  • Install an older gcc for dedicated for CUDA from copr (Best).

# GCC9 Works for Fedora 32 and later (default to GCC10) and compatible with cuda-11
dnf copr enable kwizart/cuda-gcc-11 -y
dnf install cuda-gcc cuda-gcc-c++ -y

# GCC8 Works up to Fedora 31 for cuda-10.1 and later (up to CUDA 11) dnf copr enable kwizart/cuda-gcc-10.1 -y dnf install cuda-gcc cuda-gcc-c++ -y }}}

You will need to tell CUDA to use it instead of using the default g++ this can be done for the cuda-samples with:

export HOST_COMPILER=cuda-g++

sudo dnf install https://rpmfind.net/linux/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm
sudo dnf install http://dl.kwizart.net/compat-libgfortran5-8.3.1-1.fc29.noarch.rpm
sudo dnf install devtoolset-8-toolchain

You cannot install the whole devtoolset-8 collection, but the toolchain is enough , then each time you need to build using cuda, you start by

scl run devtoolset-8 bash
gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
exit
gcc --version
gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  • Tweak the /usr/local/cuda*/targets/x86_64-linux/include/crt/host_defines.h to accept the Fedora default compiler. (Not recommended).

Which driver Package

Both "CUDA" and "RPM Fusion" repositories provide the nvidia driver packages. Usually, the package provided by RPM Fusion is higher. But in case you want to avoid the risk, add this:

#/etc/yum.repos.d/cuda.repo
[cuda]
name=cuda
...
exclude=akmod-nvidia*,kmod-nvidia*,*nvidia*,nvidia-*,cuda-nvidia-kmod-common,dkms-nvidia,nvidia-libXNVCtrl

NVIDIA driver higher in CUDA repo

Often when NVIDIA release a newer CUDA version or even in the case of pre-release software the NVIDIA driver is at a higher version than the driver provided by RPM Fusion. There is no way for us to provide a version that will match the newer CUDA requirement "ahead" of any NVIDIA public driver release. With that said, the dependencies can sometime be faked at the RPM level with:

dnf download cuda-drivers
rpm -Uvh cuda-drivers*.rpm --nodeps
dnf update

Please remind to remove the cuda-drivers package when the RPM Fusion provided driver is high enough. Complain to NVIDIA for this bad behaviour, not to us.

NVIDIA provided libOpenCL

NVIDIA only advertise OpenCL 1.2 with the binary driver at this time. As a consequence, they provide an old version of libOpenCL.so.1 which works fine with their binary driver. As most software in Fedora and RPM Fusion are built using a newer libOpenCL, the system linker detects that and issues the following message:

 /usr/local/cuda-9.2/targets/x86_64-linux/lib/libOpenCL.so.1: no version information available (required by ffmpeg)

You can either ignore the message or manually delete the libOpenCL.so.1 provided by NVIDIA (run sudo ldconfig once deleted). Please verify to not have other OpenCL providers that might interfere with NVIDIA OpenCL usage. (looking at /etc/OpenCL/vendors ).

Running blender

Even when only running blender, you need a CUDA compatible compiler as described above. This is because blender will compile the "CUDA Kernels" optimized for your own GPU. You can run blender with:

 scl run devtoolset-7 blender

Once the "CUDA kernels" are compiled, you can run blender normally

References


CategoryHowto

Howto/CUDA (last edited 2023-12-04 18:29:33 by NicolasChauvet)