DEV Community

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

Posted on • Edited on

2 1

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

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.

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay