我在Windows7机器上安装了Tensorflow。 Tensoflow确实识别GPU。这是程序的输出(没有任何打印调用):
2017-05-11 16:28:03.039954: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 16:28:03.039954: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 16:28:03.039954: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 16:28:03.040954: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 16:28:03.040954: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 16:28:03.041954: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 16:28:03.353972: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:887] Found device 0 with properties:
name: GeForce GTX 980 Ti
major: 5 minor: 2 memoryClockRate (GHz) 1.076
pciBusID 0000:83:00.0
Total memory: 6.00GiB
Free memory: 5.81GiB
2017-05-11 16:28:03.354972: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:908] DMA: 0
2017-05-11 16:28:03.354972: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:918] 0: Y
2017-05-11 16:28:03.354972: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 980 Ti, pci bus id: 0000:83:00.0)
根据我的理解,Tensorflow找到GPU并在其上运行整个程序。问题是它与我的笔记本电脑相比太慢了。在TF主页上,有以下示例:我在
上运行它我的笔记本电脑:Intel Core i7-CPU 2.59 GHz 8GB RAM
并且在具有Intel Xeon CPU E5-2670 0 2.6GHz CPU
和NVIDIA GeForve GTX 980 Ti GPU
import tensorflow as tf
with tf.device('/gpu:0'):# '/cpu:0'
# Creates a graph.
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)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))
结果如下: 我的笔记本电脑:
MatMul: (MatMul): /job:localhost/replica:0/task:0/cpu:0
b: (Const): /job:localhost/replica:0/task:0/cpu:0
a: (Const): /job:localhost/replica:0/task:0/cpu:0
[[ 22. 28.]
[ 49. 64.]]
2017-05-12 10:54:26.235444: I c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\common_runtime\simple_placer.cc:841] MatMul: (MatMul)/job:localhost/replica:0/task:0/cpu:0
2017-05-12 10:54:26.235675: I c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\common_runtime\simple_placer.cc:841] b: (Const)/job:localhost/replica:0/task:0/cpu:0
2017-05-12 10:54:26.235886: I c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\common_runtime\simple_placer.cc:841] a: (Const)/job:localhost/replica:0/task:0/cpu:0
[Finished in 1.952s]
工作站CPU:
/job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: GeForce GTX 980 Ti, pci bus id: 0000:83:00.0
MatMul: (MatMul): /job:localhost/replica:0/task:0/cpu:0
b: (Const): /job:localhost/replica:0/task:0/cpu:0
a: (Const): /job:localhost/replica:0/task:0/cpu:0
[[ 22. 28.]
[ 49. 64.]]
[Finished in 2.924s]
工作站GPU:
/job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: GeForce GTX 980 Ti, pci bus id: 0000:83:00.0
MatMul: (MatMul): /job:localhost/replica:0/task:0/gpu:0
b: (Const): /job:localhost/replica:0/task:0/gpu:0
a: (Const): /job:localhost/replica:0/task:0/gpu:0
[[ 22. 28.]
[ 49. 64.]]
[Finished in 3.045s]
所以我的问题是我在这里缺少的,我该如何解决这个问题?