How to Install Cuda 10 and cuDNN for Tensorflow-GPU on Windows 10

Source: Deep Learning on Medium


Requirements:

Go to the profile of SUNNY DHOKE

CUDA compatible GPU

Windows 10

Fast and Stable Internet connection

Time: Approximately 15–45 mins depending on your comfort with downloading and installing files.


Part A>

Visual Studio

  1. Visit https://www.techspot.com/downloads/6278-visual-studio.html and download Visual Studio 2017 free version.
  2. Double click on the downloaded file and accept the default configuration.
  3. Reboot after installation.

Part B>

CUDA Toolkit version 10

  1. Visit https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal and download the local or network version along with patches if any.
  2. Double click on it and choose the default settings.
  3. Reboot.

Part C>

cuDNN library

  1. Visit https://developer.nvidia.com/rdp/cudnn-download and download the version that says compatible with CUDA 10.0
  2. Extract the files to any temporary folder.
  3. There are three files in the unzipped cuDNN folder subdirectories which are to be copied into the CUDA Toolkit directories. These are cudnn64_7.dll, cudnn.h and :

1. cudnn64_7.dll

  1. cudnn64_7.dll can be found in the following path within the downloaded cuDNN files:
<downloadpath>\cudnn-10.0-windows10-x64\cuda\bin\cudnn64_7.dll

you can copy the cudnn64_7.dll file directly into the CUDA folder’s bin folder path (note: you don’t need to create any new subfolders):

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

2. cudnn.h

As with the cudnn64_7.dll file above, after downloading and unzipping the cuDNN folder, the header file cudnn64.h can be found in the path:

<downloadpath>\cudnn-10.0-windows10-x64\cuda\ include\cudnn.h

Again, assuming that you installed CUDA 10.0 into the default path as I did at Step 2.3, copy cudnn.h directly into the CUDA folder with the following path (no new subfolders are necessary):

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

3. cudnn.lib

The .lib file cudnn.lib can be found in the downloaded cuDNN path:

<downloadpath>\cudnn-10.0-windows10-x64\cuda\lib\x64\cudnn.lib

Copy cudnn.lib directly into the CUDA folder with the following path:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib\x64\
Checking CUDA environment variables are set in Windows
Finally, the instructions at Nvidia direct that you ensure that the CUDA environment variable has previously been set up, as follows:
Variable Name: CUDA_PATH 
Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

In Windows 10, the Environment Variables can be found by choosing:

Control Panel ->System and Security->System->Advanced System settings.

This opens up a window called “System Properties” (Fig 17), at which point the “Environment Variables” button should be chosen.

Fig 17: Environment Variables button (in System Properties window) for setting and checking CUDA paths

When the Environment Variables window then appears, within “system variables” (in the bottom half of the window), click on “Path” and choose the button “edit”. A new window will appear, called “Edit environment variable” as shown in Fig 18 below.

On checking the Environment Variables, I found the installation process which determines the CUDA installation path — Step 3.2, see Fig. 11 — had already added two paths to CUDA . These paths are shown in Fig 18 below, so I found I did not need to add a further CUDA path.

Fig 18: Default paths previously created during CUDA 9.0 installation process

Congrats , Now you have CUDA installed in your machine. You can either use Anaconda to do pip install tensorflow-gpu or install it on your main machine python installation. I personally did pip install tensorflow-gpu on my Machine’s anaconda installation to avoid messing up things.

That’s it. All the credits go to this article, I just updated it as I was not able to follow that myself for current changes. Thanks. Have a great day.