我将使用keras和tensorflow作为后端来训练神经模型。日志文件以以下消息开始:
nohup: ignoring input
2019-02-12 17:44:29.414526: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2019-02-12 17:44:30.191565: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.7335
pciBusID: 0000:65:00.0
totalMemory: 7.93GiB freeMemory: 7.81GiB
2019-02-12 17:44:30.191601: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2019-02-12 17:44:30.409790: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-02-12 17:44:30.409828: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0
2019-02-12 17:44:30.409834: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0: N
2019-02-12 17:44:30.410015: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7535 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:65:00.0, compute capability: 6.1)
这是否意味着训练是在GPU上执行的?
我会说是的,但是当我执行nvtop
时,我看到所有的GPU内存都被使用,而GPU计算能力的使用率为0%(请参见下面的黄色屏幕截图):
htop
时,可以看到一个CPU被完全使用(请参见下方黑色截图)。
为什么会使用GPU内存和CPU计算能力,而不是GPU计算能力?
tf.device
指令来强制操作在GPU上运行,因此如果由于某些原因无法使用GPU,则会失败(请注意,某些操作,例如大多数数据输入,不能在GPU上运行,因此请将其用于“纯计算”)。也可能是您的输入管道花费了很多时间,因此GPU没有被快速地提供足够的数据,请参见数据输入管道性能。 - jdehesa249/508100 [..............................] - ETA: 31:12:33 - loss: 0.5588
。 - dada