我在Windows上运行安装了Keras & Theano(通过以下这个tutorial)。现在,我已经尝试切换后端Tensorflow它做得很细。TensorFlow 1.0在Windows上看不到GPU(但是Theano确实)
我唯一的问题是,Tensorflow does not detect my GPU,这Theano相反的作用:
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']
产生任何结果,但与Theano后台运行时,它的工作原理相当不错:
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)
显然有一些配置丢失,但我不知道是什么。对于Theano正常运行,我需要一个叫做~/.theanorc
,内容如下文件:
[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
相似丢失或也许我需要add environment variables like for Theano?也许一些。 Linux(?)上可能为related question。
完整的安装日志(其中包括一个奇怪的除外)可在此Gist找到。
任何想法,如何让GPU可见Tensorflow?
您是如何安装tensorflow要么tensorflow(用于CPU只),或tensorflow-GPU(仅适用于GPU)? – Steven
见我[要点文件(https://gist.github.com/apacha/a595c244f90a27aced56f67f7598d90d),使用PIP与直接URL到车轮安装tensorflow和交替。 –
该命令是错误的。你需要做的PIP 3安装--upgrade tensorflow-GPU – Steven