close

How to get current available GPUs in tensorflow?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to get current available GPUs in tensorflow 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 to get current available GPUs in tensorflow?

  1. How to get current available GPUs in tensorflow?

    There is also a method in the test util. So all that has to be done is:
    tf.test.is_gpu_available()

  2. get current available GPUs in tensorflow

    There is also a method in the test util. So all that has to be done is:
    tf.test.is_gpu_available()

Method 1

You can check all device list using following code:

from tensorflow.python.client import device_lib

device_lib.list_local_devices()

Method 2

There is also a method in the test util. So all that has to be done is:

tf.test.is_gpu_available()

and/or

tf.test.gpu_device_name()

Look up the Tensorflow docs for arguments.

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