安装了 GPU 支持的 Caffe-SSD 错误"Cannot use GPU in CPU-only Caffe"



我已经安装了OpenCV版本3.2.0,CUDA版本9.2.148和CuDNN版本7.2.1.38的caffe-ssd

这些是我在Makefile.config中的设置

# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7 
/usr/local/lib/python2.7/dist-packages/numpy/core/include
# Uncomment to support layers written in Python (will link against    Python libs)
WITH_PYTHON_LAYER := 1
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

所有测试均通过。

[----------] Global test environment tear-down
[==========] 1266 tests from 168 test cases ran. (45001 ms total)
[  PASSED  ] 1266 tests.

此后,我点击此链接获取SSD。LMDB 创建工作没有问题,但是当我运行时

python examples/ssd/ssd_pascal.py

我收到以下错误

I0820 14:16:29.089138 22429 caffe.cpp:217] Using GPUs 0
F0820 14:16:29.089301 22429 common.cpp:66] Cannot use GPU in CPU-only Caffe: check mode.
*** Check failure stack trace: ***
@     0x7f97322a00cd  google::LogMessage::Fail()
@     0x7f97322a1f33  google::LogMessage::SendToLog()
@     0x7f973229fc28  google::LogMessage::Flush()
@     0x7f97322a2999  google::LogMessageFatal::~LogMessageFatal()
@     0x7f973284f8a0  caffe::Caffe::SetDevice()
@     0x55b05fe50dcb  (unknown)
@     0x55b05fe4c543  (unknown)
@     0x7f9730ae3b97  __libc_start_main
@     0x55b05fe4cffa  (unknown)
Aborted (core dumped)

我有 NVIDIA GeForce GTX 1080 Ti 繪卡。

Mon Aug 20 14:26:48 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.51                 Driver Version: 396.51                    |
|-------------------------------+----------------------+----------------------+
| 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 108...  Off  | 00000000:01:00.0 Off |                  N/A |
| 44%   37C    P8    19W / 250W |     18MiB / 11177MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1356      G   /usr/lib/xorg/Xorg                             9MiB |
|    0      1391      G   /usr/bin/gnome-shell                           6MiB |
+-----------------------------------------------------------------------------+

我尝试使用nvcc编译一个简单的 Cuda 代码并毫无问题地运行它。我可以毫无问题地import caffe

我已经检查了这个问题,这不是我的问题。

表示错误错误 == cudaSuccess (7 vs. 0(

在ssd_pascal.py中从gpus = "0,1,2,3"更改为gpus = "0",并在Makefile.config中检查CUDA_DIR中cuda的路径,并使用系统中安装的正确路径和版本对其进行更新。

对于错误"无法在仅 CPU 的 Caffe 中使用 GPU",请使用make test命令再次构建 ssd

相关内容

最新更新