kim*_*ake 5 keras tensorflow tensorflow-gpu
GPU版本Tensorflow?2017年12月18日星期一23:58:01
+-----------------------------------------------------------------------------+
| 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 |
+-----------------------------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试检测本地设备列表时,只会CPU被检测到。
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
]
Run Code Online (Sandbox Code Playgroud)
我是否需要设置其他内容才能使用GPUfor Keras或Tensorflow?
您可能需要这个shell来配置您的tensorflow-gpu。
如果你想检查tensorflow-gpu,你可以运行它。
import tensorflow as tf
with tf.device('/gpu:0'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
print sess.run(c)
Run Code Online (Sandbox Code Playgroud)
官方文档:使用 GPU。
| 归档时间: |
|
| 查看次数: |
8766 次 |
| 最近记录: |