https://blog.csdn.net/castle_cc/article/details/78389082
编写 demo.py
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
查看日志信息若包含gpu信息,就是使用了gpu。
执行 demo.py
执行方式1:在 python-IDLE 中打开文件demo.py 并 Run Model :
>>>
== RESTART: D:\下载\forGPU--CUDA--TensorFlow--CUDNN\tensorflow-gpu_demo_01.py ==
>>>
什么情况?没有 gpu 信息?
执行方式2:在cmd下执行demo.py :
D:\下载\forGPU--CUDA--TensorFlow--CUDNN>tensorflow-gpu_demo_01.py
2018-11-02 17:25:34.590159: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary