Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU only mode in Caffe #2241

Closed
azamosavi opened this issue Apr 2, 2015 · 9 comments
Closed

CPU only mode in Caffe #2241

azamosavi opened this issue Apr 2, 2015 · 9 comments

Comments

@azamosavi
Copy link

We have installed Caffe and all its prerequisites except CUDA on Fedora. We want to run Caffe in CPU mode and we have made changes to support this by changing the config file during installation as well as prototxt files.
However, when we run the Matlab script calling Caffe:
caffe('set_device', 1);

we get the following error:
Logging before InitGoogleLogging() is written to STDERR
F0401 22:36:01.857090 18173 common.cpp:55] Cannot use GPU in CPU-only Caffe: check mode.

I was wondering if anyone can help us CPU only mode for Caffe in Matlab.

@sbrugman
Copy link

sbrugman commented Apr 3, 2015

I get the same error when reproducing the steps from https://github.com/BVLC/caffe/tree/master/examples/finetune_flickr_style in CPU-mode. "Now we can train! (You can fine-tune in CPU mode by leaving out the -gpu flag.)"

caffe % ./build/tools/caffe train -solver models/finetune_flickr_style/solver.prototxt -weights models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel

I0403 18:09:40.822396 7323 caffe.cpp:113] Use GPU with device ID 0
F0403 18:09:40.822931 7323 common.cpp:55] Cannot use GPU in CPU-only Caffe: check mode.
*** Check failure stack trace: ***
@ 0x7f901eccedaa (unknown)
@ 0x7f901eccece4 (unknown)
@ 0x7f901ecce6e6 (unknown)
@ 0x7f901ecd1687 (unknown)
@ 0x7f901f0d5af0 caffe::Caffe::SetDevice()
@ 0x406312 train()
@ 0x404901 main
@ 0x7f901e1e0ec5 (unknown)
@ 0x404ead (unknown)
@ (nil) (unknown)

@abhaysac
Copy link

abhaysac commented Apr 3, 2015

models/finetune_flickr_style/solver.prototxt, uncomment the last line.

On Fri, Apr 3, 2015 at 9:42 PM, Simon Brugman notifications@github.com
wrote:

I get the same error when reproducing the steps from
https://github.com/BVLC/caffe/tree/master/examples/finetune_flickr_style
in CPU-mode. "Now we can train! (You can fine-tune in CPU mode by leaving
out the -gpu flag.)"

caffe % ./build/tools/caffe train -solver
models/finetune_flickr_style/solver.prototxt -weights
models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel

I0403 18:09:40.822396 7323 caffe.cpp:113] Use GPU with device ID 0
F0403 18:09:40.822931 7323 common.cpp:55] Cannot use GPU in CPU-only
Caffe: check mode.
*** Check failure stack trace: ***
@ 0x7f901eccedaa (unknown)
@ 0x7f901eccece4 (unknown)
@ 0x7f901ecce6e6 (unknown)
@ 0x7f901ecd1687 (unknown)
@ 0x7f901f0d5af0 caffe::Caffe::SetDevice()
@ 0x406312 train()
@ 0x404901 main
@ 0x7f901e1e0ec5 (unknown)
@ 0x404ead (unknown)
@ (nil) (unknown)


Reply to this email directly or view it on GitHub
#2241 (comment).

@azamosavi
Copy link
Author

The problem is solved, in CPU mode we should not call
caffe('set_device', 1)
This line of code is just for using GPU mode.

@hana9090
Copy link

@azamosavi
Please, where I can i found this line of code?

@azamosavi
Copy link
Author

@hana9090
Just look for set_device in your code. if its 1 comment the line cause its for GPU mode.

@blackdusts
Copy link

If you choose "only cpu" mode, except you should delete "#" in "# CPU_ONLY := 1" of Makefile.config. and you also should modify something in your example. For example, if you train MNIST, you should modify file "lenet_solver.prototxt" in /your caffe path/examples/MNIST, in the last line of this file ,you should modify solver mode to be CPU.

@annanurov
Copy link

...and how do you "modify solver to be CPU"?
>caffe train -solver=lenet.prototxt -cpu?

Thank you

@annanurov
Copy link

OK, just found it. Never mind....:P

@ahlemlouma
Copy link

i have the same problem can someone help me plz
F0929 20:55:49.671247 6050 base_data_layer.cpp:84] Cannot use GPU in CPU-only Caffe: check mode.
*** Check failure stack trace: ***
Aborted (core dumped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants