Install CUDA and CUDNN On Windows & Linux - by Techzizou - Geek Culture - Medium
Install CUDA and CUDNN On Windows & Linux - by Techzizou - Geek Culture - Medium
com/geekculture/install-cuda-and-cudnn-on-windows-linux-52d1501a8805
-- 1
CONTENTS
( For this Tutorial, I will download and install CUDA 11.0. You can the latest
CUDA toolkit and its corresponding cuDNN file. This is just for
demonstration )
Next, choose any installer type to download. I have downloaded the exe
(local) type installer.
You will then see the installation instructions using the base installer
which is 2.7 GB in size. Once downloaded, click on the exe file and follow
on-screen prompts.
When the setup starts, select a location to extract the installer. Once that is
done the CUDA installer will start. Over there, choose Express installation
and click on Next. This will install the CUDA Toolkit on your system in the
location C:\Program Files\NVIDIA GPU Computing Toolkit.
Next, make sure to check if your Environment variables have the path to
CUDA as shown in the image. (It should automatically add the second path)
If it doesnt then manually add them to the System variables.
Since I have CUDA 11.0.1, I will download cuDNN 8.0.5 for CUDA 11.0
Click on cuDNN 8.0.5 and select cuDNN Library for Windows (x86).
Next, it will ask you to log in. Create an Nvidia account or sign in using
Google or Facebook. Once logged in you can download the cuDNN.
Download and extract it.
Copy the contents of the cuda folder inside the cuDNN folder to the path
where we installed CUDA in step 1 above. (We need the contents of the bin,
include & lib folders from cuDNN to be inside the bin, include and lib
folders of the CUDA directory)
TO THIS FOLDER
Finally, just like we did for CUDA, we have to set the Environment variable
for cuDNN as well. See pic below.
Set System variable with the name CUDNN to point to the bin, include and
lib folders which we copied into the CUDA directory. Also, add these same
paths to the Path System variable.
NOTE: Make sure to add these paths to both the CUDNN and Path System
variables.
That’s it. We have successfully set up CUDA and cuDNN on our Windows
System.
LET’S BEGIN
(For this Tutorial, I will download and install CUDA 11.0. You can the latest
CUDA toolkit and its corresponding cuDNN file. This is just for
demonstration.)
You will then see a few commands in the installation instructions for the
base installer.
Next, open a terminal.
Firstly, run the following commands to update and upgrade all the
packages on your Ubuntu.
Next, install the NVidia driver compatible with your CUDA version. For
CUDA 11.0 the minimum driver version for Linux is >= 450.36.06.
(You can read about the minimum driver versions required here on the links
given below.)
https://web.archive.org/web/20240425222325/https://docs.nvidia.com/deploy/
cuda-compatibility/index.html
https://web.archive.org/web/20240425222325/https://docs.nvidia.com/cuda/c
uda-toolkit-release-notes/index.html
Next, create a folder and run the commands from the installation
instructions for the base installer.
cd ~
mkdir installers
cd installers/
wget
https://developer.download.nvidia.com/compute/cuda/11.0.3/local_insta
llers/cuda_11.0.3_450.51.06_linux.run
sudo sh cuda_11.0.3_450.51.06_linux.run
When the setup starts accept the EULA agreement, then on the next
screen uncheck the NVidia driver option since we have already installed
it manually earlier, and finally press Enter to install CUDA.
You’ll see a summary at the end of the CUDA installation as shown below.
Next, open the bashrc script file using the following command.
nano ~/.bashrc
source ~/.bashrc
That’s it! We have successfully installed CUDA on our system. Run sudo
reboot to restart your system for the new changes to take effect. After
ubuntu restarts, you can confirm your CUDA installation by running nvcc -V
and nvidia-smi commands.
Since I have CUDA 11.0.1, I will download cuDNN 8.0.5 for CUDA 11.0
Click on cuDNN 8.0.5 and select cuDNN Library for Linux (x86_64).
NOTE: You can check your architecture using the command uname -m in a
terminal.
Next, it will ask you to log in. Create an Nvidia account or sign in using
Google or Facebook. Once logged in you can download the cuDNN file.
Unzip the cuDNN zip file using the following command. You will see a
folder named cuda with include and lib64 sub-folders in it after unzipping
this.
Next, we have to copy the contents of these sub-folders to the path where
we installed CUDA in step 1 above.
We need the contents of the include & lib64 folders from cuDNN to be
inside the include and lib64 folders of the CUDA directory (where we
installed CUDA shown in step 1 above). Run the following commands:
cd cuda
sudo cp -P lib64/* /usr/local/cuda/lib64/
sudo cp -P include/* /usr/local/cuda/include/
That’s it. We have successfully set up CUDA and cuDNN on our Linux Ubuntu
18.04 system.
References
https://web.archive.org/web/20240425222325/https://developer.nvidia.com/
Cuda Cudnn Machine Learning AI
Help Status About Careers Blog Privacy Terms Text to speech Teams