Installing CUDA for Nvidia GPU and cuDNN on windows 10

Abhishek Maheshwarappa
5 min readJun 23, 2020

--

GPU-quickened CUDA libraries empower the speeding up over numerous spaces such as linear algebra, image and video processing and deep learning.

Aim of this article is to provide easy steps to install CUDA and get it up and running for the project and other applications

Requirements for CUDA are : -

  1. A CUDA-capable GPU — Nvidia
  2. Microsoft Visual Studio
  3. NVIDIA CUDA Toolkit

Step 1

Uninstall the Nvidia driver from the control panel and restart the system.

Yes it seems odd to do it but trust me, it will help you install CUDA without any errors. After trying different methods and multiple failures I am writing this blog.

Go to the link to download the appropriate driver for the GPU hardware in the system.

Hardware details can found by the system provider website or can found in the device manager

Device Manager

If it is the Nvidia Geforce series, then download GEFORCE EXPERIENCE an essential companion for GPU. Install and run it then it will detect the hardware and download the required version of the GPU driver.
Link for downloading Geforce experience

Step 2

Microsoft visual studio is required for install CUDA so next step is to install Microsoft Visual Studio

Install community version, to install choose the recommend option no need to do any changes.

Note if you have already installed a visual studio you can update it and skip this step.

Step 3

Now let us download the main required CUDA Toolkit for Windows 10 from Nvidia website from the following link

Go to Legacy releases to find the appropriate version CUDA tool kit

Now we need to choose which CUDA version need to be installed because not all the latest version supports the TensorFlow and Keras

Currently, TensorFlow supports CUDA 10.1 (TensorFlow >= 2.1.0)

  1. Download the supported CUDA link
  2. Start the installation procedure by clicking and choosing the express option
  3. Once done launch the sample

The sample will present at the following location

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1

Now to verify the CUDA is properly installed we will do the small test so that we can confirm all the effort did pay off.

Choose the right version of the visual studio which is installed in your system and open the visual studio solution file and build it, if there was no error then the installation is successful.

Congratulations on coming so far, its almost done just a couple more steps.

Step 4

Now to get Deep neural network library for running deep learning algorithms.

NVIDIA cuDNN

The NVIDIA CUDA Deep Neural Network library (cuDNN) is a GPU-quickened library for deep neural networks.

Follow the link to download the cuDNN

  1. Membership will be required to download cuDNN
  2. It will ask to verify the email once that is done your all set to dowload
  3. Extract the files

Copy the file in bin folder from downloaded folder to bin folder at the location

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin

Repeat same for include folder at

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include

and at last for lib

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib

Once these files are copied, you are done with the installation procedure, good job coming so far, now there last few settings to be done to start using it.

Step5

Checking the environment variables

  1. In Windows 10, the Environment Variables can be found by choosing: -Control Panel ->System and Security->System->Advanced System settings

Within the “system variables” (in the bottom half of the window), click on “Path” and choose the button “edit”.

Add the path if they are missing in the same way as it is shown in the above screenshot.

Step 6

You are done with everything related CUDA and cuDNN so now to test whether our TensorFlow detect the GPU or not let us install stable Tensorflow

pip install tensorflow

Step 7

To check let us run the following code block

TensorFlow code will transparently run on a single GPU with no explicit code configuration required.

If the output is the same as the above picture then your good go to use the GPU for your applications and project.

Congratulation on completing the steps for installing the CUDA, cuDNN, and TensorFlow for GPU.

Now have fun running deep learning models on GPU at an accelerated pace.

Conclusion

So the main focus was to provide a simple guide to install CUDA and cuDNN for running code on GPU and increase the performance.

References

  1. https://www.tensorflow.org/
  2. https://www.nvidia.com/en-us/
  3. https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#:~:text=To%20use%20CUDA%20on%20your,version%20of%20Microsoft%20Visual%20Studio

--

--

No responses yet