0

I have aldready spent a considerable of time digging around on stack overflow and else looking for the answer, but couldn't find anything

Hi all,

I am running Tensorflow with Keras on top. I have installed tensorflow v2.0.0 ans tensorflow-gpu v2.0.0. along with CUDAnn V10.1

I was trying to do run some CNN models from Jupyter notebook and I noticed that Keras was running the model on the CPU (checked task manager, CPU was at 100%).

I tried these two commands to check whether my code is running on CPU or GPU

import tensorflow as tf
print(device_lib.list_local_devices())

and i got this output

2019-12-30 09:19:31.860668: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-12-30 09:19:31.875991: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2019-12-30 09:19:31.976610: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493
pciBusID: 0000:01:00.0
2019-12-30 09:19:31.987518: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2019-12-30 09:19:31.993980: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2019-12-30 09:19:34.307004: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-12-30 09:19:34.312977: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0
2019-12-30 09:19:34.316016: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N
2019-12-30 09:19:34.321996: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:0 with 3001 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 9698040825407999030
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 3147261542
locality {
  bus_id: 1
  links {
  }
}
incarnation: 15759540689914723584
physical_device_desc: "device: 0, name: GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1"
]

My system has Nvidea GTX Geforce 1050 GPU but the code is completely running on CPU and also I have tried to use only tensorflow-GPU by uninstalling tensorflow but result was still same after reinstalling too

Please somebody help me out !

  • It could be a version mismatch between Python, Tensorflow, CUDA and (if you're working on Windows) Visual Studio. For example, Python 3.5 will work with a certain version of VS with TF 1.8 CUDA 9, and another version of VS with TF 2.0 with CUDA 10, etc. Or, if you just installed CUDA and/or TF, you may try rebooting your system - some people mentioned rebooting solves the issue here: https://stackoverflow.com/questions/44829085/tensorflow-not-running-on-gpu – Kristada673 Dec 30 '19 at 04:19
  • Also, in Windows, you need to copy the `libcudnn.h` file into the correct folder - this file was not present in my installation at least, and I had to download it manually (for the matching version of TF, VS, CUDA and Python) and then place it in the appropriate location manually. – Kristada673 Dec 30 '19 at 04:23
  • CPU 100% does **not** mean that code is not running on the GPU! This is a common misconception. Everything points that the GPU is being used. – Dr. Snoopy Dec 30 '19 at 11:52

0 Answers0