0

因此,我在笔记本电脑上安装了适用于 Python 3.5 的 Tensorflow,这是一台托管 Nvidia Geforce Pascal GPU 的 Windows 机器。我还安装了 CUDA 并下载了 cuDNN 并将其添加到 PATH 变量中。我的 tensorflow 代码确实可以编译,但是如果我监控我的 GPU,我可以看到,它不会计算任何东西,而是我的 CPU 正在完成整个工作。我还在控制台中得到一个输出,确认检测到 GPU:

2017-06-02 15:22:22.140283: 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-06-02 15:22:22.140600: 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-06-02 15:22:22.140899: 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-06-02 15:22:22.141108: 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-06-02 15:22:22.141321: 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-06-02 15:22:22.141582: 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-06-02 15:22:22.141803: 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 AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-06-02 15:22:22.142130: 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 FMA instructions, but these are available on your machine and could speed up CPU computations. 2017-06-02 15:22:22.561687: 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 1070 major: 6 minor: 1 memoryClockRate (GHz) 1.645 pciBusID 0000:01:00.0 Total memory: 8.00GiB Free memory: 6.65GiB 2017-06-02 15:22:22.561949: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:908] DMA: 0 2017-06-02 15:22:22.562073: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:918] 0: Y 2017-06-02 15:22:22.562435: 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 1070, pci bus id: 0000:01:00.0)

有人可以向我解释吗?

编辑:好的,看来,我没有看到用法足够准确。GPU 是实际使用的,但只是在小高峰。大部分工作仍然由 CPU 完成。我正在运行一个具有 3 个卷积层和 2 个全连接层的 CNN。但这不可能吧?![GPU 使用率] 1

4

1 回答 1

1

In order to improve performance, I suggest to take a look at this tensorflow performance guide.

In particular I have experimented a sensible speed up by locating the preprocessing on the cpu side with the command with tf.device('/cpu:0'):

Please notice that the speed-up factor is architecture-dependant as reported in this article

于 2017-06-02T14:10:52.913 回答