close

How do I use TensorFlow GPU?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How do I use TensorFlow GPU? in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How do I use TensorFlow GPU?

  1. How do I use TensorFlow GPU?

    The 'new' way to install tensorflow GPU if you have Nvidia, is with Anaconda. Works on Windows too. With 1 line.

  2. I use TensorFlow GPU

    The 'new' way to install tensorflow GPU if you have Nvidia, is with Anaconda. Works on Windows too. With 1 line.

Method 1

install version 9.0! newer version is not supported by Tensorflow-gpu

Steps:

  1. Uninstall your old tensorflow
  2. Install tensorflow-gpu pip install tensorflow-gpu
  3. Install Nvidia Graphics Card & Drivers (you probably already have)
  4. Download & Install CUDA
  5. Download & Install cuDNN
  6. Verify by simple program
from tensorflow.python.client import device_lib 
print(device_lib.list_local_devices())

Method 2

The ‘new’ way to install tensorflow GPU if you have Nvidia, is with Anaconda. Works on Windows too. With 1 line.

conda create --name tf_gpu tensorflow-gpu 

This is a shortcut for 3 commands, which you can execute separately if you want or if you already have a conda environment and do not need to create one.

  1. Create an anaconda environment conda create --name tf_gpu
  2. Activate the environment conda activate tf_gpu
  3. Install tensorflow-GPU conda install tensorflow-gpu

You can use the conda environment.

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read