How to change between GPU mode and CPU mode in caffe?

4.8k views Asked by At

I compiled Caffe without copying and editing Makefile.config.example. I tried to run a code in caffe and it shows me CPU mode. My question is that whether it is possible to do refinement on the configuration file after caffe installation? if yes, How?

~/caffe-master$ SOME_COMMANDS BLAH BLAH

CPU mode

How can I switch the running from CPU mode to GPU mode and vice versa?

I really appreciate if you help me. I am beginner in both caffe and python. Thanks

1

There are 1 answers

2
Prune On

Where are you getting your Caffe? The official BVLC release comes as a GPU build by default.

First, Makefile.config has a pair of lines:

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

You have to uncomment this to get a CPU-only build.

Then the final line of each solver file is

solver_mode: GPU

You need to change this to CPU to get CPU execution.