成功安装Tensorflow-GPU,“导入tensorflow”之后将不会打印出任何内容

时间:2017-05-20 08:39:22

标签: python deep-learning tensorflow-gpu

Installing collected packages: wheel, six, appdirs, pyparsing, packaging, setuptools, protobuf, werkzeug, numpy, tensorflow-gpu
Successfully installed appdirs-1.4.3 numpy-1.12.1 packaging-16.8 protobuf-3.3.0 pyparsing-2.2.0 setuptools-35.0.2 six-1.10.0 tensorflow-gpu-1.1.0 werkzeug-0.12.2 wheel-0.29.0

(py35) C:\Users\Tianran>
(py35) C:\Users\Tianran>python
Python 3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>>

Tensorflow GPU将成功安装和导入。 但根据像这样的在线文章

How to tell if tensorflow is using gpu acceleration from inside python shell?

在控制台中,它将打印

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
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

它告诉我设备gpu:0适用于计算。 所以tensorflow gpu工作。

但问题是,当导入tensorflow GPU时,控制台不会显示上面的信息(CUDA库已成功打开等等)。

1 个答案:

答案 0 :(得分:1)

如果我没记错,导入语句不会返回任何内容。所以在import tensorflow之后没有任何事情发生是好事,因为没有错误显示。正如您所说,使用sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))为您提供了正确的输出,表明tensorflow正常工作。

我希望这是你想知道的。