Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I have installed tensorflow in my ubuntu 16.04 using the second answer here

with ubuntu's builtin apt Cuda installation.

Now my question is how can I test if tensorflow is really using GPU? I have a gtx 960m GPU. When I import tensorflow this is the output

I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally 

I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally 

I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally 

I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally 

I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally

1 Answer

0 votes
by (106k points)

You can use the below-mentioned code to tell if tensorflow is using gpu acceleration from inside python shell there is an easier way to achieve this.

import tensorflow as tf 

if tf.test.gpu_device_name(): 

    print('Default GPU Device:

    {}'.format(tf.test.gpu_device_name()))

else:

   print("Please install GPU version of TF")

It usually prints like

Default GPU Device: /device:GPU:0

Wanna become an Expert in python? Come & join our Python Certification course 

Related questions

Browse Categories

...