~/work/caffe@cherry-com(20205)$ ./examples/mnist/train_lenet.sh
I0127 22:19:24.988464 29691 caffe.cpp:99] Use GPU with device ID 0
F0127 22:19:24.988605 29691 common.cpp:53] CPU-only Mode: cannot make GPU call.
*** Check failure stack trace: ***
@ 0x7fd445fa6dbd google::LogMessage::Fail()
@ 0x7fd445fa8c5d google::LogMessage::SendToLog()
@ 0x7fd445fa69ac google::LogMessage::Flush()
@ 0x7fd445fa957e google::LogMessageFatal::~LogMessageFatal()
@ 0x44c040 caffe::Caffe::SetDevice()
@ 0x411bb5 train()
@ 0x40eff1 main
@ 0x7fd44301eec5 (unknown)
@ 0x410767 (unknown)
Aborted (core dumped)
when the CPU_ONLY option is 1 in Makefile.config, modify the gpu option to cpu in the prototxt file as below
$ vi examples/mnist/lenet_solver.prototxt
<<<<<<<<<<<<<<<<<<<< before
24 # solver mode: CPU or GPU
25 solver_mode: GPU
-------------------------------------------
24 # solver mode: CPU or GPU
25 solver_mode: CPU
>>>>>>>>>>>>>>>>>>>>> after
@stray-leone exactly right, and thanks for following up with your own answer. However please ask usage questions on the caffe-users mailing list next time.
p.s. 1f7c3de tries to make the error message for attempting GPU computation in CPU-only mode a little more clear.
I have the same error with you and I solved it by modifying prototxt file .But duing training the new error occurs :
I0523 01:20:37.636919 21047 solver.cpp:257] Optimization Done.
I0523 01:20:37.636941 21047 caffe.cpp:134] Optimization Done.
I0523 01:20:37.992230 26546 caffe.cpp:113] Use GPU with device ID 0
F0523 01:20:37.992537 26546 common.cpp:55] Cannot use GPU in CPU-only Caffe: check mode.
what's the matter ?
hello, i follow your suggestion,and modify the GPU to the CPU in the lenet_solver.prototxt file:
solver_mode: CPU
however, i get the same error like before:
I1020 16:10:16.989020 22222 layer_factory.hpp:76] Creating layer mnist
I1020 16:10:16.989456 22222 net.cpp:106] Creating Layer mnist
F1020 16:10:16.989483 22223 db.cpp:20] Unknown database backend
* Check failure stack trace: *
I1020 16:10:16.989485 22222 net.cpp:411] mnist -> data
I1020 16:10:16.989722 22222 net.cpp:411] mnist -> label
@ 0x7fead22589fd google::LogMessage::Fail()
@ 0x7fead225a89d google::LogMessage::SendToLog()
@ 0x7fead22585ec google::LogMessage::Flush()
@ 0x7fead225b1be google::LogMessageFatal::~LogMessageFatal()
@ 0x7fead25fcdbc caffe::db::GetDB()
@ 0x7fead26290ec caffe::DataReader::Body::InternalThreadEntry()
@ 0x7fead0b91a4a (unknown)
@ 0x7fead0449182 start_thread
@ 0x7fead1a6847d (unknown)
Aborted (core dumped)
so , what's the problem ? thaks!
I check again,and find that i can't creat lmdb file. Look here:https://github.com/BVLC/caffe/issues/3223
It's very strange!
I have solved "can't creat lmdb " .
And typing again: ./examples/mnist/train_lenet.sh.
I get the same error!
I1022 11:18:55.776268 18873 layer_factory.hpp:76] Creating layer mnist
I1022 11:18:55.776710 18873 net.cpp:106] Creating Layer mnist
F1022 11:18:55.776751 18874 db.cpp:20] Unknown database backend
* Check failure stack trace: *
I1022 11:18:55.776756 18873 net.cpp:411] mnist -> data
I1022 11:18:55.777053 18873 net.cpp:411] mnist -> label
@ 0x7f7afba9b11d google::LogMessage::Fail()
@ 0x7f7afba9cfbd google::LogMessage::SendToLog()
@ 0x7f7afba9ad38 google::LogMessage::Flush()
@ 0x7f7afba9d81e google::LogMessageFatal::~LogMessageFatal()
@ 0x7f7afbe29f6c caffe::db::GetDB()
@ 0x7f7afbe5629c caffe::DataReader::Body::InternalThreadEntry()
@ 0x7f7afa1b3a4a (unknown)
@ 0x7f7af9a6b182 start_thread
@ 0x7f7afb08a47d (unknown)
Aborted (core dumped)
then I enter these;
(caffe_root)
cd build
cmake ..
make
I found a strange thing:
-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : OFF
-- USE_LMDB : ON
-- USE_LEVELDB : ON
-- USE_OPENCV : ON
the result shows CUP_ONLY is OFF, but I'm sure i has set CPU_ONLY=1.
so what's the wrong?
@fanser You need to modify CMakeLists.txt in the root folder to turn on CPU_ONLY.
This is partly a usage issue but perhaps also partly a documentation issue. I think we should add the PR message in #1667 to docs, and mention the CMakeLists.txt.
However please ask these questions on the caffe-users mailing list next time.
@ronghanghu thank you! It succeed.
but I have another doubt,when i use the latest caffe version.
if I type:
(caffe_root)
make clean
make
then type the following to create lmdb data
./examples/mnist/create_mnist.sh
However I get error and can't create.
look here:https://github.com/BVLC/caffe/issues/3223
If I change the way, type:
(caffe_root)
cd build
cmake ..
make
then create successful!
So is this a bug ? Or just happens on my computer?
I solved the problem by setting
default = 1
in
parser.add_argument('--cpu', dest='cpu_mode',
help='Use CPU mode (overrides --gpu)',
action='store_true', default = 1)
in Makefile.config, uncomment these lines:
CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1
uncomment to disable IO dependencies and corresponding data layers
USE_OPENCV := 1
USE_LEVELDB := 1
USE_LMDB := 1
if you have compiled, use commands:
make clean
make -j 20
make test -j 20
make runtest
make pycaffe
make distibute
to recompile all
it works for me !
@AlexTS1980
Please, where did you change this piece of code?
so what's the solution? Although I use CPU solver, I get the same error, too.
Most helpful comment
when the CPU_ONLY option is 1 in Makefile.config, modify the gpu option to cpu in the prototxt file as below