How to check Tensorflow is working with your GPU
If you have installed Tensorflow with GPU support in your laptop or PC you may be wondering how to check whether it is working with GPU. There are several methods to do this.
In your Jupyter notebook you can run following commands.
import tensorflow as tf print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
This will output the number of available GPUs
If the Tensorflow is not installed properly with GPU support number of GPUs will be shown as 0
To view the details of the GPU you can use following command.
from tensorflow.python.client import device_lib print(device_lib.list_local_devices())
This will output details similar to below.
Physical device description will show you the details of the GPU in your PC or laptop. Here it is shown as NVIDIA GeForce RTX 3060 laptop GPU which is in my laptop.
If you are using free version of Google Colab following details will be shown.
Google Colaboratory free version provides you with Tesla K80 GPU.
No comments:
Post a Comment