GPU use for caffe not CPU

462 views
Skip to first unread message

JinhoKim

unread,
Mar 27, 2017, 10:32:17 PM3/27/17
to Caffe Users


Hi all, 

I`m struggling to do caffe compile

when I compile caffe, those error are shown up

please give me the answer.

ps, I did uncommnet CPU_ONLY = 1 in Makefile.config and changed solver_mode = GPU



This is the error when I commend,
root@jinhokim:~/caffe# ./examples/mnist/train_lenet.sh 
I0328 11:25:30.682950 21848 caffe.cpp:218] Using GPUs 0
F0328 11:25:30.683099 21848 common.cpp:66] Cannot use GPU in CPU-only Caffe: check mode.
*** Check failure stack trace: ***
    @     0x7fb7e2a255cd  google::LogMessage::Fail()
    @     0x7fb7e2a27433  google::LogMessage::SendToLog()
    @     0x7fb7e2a2515b  google::LogMessage::Flush()
    @     0x7fb7e2a27e1e  google::LogMessageFatal::~LogMessageFatal()
    @     0x7fb7e2da1270  caffe::Caffe::SetDevice()
    @           0x40a81b  train()
    @           0x406de0  main
    @     0x7fb7e198f830  __libc_start_main
    @           0x407609  _start
    @              (nil)  (unknown)
Aborted (core dumped)



This is Makefile.config.example
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1

# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0


This is Makefile.config
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1

# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
#       You should not set this flag if you will be reading LMDBs with any
#       possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1


This is lenet_solver.prototxt
# The learning rate policy
lr_policy: "inv"
gamma: 0.0001
power: 0.75
# Display every 100 iterations
display: 100
# The maximum number of iterations
max_iter: 10000
# snapshot intermediate results
snapshot: 5000
snapshot_prefix: "examples/mnist/lenet"
# solver mode: CPU or GPU
solver_mode: GPU
                                                             25,1          Bot


Please help me TT

Mert

unread,
Mar 29, 2017, 3:26:23 AM3/29/17
to Caffe Users
Hi,

i guess you have to disable CPU_ONLY mode, by commenting the line "CPU_ONLY=1".

hope it helps.

28 Mart 2017 Salı 05:32:17 UTC+3 tarihinde JinhoKim yazdı:

Porschen Hund

unread,
Mar 29, 2017, 4:28:34 AM3/29/17
to Caffe Users

'
F0328 11:25:30.683099 21848 common.cpp:66] Cannot use GPU in CPU-only Caffe: check mode.
'

Maybe you should use CPU as yor solver mode ?

JinhoKim

unread,
Mar 29, 2017, 6:13:40 AM3/29/17
to Caffe Users
I did it already....
But the result was same TT still now...!

I don`t really know how to solve this problem!!

When I change all of mode to CPU, it works very well but soooo slowly. cuz it works based on CPU!!

I have GTX 1060 for this caffe. 

Do you have another solution for it???

what should I check more?

2017년 3월 29일 수요일 오후 4시 26분 23초 UTC+9, Mert 님의 말:

Przemek D

unread,
Mar 29, 2017, 7:20:30 AM3/29/17
to Caffe Users
Run
make clean
comment back this
CPU_ONLY := 1
and compile everything again. Then change your solver mode back to GPU.

CPU_ONLY means you don't want any GPU support in your executable. Calling a GPU solver in a non-GPU compilation obviously results in an error.

JinhoKim

unread,
Mar 29, 2017, 7:50:34 AM3/29/17
to Caffe Users
Thx Prezemek!!

but could you explain it more exactly?? TT

what is "compile everything" mean??

And if I uncomment "CPU_ONLY := 1", I can`t run "make runtest", "make all", "make" cuz of error. 

But still have same error when I run "./example/mnist/train_lenet.sh"

Do you understand what I`m saying?? TT I`m pretty bad at English so I`m worried whether you understand if or not.

Hope you help me. Thanks again

2017년 3월 29일 수요일 오후 8시 20분 30초 UTC+9, Przemek D 님의 말:

Przemek D

unread,
Mar 29, 2017, 8:20:31 AM3/29/17
to Caffe Users
By "compile everything" I meant everything you need to run caffe. make all, probably make runtest too, make pycaffe if you use Python interface etc.
I told you to comment CPU_ONLY := 1, not uncomment it. What happens if you do that? Read your error logs, post them here if you don't understand.

JinhoKim

unread,
Mar 31, 2017, 3:58:00 AM3/31/17
to Caffe Users
Thank you,
I solved it by recompiling all of it as like you told me. 

2017년 3월 29일 수요일 오후 9시 20분 31초 UTC+9, Przemek D 님의 말:
Reply all
Reply to author
Forward
0 new messages