2

I have installed tensorflow-gpu using pip (within Anaconda). Here is the verification:

$ pip list | grep tensorflow tensorflow-gpu (1.4.0)

But whenever I run a model, it uses the CPU. Can someone please help.

Another command I tried:

$ find . -name tensorflow ./anaconda3/lib/python3.6/site-packages/tensorflow ./anaconda3/lib/python3.6/site-packages/tensorflow/include/tensorflow

Is there a conflict?

webminal.org
  • 44,948
  • 37
  • 94
  • 125
user1274878
  • 1,275
  • 4
  • 25
  • 56
  • why is there a "-1" next to the post? – user1274878 Feb 03 '18 at 04:07
  • 2
    Possible duplicate of [Tensorflow not running on GPU](https://stackoverflow.com/questions/44829085/tensorflow-not-running-on-gpu) – pfm Feb 04 '18 at 11:24
  • 1
    Faced the similar issue. My situation was tensorflow-gpu was installed using conda, while pip installed tensorflow cpu version. I re-installed tensorflow-gpu using pip fixed the issue. – Mingjiang Shi May 29 '18 at 11:49

1 Answers1

4

Assuming you are using a Nvidia-gpu have you installed cuda and cudnn before installing Tensorflow with gpu support? check this link. Moreover use pip or pip3 to install tensorflow because Anaconda will not have the latest version of tensorflow.

also try running the following in a python or a ipython shell

import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

You will get a sample output and if you see your GPU device in the message then tensorflow is using your gpu

Abhijit Balaji
  • 1,870
  • 4
  • 17
  • 40
  • I tried the same, and I can see my gpu in the list. I have an MSI. using my Dragon centre, which shows the stats and metrics of my hardware in function, I can see that my GPU is not being used, but rather, all of my RAM is being used. Is it something that cannot be picked by the metrics? Also, when I am running my games, I can see that the GPU is being used. – Lakshmi Narayanan Sep 04 '18 at 11:58
  • @LakshmiNarayanan Do you have a nvidia GPU or a AMD? – Abhijit Balaji Sep 04 '18 at 16:36