DEV Community

loading...
Cover image for CUDA, CuDNN, and Tensorflow installation on windows and Linux.

CUDA, CuDNN, and Tensorflow installation on windows and Linux.

codeperfectplus profile image Deepak Raj Originally published at codeperfectplus.herokuapp.com Updated on ・3 min read

This article was originally published on CodePerfectPlus.com

Deep learning task especially computer vision requires hardware for training purpose. Tensorflow-Gpu enables GPU for training using the CUDA.

We are going to install CUDA11.0 on windows and Linux. Before starting the tutorial please check if your GPU Cuda enabled also install a GPU driver for your pc. Visit Here for Check CUDA GPUs | NVIDIA Developer

1. For Linux Users( Ubuntu, Debian based)

Installation on Linux is quite easy compared to windows. Before installation please check the Nvidia GPU driver is installed properly.

You have to install 3 things.

  1. Cuda 11.0 Update 1
  2. Cudnn 8.1

It will show the Driver details.

$ nvidia-smi
Enter fullscreen mode Exit fullscreen mode

Download the Cuda 11.0 from CUDA Toolkit 11.0 Update 1 Download | NVIDIA Developer. We are installing “Cuda ToolKit 11.0 Update 1”.

After Downloading the File Run the below command to install Cuda.

cuda installation

$ sudo sh Downloads/cuda_11.0.3_451.82_win10.exe
Enter fullscreen mode Exit fullscreen mode

For downloading the Cudnn you need to create an account there. And then you can download the cuDNN. For downloading click here.

cuDNN installation linux

Download all three files Developer, Runtime, and sample. Then run the following command.

$ sudo dpkg -i <path-to-dev-file>
$ sudo dpkg -i <path-to-runtime-file>
$ sudo dpkg -i <path-to-samples-file>
Enter fullscreen mode Exit fullscreen mode

After installing Reboot your Pc then Run the following command to install Tensorflow-GPU.

$ pip install tensorflow-gpu
Enter fullscreen mode Exit fullscreen mode

2. For Windows 10 users.

Installation on windows is a little bit tricky. You need some tools before starting the tutorial.

• Nvidia Graphis Driver
• Visual Studio 2019
• Microsoft Visual C++ 
Enter fullscreen mode Exit fullscreen mode

Download the Cuda 11.0 from CUDA Toolkit 11.0 Update 1 Download | NVIDIA Developer. We are installing “Cuda ToolKit 11.0 Update 1”

Alt Text
Download the cuDNN Library for Windows (x86).

Alt Text

Extract the CuDNN library in the Download Folder. Under the extracted Folder There will be 3 Folders “include”, “bin” and “lib/x64”. Go to the "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0"

and Copy the content to extracted Folders to the CUDA/11.0 Respective Folder. There will be folder names include, bin and lib/x64.

After installing Reboot your Pc then Run the following command to install Tensorflow-GPU.

$ pip install tensorflow-gpu

3. Test the installation

For testing, the whole installation on windows and Linux are the same.
Open your terminal/cmd/powershell and type.

$ python
$ import tensorflow as tf
$ tf.test.is_gpu_available()
Enter fullscreen mode Exit fullscreen mode

test your tensorflow installation

it will show True and import some libraries.

More Articles by Author

Join for Weekly Updates.

Discussion (0)

pic
Editor guide