In this How to install NVIDIA CUDA Toolkit on Fedora 28 Linux tutorial you will learn:
- How to download the latest NVIDIA CUDA repository package.
- How to install the CUDA repository package on Fedora 28.
- How to select and install a CUDA meta package on Fedora 28.
- How to export system path to the Nvidia CUDA binary executables.
- How to confirm and test your CUDA installation.
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||Fedora 28 or higher|
|Software||Existing Nvidia Driver installation on Fedora 28 Linux>|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
How to install NVIDIA CUDA Toolkit on Fedora 28 Linux step by step instructions
- Download the latest Nvidia CUDA repository package
cuda-repo-fedora*.rpm. For example use the
wgetcommand to download the latest CUDA package which is at the time of writing CUDA version 10:
$ wget https://developer.download.nvidia.com/compute/cuda/repos/fedora27/x86_64/cuda-repo-fedora27-10.0.130-1.x86_64.rpmThe package should now be available within your home directory:
$ ls cuda-repo-fedora27-10.0.130-1.x86_64.rpm cuda-repo-fedora27-10.0.130-1.x86_64.rpm
- Install the CUDA repository package. This will enable CUDA repository on your Fedora 28 Linux system:
$ sudo rpm -i cuda-repo-*.rpm
- Select CUDA meta package you wish to install based on the below table. For example the below command will install the entire CUDA toolkit and driver packages:
$ sudo dnf install cuda
Example of Meta Packages Available for CUDA 10.0. Reference: NVIDIA.com Package name Description cuda Installs all CUDA Toolkit and Driver packages. Handles upgrading to the next version of the cuda package when it's released. cuda-10.0 Installs all CUDA Toolkit and Driver packages. Remains at version 10.0 until an additional version of CUDA is installed. cuda-toolkit-10.0 Installs all CUDA Toolkit packages required to develop CUDA applications. Does not include the driver. cuda-tools-10.0 Installs all CUDA command line and visual tools. cuda-runtime-10.0 Installs all CUDA Toolkit packages required to run CUDA applications, as well as the Driver packages. cuda-compiler-10.0 Installs all CUDA compiler packages. cuda-libraries-10.0 Installs all runtime CUDA Library packages. cuda-libraries-dev-10.0 Installs all development CUDA Library packages. cuda-drivers Installs all Driver packages. Handles upgrading to the next version of the Driver packages when they're released.
- Export system path to Nvidia CUDA binary executables. Open
~/.bashrcusing your preferred text editor and add the following two lines:
export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
- Re-login or read your updated
$ source ~/.bashrc
- Confirm the correct CUDA installation:
$ nvcc --version $ nvidia-smi
- Perform further tests by compiling your first CUDA program:
$ mkdir cuda-samples $ cuda-install-samples-10.0.sh cuda-samples/ $ cd cuda-samples/NVIDIA_CUDA-10.0_Samples/0_Simple/clock $ make
AppendixAt the time of writing
gccversions later than 7 are not supported by CUDA. From this reason you might receive the following error when attempting to compile CUDA program:
In file included from /usr/local/cuda-10.0/bin/../targets/x86_64-linux/include/cuda_runtime.h:83, from
: /usr/local/cuda-10.0/bin/../targets/x86_64-linux/include/crt/host_config.h:129:2: error: #error -- unsupported GNU version! gcc versions later than 7 are not supported! #error -- unsupported GNU version! gcc versions later than 7 are not supported! WARNING
Downgrading GCC may in many cases be destructive. Make sure that you know what you are doing.
$ sudo dnf --releasever=27 install gcc-7.3.1-6.fc27