Tensorflow not detecting GPU

4,119 views
Skip to first unread message

trekkat

unread,
Oct 3, 2019, 5:13:31 AM10/3/19
to Discuss

I am running Jupyter application hosted on container(with base OS - ubuntu) on a VM server(CentOS). The GPU configuration seems fine as nvidia-smi and nvcc --version is working both on VM and as well as on container. But when I try the below block on jupyter, it’s returning ‘false’.

I am using TensorFlow commands to check GPU availability and its functionality.

import tensorflow as tf
tf.test.is_gpu_available()
tf.test.is_built_with_cuda()

Calling those last 2 functions provides with “false”.


But importing os package and running nvidia-smi and nvcc --version commands inside of ipython shell seems to be working, thus denoting that both the system and jupyter notebook application is detecting gpu but tensorflow doesn't seem to work in this case. 

If anyone can give me any directions regarding this, I would really appreciate it!


Jason Zaman

unread,
Oct 4, 2019, 12:26:35 AM10/4/19
to trekkat, Discuss
did you pip install tensorflow or pip install tensorflow-gpu?
in 2.1 the regular tensorflow package will optionally support GPUs but for now if you want GPU support you need to pip install tensorflow-gpu

-- Jason

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/e65a0bc3-ca0c-4243-be39-f03cfabc9a9a%40tensorflow.org.

trekkat

unread,
Oct 4, 2019, 4:47:59 AM10/4/19
to Discuss
Hi Jason,

I've installed both the packages using pip of version 1.14.0 on both of them. While running the aforementioned codes, it returns false values :( 


On Friday, October 4, 2019 at 9:56:35 AM UTC+5:30, Jason Zaman wrote:
did you pip install tensorflow or pip install tensorflow-gpu?
in 2.1 the regular tensorflow package will optionally support GPUs but for now if you want GPU support you need to pip install tensorflow-gpu

-- Jason

On Thu, 3 Oct 2019 at 17:13, trekkat <rajesh...@corecompete.com> wrote:

I am running Jupyter application hosted on container(with base OS - ubuntu) on a VM server(CentOS). The GPU configuration seems fine as nvidia-smi and nvcc --version is working both on VM and as well as on container. But when I try the below block on jupyter, it’s returning ‘false’.

I am using TensorFlow commands to check GPU availability and its functionality.

import tensorflow as tf
tf.test.is_gpu_available()
tf.test.is_built_with_cuda()

Calling those last 2 functions provides with “false”.


But importing os package and running nvidia-smi and nvcc --version commands inside of ipython shell seems to be working, thus denoting that both the system and jupyter notebook application is detecting gpu but tensorflow doesn't seem to work in this case. 

If anyone can give me any directions regarding this, I would really appreciate it!


--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dis...@tensorflow.org.

Russell Jurney

unread,
Oct 4, 2019, 10:50:41 AM10/4/19
to trekkat, Discuss
This usually means that CUDA/CuDNN aren't properly installed. Can you run the following command successfully: gpustat

That command should print something like: 

$ gpustat
hostname                Fri Oct  4 07:48:24 2019  410.48
[0] GeForce GTX 1080 Ti | 28'C,   0 % | 10881 / 11175 MB | rjurney(10871M)

There are also example projects that get installed with CUDA and CuDNN that you can compile and run to make sure things are working properly. These should have been options when you installed these libraries.


To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/0de8bae1-3f29-4c92-be57-88bc6425ccb5%40tensorflow.org.

Russell Jurney

unread,
Oct 4, 2019, 10:51:56 AM10/4/19
to trekkat, Discuss
Oh, and of course try the following command: nvidia-smi

That should print:

Fri Oct  4 07:50:57 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.48                 Driver Version: 410.48                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:01:00.0 Off |                  N/A |
| 20%   27C    P8    16W / 250W |  10881MiB / 11175MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     16264      C   ...ney/deep_products/code/venv/bin/python3 10871MiB |
+-----------------------------------------------------------------------------+


trekkat

unread,
Oct 7, 2019, 6:05:54 AM10/7/19
to Discuss
Hi Russell,

gpustat doesn't work but nvidia-smi does work and it provides with a similar output as you've posted over here. As for the CUDA or CuDNN, I kind of didn't get you exactly what codes shall I run to check the functionality of it all. So, could you let me know what next stuffs shall I be checking out? 

Russell Jurney

unread,
Oct 7, 2019, 1:43:23 PM10/7/19
to trekkat, Discuss
Check out these: https://docs.nvidia.com/cuda/cuda-samples/index.html https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

The first link spells out how to work with the CUDA examples. The second one is an install page that covers setting up the CuDNN examples.


To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/fcb9bf30-b7d4-4afd-9170-f7c2c10f173d%40tensorflow.org.

trekkat

unread,
Oct 10, 2019, 6:00:44 AM10/10/19
to Discuss
Hi Russell,


Sorry for the delay with the reply. I tried those CUDA examples and it works just fine. Please check the snippet along with this comment which got generatedd after running "make" command after executing the script cuda-install-samples-10.1.sh 


On Monday, October 7, 2019 at 11:13:23 PM UTC+5:30, Russell Jurney wrote:
The first link spells out how to work with the CUDA examples. The second one is an install page that covers setting up the CuDNN examples.
Misc1.JPG
Reply all
Reply to author
Forward
0 new messages