Testing whether tf is using the GPU

I have installed tensorflow (GPU version) on my Dell Inspiron laptop with an NVIDIA MX150 running Ubuntu 20.04. CUDA tools v11.6 (nvidia-smi) and cuDNN v10.1 are installed.

I want to know if tf is using the GPU.

tf.config.list_physical_devices(‘GPU’) returns that 1 GPU is available, but a simple DNN runs at much the same speed as before I had the GPU detected?

################################################################
When I run:

import tensorflow as tf
tf.config.list_physical_devices('GPU')
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

I get:
Num GPUs Available: 1

@brendonwp,

Welcome to the Tensorflow Forum!

I want to know if tf is using the GPU.

Yes, you are using GPU.

A model needs to be big enough in order to profit from GPU acceleration.

Thank you!

1 Like