我正试图让Keras CNN在GPU上运行,但不会,而且我不知道怎么做。
nvidia-smi
的输出:
Sat Jun 22 22:28:01 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.116 Driver Version: 390.116 |
|-------------------------------+----------------------+----------------------+
| 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 GT 755M Off | 00000000:01:00.0 N/A | N/A |
| N/A 79C P0 N/A / N/A | 179MiB / 1991MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
| 1 GeForce GT 755M Off | 00000000:07:00.0 N/A | N/A |
| N/A 64C P0 N/A / N/A | 2MiB / 1999MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
| 1 Not Supported |
+-----------------------------------------------------------------------------+
我使用的是运行python3
的脚本,以查看tf运行的设备:
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
我从中得到的输出:
2019-06-22 21:17:07.250488: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-06-22 21:17:07.269140: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2019-06-22 21:17:07.327260: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-06-22 21:17:07.328750: I tensorflow/compiler/xla/service/platform_util.cc:197] StreamExecutor cuda device (0) is of insufficient compute capability: 3.5 required, device is 3.0
2019-06-22 21:17:07.329374: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-06-22 21:17:07.330012: I tensorflow/compiler/xla/service/platform_util.cc:197] StreamExecutor cuda device (1) is of insufficient compute capability: 3.5 required, device is 3.0
2019-06-22 21:17:07.330278: F tensorflow/stream_executor/lib/statusor.cc:34] Attempting to fetch value instead of handling error Internal: no supported devices found for platform CUDA
Aborted (core dumped)
据此,我了解到我可能未使用正确的CUDA版本,因为我的GPU(GeForce 755M)具有3.0计算能力,并且由于需要3.5,因此某些地方必须不兼容。
在NVIDIA网站上,我读到我需要CUDA 9.0才能与3.0计算功能兼容,但是我的CUDA是9.0。
nvcc -V
的输出:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176
这是什么问题,如何解决,以便tensorflow将在GPU上运行?