经过大量的摆弄,从源码构建的tensorflow并安装到Python 3.5(它似乎不像3.6),现在一个Keras程序在笔记本中运行而没有像之前那样抱怨tensorflow,没有安装到标准。但是,它确实似乎大量使用了CPU:
和GPU轻轻地说:
$ nvidia-smi
Fri Nov 10 18:13:11 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.26 Driver Version: 375.26 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 105... Off | 0000:01:00.0 On | N/A |
| 0% 49C P0 36W / 72W | 3740MiB / 4030MiB | 28% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 2283 G /usr/lib/xorg/Xorg 273MiB |
| 0 3411 G cinnamon 155MiB |
| 0 14388 C /storageHDD/tensorflow/bin/python3 3307MiB |
+-----------------------------------------------------------------------------+
从jupyter内核输出中的消息看起来它已经有意识地决定使用CPU而不是GPU:
[I 17:20:45.588 NotebookApp] Adapting to protocol v5.1 for kernel a3c0afcc-e525-48e5-8f54-75a349214f96
2017-11-10 17:20:50.857309: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:900] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-11-10 17:20:50.857625: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1061] Found device 0 with properties:
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.43
pciBusID: 0000:01:00.0
totalMemory: 3.94GiB freeMemory: 3.45GiB
2017-11-10 17:20:50.857643: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1151] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
2017-11-10 17:21:43.862726: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "DenseToSparseBatchDataset" device_type: "CPU"') for unknown op: DenseToSparseBatchDataset
2017-11-10 17:21:43.862770: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "GroupByWindowDataset" device_type: "CPU"') for unknown op: GroupByWindowDataset
2017-11-10 17:21:43.862783: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "IgnoreErrorsDataset" device_type: "CPU"') for unknown op: IgnoreErrorsDataset
2017-11-10 17:21:43.862803: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "DatasetToSingleElement" device_type: "CPU"') for unknown op: DatasetToSingleElement
2017-11-10 17:21:43.862817: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "SerializeIterator" device_type: "CPU"') for unknown op: SerializeIterator
2017-11-10 17:21:43.862836: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "DeserializeIterator" device_type: "CPU"') for unknown op: DeserializeIterator
2017-11-10 17:21:43.862845: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "MapAndBatchDataset" device_type: "CPU"') for unknown op: MapAndBatchDataset
2017-11-10 17:21:43.862867: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "ParallelInterleaveDataset" device_type: "CPU"') for unknown op: ParallelInterleaveDataset
2017-11-10 17:21:43.862891: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "ScanDataset" device_type: "CPU"') for unknown op: ScanDataset
2017-11-10 17:21:43.862910: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "SqlDataset" device_type: "CPU"') for unknown op: SqlDataset
2017-11-10 17:21:45.342326: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1151] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
2017-11-10 17:21:45.621793: W tensorflow/core/grappler/utils.cc:48] Node ConstantFolding/training/Adam/gradients/batch_normalization_1/batchnorm/add_grad/BroadcastGradientArgs-0 is not in the graph.
2017-11-10 17:21:45.621852: W tensorflow/core/grappler/utils.cc:48] Node ConstantFolding/training/Adam/gradients/batch_normalization_1/batchnorm/add_grad/BroadcastGradientArgs-1 is not in the graph.
2017-11-10 17:21:45.622311: W tensorflow/core/grappler/utils.cc:48] Node ConstantFolding/training/Adam/gradients/batch_normalization_1/cond/batchnorm/sub_grad/BroadcastGradientArgs-0 is not in the graph.
2017-11-10 17:21:45.622332: W tensorflow/core/grappler/utils.cc:48] Node ConstantFolding/training/Adam/gradients/batch_normalization_1/cond/batchnorm/sub_grad/BroadcastGradientArgs-1 is not in the graph.
2017-11-10 17:21:45.622394: W tensorflow/core/grappler/utils.cc:48] Node ConstantFolding/training/Adam/gradients/batch_normalization_1/batchnorm/sub_grad/BroadcastGradientArgs-0 is not in the graph.
2017-11-10 17:21:45.622411: W tensorflow/core/grappler/utils.cc:48] Node ConstantFolding/training/Adam/gradients/batch_normalization_1/batchnorm/sub_grad/BroadcastGradientArgs-1 is not in the graph.
2017-11-10 17:21:45.622470: W tensorflow/core/grappler/utils.cc:48] Node ConstantFolding/training/Adam/gradients/batch_normalization_2/batchnorm/add_grad/BroadcastGradientArgs-0 is not in the graph.
包含device_type: "CPU"
的所有行的含义是什么?
是否有人知道这是否正常,或者是否可能是某个地方缺少依赖的迹象?
答案 0 :(得分:3)
2017-11-10 17:21:43.862726: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "DenseToSparseBatchDataset" device_type: "CPU"') for unknown op: DenseToSparseBatchDataset
2017-11-10 17:21:43.862770: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "GroupByWindowDataset" device_type: "CPU"') for unknown op: GroupByWindowDataset
2017-11-10 17:21:43.862783: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "IgnoreErrorsDataset" device_type: "CPU"') for unknown op: IgnoreErrorsDataset
2017-11-10 17:21:43.862803: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "DatasetToSingleElement" device_type: "CPU"') for unknown op: DatasetToSingleElement
2017-11-10 17:21:43.862817: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "SerializeIterator" device_type: "CPU"') for unknown op: SerializeIterator
2017-11-10 17:21:43.862836: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "DeserializeIterator" device_type: "CPU"') for unknown op: DeserializeIterator
2017-11-10 17:21:43.862845: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "MapAndBatchDataset" device_type: "CPU"') for unknown op: MapAndBatchDataset
2017-11-10 17:21:43.862867: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "ParallelInterleaveDataset" device_type: "CPU"') for unknown op: ParallelInterleaveDataset
2017-11-10 17:21:43.862891: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "ScanDataset" device_type: "CPU"') for unknown op: ScanDataset
2017-11-10 17:21:43.862910: E tensorflow/core/framework/op_kernel.cc:1142] OpKernel ('op: "SqlDataset" device_type: "CPU"') for unknown op: SqlDataset
此更改已经reverted,并且不再打印警告消息。