TensorFlow 1.0 在 Windows 上看不到 GPU(但 Theano 可以)
TensorFlow 1.0 does not see GPU on Windows (but Theano does)
我在 Windows 上 运行 宁安装了 Keras & Theano(按照这个 tutorial). Now I've tried to switch the backend to Tensorflow 效果很好。
我遇到的唯一问题是 ,而 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?. Possibly Linux (?)。
完整的安装日志(包括一个奇怪的异常)可以在 Gist.
中找到
有什么想法,如何使 GPU 对 Tensorflow 可见?
在同一台机器上同时安装 tensorflow 和 tensorflow-gpu 目前可能会出现问题。
为版本 1.0 安装 tensorflow(仅适用于 cpu)或 tensorflow-gpu(仅适用于 gpu)
我在 Windows 上 运行 宁安装了 Keras & Theano(按照这个 tutorial). Now I've tried to switch the backend to Tensorflow 效果很好。
我遇到的唯一问题是
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?. Possibly
完整的安装日志(包括一个奇怪的异常)可以在 Gist.
中找到有什么想法,如何使 GPU 对 Tensorflow 可见?
在同一台机器上同时安装 tensorflow 和 tensorflow-gpu 目前可能会出现问题。
为版本 1.0 安装 tensorflow(仅适用于 cpu)或 tensorflow-gpu(仅适用于 gpu)