Setting up your Nvidia GPU for Deep Learning

Steve Jefferson
4 min readOct 27, 2020

--

This article aims to help anyone who wants to set up their windows machine for deep learning. Although setting up your GPU for deep learning is slightly complex the performance gain is well worth it * . The steps I have taken taken to get my RTX 2060 ready for deep learning is explained in detail. Software installation covered in this article include Cuda ,cuDNN ,Anaconda ,Visual Studio C++ and Tensorflow.

Files to download

The first step when you search for the files to download is to look at what version of Cuda Tensorflow, supports which can be checked here, at the time of writing this article it supports Cuda 10.1.To download cuDNN you will have to register as an Nvidia developer. I have provided the download links to all the software to be installed below.

  1. Anaconda
  2. Visual Studio Community Edition 2019
  3. Cuda(Find the version supported by Tensorflow)
  4. cuDNN(Download according to your Cuda version)

For this installation Anaconda 2020.07, Visual studio 16.7.6, Cuda 10.1(update 2), cuDNN 8.0.4, TensorFlow 2.3.1 were used

Anaconda

Anaconda is a free and open-source distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment.

  1. Double click the installer to launch.

2. Click Next.

3. Read the licensing terms and click “I Agree”.

4. Select an install for “Just Me” and click Next.

5. Select a destination folder to install Anaconda and click the Next button

6. Do not add Anaconda to your PATH environment variable when asked in the checkbox

7. After a successful installation you will see the “Thanks for installing Anaconda” dialog box

8. Verify your Install

Visual Studio Community Edition 2019

The core of NVIDIA TensorRT is a C++ library that facilitates high-performance inference on NVIDIA graphics processing units. This is why we must install the necessary C++ libraries using Visual Studio.

  1. Double click the installer to launch.
  2. Click continue and it will download a few files
  3. Scroll and select desktop environment with C++

4. Check the components shown in the image above

5.Click on Install to complete the installation

Cuda

CUDA is a parallel computing platform and application programming interface model created by Nvidia.

  1. Double click the installer and click on extract to extract the necessary files to a temporary location
  2. The System check will complete automatically
  3. Accept the License Agreement
  4. Install using the default Express option which is recommended
  5. The installer will finish after a while

cuDNN

cuDNN is a GPU-accelerated library for deep neural networks. cuDNN provides highly tuned implementations for standard routines such as forward and backward convolution, pooling, normalization, and activation layers.

  1. Extract the zip files from archive downloaded
  2. Copy the folders “bin”, ”include”, “lib”
  3. Paste the copied folders into:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1

4.Run the following commands one by one (in an elevated command prompt) to add the necessary files to Path

1) setx path “%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin”
2) setx path “%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\lib64”
3) setx path “%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include”
4) setx path “%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp”

TensorFlow

Tensorflow is a comprehensive set of libraries that helps in training and testing deep learning models.

Do not directly use Anaconda without specifying the version to install TensorFlow as the Anaconda installer will only install TensorFlow 1.14 and you will get a version not supported error, Instead downgrade python to python 3.7 and run the following commands to install Tensorflow 2.1.0

conda install python=3.7conda update --allconda install -c anaconda tensorflow-gpu=2.1

Verify your Installation

To test if all you have done till now works create a python file with Spyder and run this code.

That’s it your deep learning machine is ready to do what you command :)

--

--

No responses yet