TensorFlow 1.0 does not see GPU on Windows (but Theano does)

不想你离开。 提交于 2019-12-10 14:56:30

问题


I have a running installation of Keras & Theano on Windows (by following this tutorial). Now I've tried to switch the backend to Tensorflow which worked quite fine.

The only issue I have, is that Tensorflow does not detect my GPU, which Theano in contrast does:

from tensorflow.python.client import device_lib
def get_available_gpus():
    local_device_protos = device_lib.list_local_devices()
    return [x.name for x in local_device_protos if x.device_type == 'GPU']

yields no results but when running with Theano backend, it works quite nicely:

C:\Programming\Anaconda3\python.exe D:/cnn_classify_cifar10.py 
Using Theano backend.
DEBUG: nvcc STDOUT nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
mod.cu
    Creating library C:/Users/Alex/AppData/Local/Theano/compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.5.2-64/tmpgsy496fe/m91973e5c136ea49268a916ff971b7377.lib and object C:/Users/Alex/AppData/Local/Theano/compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.5.2-64/tmpgsy496fe/m91973e5c136ea49268a916ff971b7377.exp

Using gpu device 0: GeForce GTX 770 (CNMeM is enabled with initial size: 80.0% of memory, cuDNN 5005)

Apparently there is some configuration missing, but I don't know what. For Theano to run correctly, I needed a file called ~/.theanorc with the following content:

[global]
device = gpu
floatX = float32

[cuda]
root = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0

[nvcc]
flags=-LC:C:\Programming\WinPython-64bit-3.5.2.2\python-3.5.2.amd64\libs

Maybe something similar is missing or maybe I need to add environment variables like for Theano?. Possibly related question on Linux (?).

The full installation log (which included a strange exception) can be found in this Gist.

Any ideas, how to make the GPU visible to Tensorflow?


回答1:


Installing both tensorflow and tensorflow-gpu on the same machine might cause issues at the moment.

Install either tensorflow (for cpu only) or tensorflow-gpu (for gpu only) for version 1.0



来源:https://stackoverflow.com/questions/42473052/tensorflow-1-0-does-not-see-gpu-on-windows-but-theano-does

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!