如何判断tensorflow是否在python shell中使用gpu加速? [英] How to tell if tensorflow is using gpu acceleration from inside python shell?
问题描述
我使用第二个答案在我的ubuntu 16.04中安装了tensorflow
I have installed tensorflow in my ubuntu 16.04 using the second answer here with ubuntu's builtin apt cuda installation.
现在我的问题是我该如何测试tensorflow是否真的在使用gpu?我有一个gtx 960m gpu.当我import tensorflow
这是输出
Now my question is how can I test if tensorflow is really using gpu? I have a gtx 960m gpu. When I import tensorflow
this is the output
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally
此输出是否足以检查tensorflow是否正在使用gpu?
Is this output enough to check if tensorflow is using gpu ?
推荐答案
不,我认为开放CUDA库"不足以说明问题,因为图形的不同节点可能位于不同的设备上.
No, I don't think "open CUDA library" is enough to tell, because different nodes of the graph may be on different devices.
要找出使用哪个设备,您可以启用日志设备放置,如下所示:
To find out which device is used, you can enable log device placement like this:
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
检查您的控制台是否有这种类型的输出.
Check your console for this type of output.
这篇关于如何判断tensorflow是否在python shell中使用gpu加速?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!