CUDA & CUDNN FOR WINDOWS
STEP 1) Download and install CUDA Toolkit
Go to https://developer.nvidia.com/cuda-downloads to download the latest CUDA Toolkit.
You can also download previous versions from the Archive of Previous CUDA Releases under the Resources section on the same page given above.
( 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 )
Go to Archive of Previous CUDA Releases and click on CUDA Toolkit 11.0 Update1.
- On the next page, first, choose your operating system as Windows.
- Next, choose your Architecture and version. For my system, the architecture is x86_64 as I have a 64-bit system, and the version of windows is 10. ( To know your system’s architecture, in Windows, go to Control Panel -> System and Security -> System. It will be mentioned as system type )
- 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.
- CUDA_PATH — -> C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0
- CUDA_PATH_V11_0 — → C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0
STEP 2) Download and setup CUDNN
Go to https://developer.nvidia.com/cudnn to download the latest version of CUDNN for the latest CUDA toolkit version OR go to https://developer.nvidia.com/rdp/cudnn-archive to download a previous version of CUDNN that is compatible with your CUDA toolkit.
NOTE: You have to be signed in using your Nvidia account to download CUDNN. If you do not have an account, create one.
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)
COPY CONTENTS FROM THIS FOLDER
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.
The paths to add are mentioned below:
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0;
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin;
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include;
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\lib;
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.