Cuda,CuDNN已安装,但Tensorflow无法使用GPU [英] Cuda, CuDNN installed But Tensorflow can't use the GPU
问题描述
我的系统是EC2上的Ubuntu 14.04:
My system is Ubuntu 14.04 on EC2.:
nvidia-smi
Sun Oct 2 13:35:28 2016
+------------------------------------------------------+
| NVIDIA-SMI 352.63 Driver Version: 352.63 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GRID K520 Off | 0000:00:03.0 Off | N/A |
| N/A 37C P0 35W / 125W | 11MiB / 4095MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
ubuntu@ip-XXX-XX-XX-990:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
我安装了CUDA 7.5和CuDNN 5.1.
I Installed CUDA 7.5 and CuDNN 5.1.
我在/usr/local/local/lib64中有适当的文件,并且包含文件夹.
I have the proper files in /usr/local/local/lib64 and include folders.
Tensorflow行什么都没有:
Tensorflow line gives nothing:
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
>>> sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
Device mapping: no known devices.
I tensorflow/core/common_runtime/direct_session.cc:252] Device mapping:
>>>
请帮助(非常感谢:)).
Please help (Thanks a lot :)).
推荐答案
您如何构建tensorflow?
How did you build tensorflow?
如果用bazel做到了,是否正确添加了--config = cuda?
If you did it with bazel did you add correctly --config=cuda?
如果您通过pip安装了它,是否正确选择了具有gpu enable的产品?
If you installed it with pip did you took correctly the one with gpu enable?
您可以在此处查看如何使用pip进行安装: https://www.tensorflow.org/versions/r0 .11/get_started/os_setup.html#pip-installation
You can see here how to install with pip: https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#pip-installation
您需要选择一个与gpu兼容的二进制文件:
You need to take the one with binary compatible with gpu:
# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl
# Mac OS X, GPU enabled, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.11.0rc0-py2-none-any.whl
# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp34-cp34m-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp35-cp35m-linux_x86_64.whl
# Mac OS X, GPU enabled, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.11.0rc0-py3-none-any.whl
然后安装tensorflow:
then install tensorflow:
# Python 2
$ sudo pip install --upgrade $TF_BINARY_URL
# Python 3
$ sudo pip3 install --upgrade $TF_BINARY_URL
这篇关于Cuda,CuDNN已安装,但Tensorflow无法使用GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!