Cannot use GPU in CPU-only Caffe: check mode. caffe::Caffe::SetDevice().

3,220 views
Skip to first unread message

Chias JaJa

unread,
Nov 16, 2015, 1:15:06 PM11/16/15
to Caffe Users
I1116 22:38:46.777232 21924 caffe.cpp:184] Using GPUs 0
F1116 22:38:46.777487 21924 common.cpp:66] Cannot use GPU in CPU-only Caffe: check mode.
*** Check failure stack trace: ***
    @     0x7f1c76174daa  (unknown)
    @     0x7f1c76174ce4  (unknown)
    @     0x7f1c761746e6  (unknown)
    @     0x7f1c76177687  (unknown)
    @     0x7f1c7669cf90  caffe::Caffe::SetDevice()
    @           0x40a5a6  train()
    @           0x4081e1  main
    @     0x7f1c74ed5ec5  (unknown)
    @           0x40899d  (unknown)
    @              (nil)  (unknown)
Aborted (core dumped)

Use VM_Ubuntu_64:
I am already set the Makefile.config
Uncomment the line # CPU_ONLY := 1
and
--   BUILD_SHARED_LIBS :   ON
--   BUILD_python      :   ON
--   BUILD_matlab      :   OFF
--   BUILD_docs        :   ON
--   CPU_ONLY          :   ON
--   USE_OPENCV        :   ON
--   USE_LEVELDB       :   ON
--   USE_LMDB          :   ON
--   ALLOW_LMDB_NOLOCK :   OFF
and
solver_mode: CPU in 
hdf5_classification/solver.prototxt
finetune_flickr_style/solver.prototxt
mnist/lenet_solver.prototxt
bvlc_googlenet/quick_solver.prototxt
.....other about solver.prototxt files.

how to solve my question? where is wrong?
(this question in Attached Files)

thanks.
01.png

Jan C Peters

unread,
Nov 17, 2015, 3:29:45 AM11/17/15
to Caffe Users
Well obviously you compiled caffe in CPU-only mode (look at your Makefile.config) but still try to use it in GPU-mode, which obviously doesn't work. Either recompile caffe with GPU features (you need an NVidia card and CUDA for that) or change the solver you use to CPU mode (There is a wuite obvious flag in there).

Jan

Chias JaJa

unread,
Nov 18, 2015, 1:07:39 AM11/18/15
to Caffe Users
I am already to try again.
what is your mean for "change the solver you use to CPU mode (There is a wuite obvious flag in there)"?
that is in caffe.cpp? or common.cpp ? 
Help me , plz .

Chias JaJa於 2015年11月17日星期二 UTC+8上午2時15分06秒寫道:

Chias JaJa

unread,
Nov 18, 2015, 1:13:10 AM11/18/15
to Caffe Users
and 
solver_mode: CPU in 
hdf5_classification/solver.prototxt
finetune_flickr_style/solver.prototxt
mnist/lenet_solver.prototxt
bvlc_googlenet/quick_solver.prototxt
.....other about solver.prototxt files.

Chias JaJa於 2015年11月17日星期二 UTC+8上午2時15分06秒寫道:

Jan C Peters

unread,
Nov 23, 2015, 3:00:48 AM11/23/15
to Caffe Users
When the solver you use contains the line "solver_mode: CPU" and you compiled caffe with CPU_ONLY set in Makefile.config everything should work fine. What command have you executed to get that output from your first post? Maybe try to recompile everything (make clean && make all)

Jan

OL

unread,
Apr 13, 2016, 1:32:45 PM4/13/16
to Caffe Users
Hi Chias, were you able to solve this?

Francisco Vargas

unread,
Sep 7, 2016, 5:24:31 PM9/7/16
to Caffe Users
Solver where? the vagueness in these responses are very unhelpful. I compiled everything with cpu only however still have this issue. The docs are not very great with this either.

duraau...@gmail.com

unread,
Jan 11, 2017, 4:53:57 PM1/11/17
to Caffe Users
 In the solver file there should be one line "solver_mode: GPU", change this line to  "solver_mode: CPU".
OK

Przemek D

unread,
Jan 12, 2017, 3:17:13 AM1/12/17
to Caffe Users
 In the solver file there should be one line "solver_mode: GPU", change this line to  "solver_mode: CPU".
No! The error is caused way earlier, on the compilation stage. Look in your Makefile.config, search for the line
# CPU_ONLY := 1
or
CPU_ONLY := 1
If you find this line uncommented, caffe gets compiled - obviously - for use only with CPU.

Reply all
Reply to author
Forward
0 new messages