【问题标题】:Cuda, CuDNN installed But Tensorflow can't use the GPU安装了 Cuda、CuDNN 但 Tensorflow 无法使用 GPU
【发布时间】:2017-02-10 13:46:37
【问题描述】:

我的系统是 EC2 上的 Ubuntu 14.04。:

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。

我在 /usr/local/local/lib64 中有正确的文件并包含文件夹。

Tensorflow 线什么也没给出:

    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:

>>> 

请帮忙(非常感谢:))。

【问题讨论】:

  • @talonmies 现有解决方案不起作用,我已经一次又一次地检查路径变量。
  • 您似乎有一个正常工作的 CUDA 安装。因此,这个问题是一个 tensorflow 配置问题,与 CUDA 编程无关。这就是我恢复标签的原因。
  • @talonmies 是的,这就是我的想法,链接或路径一定有问题......就像那样。你能建议我尝试什么吗?谢谢。
  • 我遇到了同样的问题。我建议您从this link 使用 CUDA/cuDNN/Python 检查 Tensorflow 兼容性

标签: ubuntu tensorflow gpu cudnn


【解决方案1】:

你是如何构建 tensorflow 的?

如果你是用 bazel 做的,你是否正确地添加了 --config=cuda?

如果您使用 pip 安装它,您是否正确选择了启用 gpu 的那个?

编辑:

您可以在此处查看如何使用 pip 进行安装: https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#pip-installation

你需要带二进制兼容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

然后安装张量流:

# Python 2
$ sudo pip install --upgrade $TF_BINARY_URL

# Python 3
$ sudo pip3 install --upgrade $TF_BINARY_URL

【讨论】:

  • gpu 的 pip 选项是什么?除了 pip,我没有看到任何 gpu 命令。如果有任何命令,请告诉我,我会将其标记为答案。谢谢。
  • 我编辑了我的答案,你可以检查一下。我希望它有所帮助。没有真正的选择,只需要选择正确的二进制文件。
猜你喜欢
  • 1970-01-01
  • 2017-10-31
  • 2017-10-25
  • 1970-01-01
  • 1970-01-01
  • 2020-06-07
  • 1970-01-01
  • 2020-10-02
  • 1970-01-01
相关资源
最近更新 更多