Install NVIDIA CUDA Toolkit 11.3 on Fedora 34/33

NVIDIA LogoThis is guide, howto install NVIDIA CUDA Toolkit 11.3 on Fedora 34/33. I assume here that you have installed NVIDIA drivers successfully using my earlier Fedora NVIDIA Drivers Install Guide. You will need NVIDIA 465.xx drivers. As always remember backup important files before doing anything!

Check video version of guide:

1. Install NVIDIA CUDA Toolkit 11.3 on Fedora 34/33

1.1 Download NVIDIA CUDA Toolkit 11.1

Download NVIDIA CUDA Toolkit 11.1 runfile (local) from official NVIDIA CUDA Toolkit download page. Only Fedora 32 version available, but it works on Fedora 33 too.

cd ~/Downloads

wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux.run

1.2 Make NVIDIA CUDA installer executable

chmod +x cuda_11.3*.run

1.3 Change root user

su -
## OR ##
sudo -i

1.4 Make sure that you system is up-to-date and you are running latest kernel

dnf update

After possible kernel update, you should reboot your system and boot using latest kernel:

reboot

1.5 Install needed dependencies

This guide needs following, some NVIDIA CUDA examples might need something else.

dnf install gcc-c++ mesa-libGLU-devel libX11-devel libXi-devel libXmu-devel

## Dependencies for 2_Graphics examples ##
dnf install freeglut freeglut-devel

1.6 Run NVIDIA CUDA Binary and Install NVIDIA CUDA 11.3

You will need NVIDIA Drivers >= 465.xx here, so install NVIDIA 465.xx Drivers first.

/home/<username>/Downdloads/cuda_11.3.1_465.19.01_linux.run

## OR full path / full file name ##

./cuda_11.3.1_465.19.01_linux.run

/path/to/cuda_11.3.1_465.19.01_linux.run

Accept NVIDIA CUDA 11.3 License Agreement

NVIDIA CUDA 11.3 License Agreement

Install NVIDIA CUDA, but uncheck NVIDIA Drivers

You can move here using arrows (Up/Down: Move, Left/Right: Expand, Enter/Space: Select and ‘A’: for Advanced Options)

Select Options -> Samples Options -> Change Writable Samples Install Path -> Set your user home dir

NVIDIA CUDA 11.1 Install

Change /home/<username>/NVIDIA_CUDA-11.3_Samples owner and group:

chown -R username:username /home/<username>/NVIDIA_CUDA-11.1_Samples

1.7 Post Installation Tasks

Make sure that PATH includes /usr/local/cuda-11.3/bin and LD_LIBRARY_PATH includes /usr/local/cuda-11.3/lib64. You can of course do this per user or use some other method, but here is one method to do this. Run following command (copy & paste all lines to console) to create /etc/profile.d/cuda.sh file:

cat << EOF > /etc/profile.d/cuda.sh
pathmunge /usr/local/cuda-11.1/bin before

if [ -z "${LD_LIBRARY_PATH}" ]; then
    LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64
else
    LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64:$LD_LIBRARY_PATH
fi

export PATH LD_LIBRARY_PATH
EOF

Then logout/login (simply close terminal and open it again). Now as normal user and root you should see something like (depends on your system):

[[email protected] ~]$ echo $PATH
/usr/local/cuda-11.1/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/user/.local/bin:/home/user/bin
[[email protected] ~]$ echo $LD_LIBRARY_PATH
/usr/local/cuda-11.1/lib64
[[email protected] ~]$

1.8 Test Your Installation, Compile and Run deviceQuery

As a normal user:

cd /home/<username>/NVIDIA_CUDA-11.3_Samples/1_Utilities/deviceQuery
make
/usr/local/cuda/bin/nvcc -ccbin g++ -I../../common/inc -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -o deviceQuery.o -c deviceQuery.cpp
nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -o deviceQuery deviceQuery.o 
nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
mkdir -p ../../bin/x86_64/linux/release
cp deviceQuery ../../bin/x86_64/linux/release
./deviceQuery 
./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce RTX 2060"
  CUDA Driver Version / Runtime Version          11.3 / 11.3
  CUDA Capability Major/Minor version number:    7.5
  Total amount of global memory:                 5927 MBytes (6214451200 bytes)
  (30) Multiprocessors, ( 64) CUDA Cores/MP:     1920 CUDA Cores
  GPU Max Clock rate:                            1695 MHz (1.70 GHz)
  Memory Clock rate:                             7001 Mhz
  Memory Bus Width:                              192-bit
  L2 Cache Size:                                 3145728 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total shared memory per multiprocessor:        65536 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  1024
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 3 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device supports Managed Memory:                Yes
  Device supports Compute Preemption:            Yes
  Supports Cooperative Kernel Launch:            Yes
  Supports MultiDevice Co-op Kernel Launch:      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.3, CUDA Runtime Version = 11.3, NumDevs = 1
Result = PASS

Thats all!

Please let me know if you have any problems!

19 comments on “Install NVIDIA CUDA Toolkit 11.3 on Fedora 34/33

Leave a Reply to Josef Dostal Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close