My computer has the following software installed: Anaconda (3), TensorFlow (GPU), and Keras. There are two Anaconda virtual environments - one with TensorFlow for Python 2.7 and one for 3.5, both GPU version, installed according to the TF instructions. (I had a CPU version of TensorFlow installed previously in a separate environment, but I've deleted it.)
When I run the following:
source activate tensorflow-gpu-3.5
python code.py
and check nvidia-smi it shows only 3MiB GPU Memory Usage by Python, so it looks like GPU is not used for calculations.
(code.py is a simple deep Q-learning algorithm implemented with Keras)
Any ideas what can be going wrong?
TensorFlow on Windows
It took me hours to fix TensorFlow installation issues on windows, so here is summary:
To Check if TensorFlow-gpu is working or not (use this code):
with tf.device('/gpu:0'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
with tf.Session() as sess:
print(sess.run(c))
To Check list of available CPUs or GPUs (use this code):
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
if tf.test.gpu_device_name():
print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
else:
print("Please install GPU version of TF")
Install Tensorflow GPU on Windows using CUDA and cuDNN
Guide Overview
Guide Complete details
Make Sure
Hope thats helpful :))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With