list_local_device张量流未检测到GPU [英] list_local_device tensorflow does not detect gpu

查看:150
本文介绍了list_local_device张量流未检测到GPU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 有没有办法检查我是否安装了GPU版本的Tensorflow?
  2. !nvidia-smi
  1. Is there way to check I installed GPU version of Tensorflow?
  2. !nvidia-smi

2017年12月18日星期一23:58:01

Mon Dec 18 23:58:01 2017

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.90                 Driver Version: 384.90                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:01:00.0  On |                  N/A |
| N/A   53C    P0    31W /  N/A |   1093MiB /  8105MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1068      G   /usr/lib/xorg/Xorg                           599MiB |
|    0      2925      G   compiz                                       290MiB |
|    0      3611      G   ...-token=11A9F5872A56620B72D1D5DF707CF1FC   200MiB |
|    0      5786      G   /usr/bin/nvidia-settings                       0MiB |
+-----------------------------------------------------------------------------+

但是当我尝试检测列表中的本地设备时,只有CPU被检测到.

But when I try to detect the list local devices, only CPU got detected.

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

[name: "/cpu:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 3303842605833347443
]

我是否需要设置其他内容才能将GPU用于KerasTensorflow?

Do I have to set something else to use the GPU for Keras or Tensorflow?

推荐答案

pip install tensorflow-gpuconda install tensorflow-gpu用于tensorflow的gpu版本.如果使用keras-gpu conda install -c anaconda keras-gpu命令将自动安装tensorflow-gpu版本.在执行这些命令之前,请确保已卸载常规的tensorflow.

Use pip install tensorflow-gpu or conda install tensorflow-gpu for gpu version of tensorflow. If you are using keras-gpu conda install -c anaconda keras-gpu command will automatically install the tensorflow-gpu version. Before doing these any command make sure that you uninstalled the normal tensorflow .

这篇关于list_local_device张量流未检测到GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆