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

Could GOTURN be run with CPU only? #39

Closed
akita1987 opened this Issue Mar 1, 2017 · 19 comments

Comments

Projects
None yet
9 participants
@akita1987

akita1987 commented Mar 1, 2017

I find simply uncomment some lines related to Caff and CUDA in CMakeLists.txt,then I met some fatal error like "/home/wxb/git/caffe/GOTURN/src/network/regressor.h:4:27: fatal error: caffe/caffe.hpp: No such file or directory". I guess GOTURN can not be run without GPU and CUDA installed.

But I found some information in your paper:
"On an Nvidia GeForce GTX Titan X GPU with cuDNN acceleration, our tracker runs at 6.05 ms per frame (not including the 1 ms to load each image in OpenCV), or 165 fps. On a GTX 680 GPU, our tracker runs at an average of 9.98 ms per frame, or 100 fps. If only a CPU is available, the tracker runs at 2.7 fps."

Look at the bold text, does that mean GOTURN can be run with CPU only?If that's true, what should I do?

Thank you!

@davheld

This comment has been minimized.

Show comment
Hide comment
@davheld

davheld Mar 1, 2017

Owner

It's been a while, but I believe you can just add
#define CPU_ONLY 1
at the top of your main cpp file.

Owner

davheld commented Mar 1, 2017

It's been a while, but I believe you can just add
#define CPU_ONLY 1
at the top of your main cpp file.

@akita1987

This comment has been minimized.

Show comment
Hide comment
@akita1987

akita1987 Mar 2, 2017

@davheld Thank you for your help, but I don't really know which cpp file I should add this statement to? I add it to src/train/train.cpp, then I get an error below:
screenshot from 2017-03-02 12-38-36
It is failed when I try to cmake . I don't know what's wrong. Could you please tell me which cpp file I should add it to?
Many thanks!

akita1987 commented Mar 2, 2017

@davheld Thank you for your help, but I don't really know which cpp file I should add this statement to? I add it to src/train/train.cpp, then I get an error below:
screenshot from 2017-03-02 12-38-36
It is failed when I try to cmake . I don't know what's wrong. Could you please tell me which cpp file I should add it to?
Many thanks!

@davheld

This comment has been minimized.

Show comment
Hide comment
@davheld

davheld Mar 2, 2017

Owner

If you are not using the GPU, then you should remove the lines about CUDA from the CMakeLists.txt.

Owner

davheld commented Mar 2, 2017

If you are not using the GPU, then you should remove the lines about CUDA from the CMakeLists.txt.

@akita1987

This comment has been minimized.

Show comment
Hide comment
@akita1987

akita1987 Mar 2, 2017

Follow your instruction, I configure my CMakeLists.txt like this:

cmakelists

and I also configure GOTURN/cmake/Modules/FindCaffe.cmake like this:

findcaffe

After all are done, I excute cmake in /build directory, and it successes with only a few warnings like this:

"WARNING: Target "test_tracker_alov" requests linking to directory "/home/wxb/git/caffe/build/lib". Targets may link only to libraries. CMake is dropping the item."

But after I excute "make" order, a fatal error happend:

fatal_error

Can't find "cublas_v2.h". That's weird. I open the file "device_alternate.hpp", locate to line 34 and find that "cublas_v2.h" will be included only if CPU_ONLY=0. But I certainly define CPU_ONLY=1 in Makefile.configure before installing caffe.

I google a lot and find some people have the same problem(BVLC/caffe#2704). I still don't know how to solve the error. Do you have any idea about this error? I hope not wasting you too much time.Thank you very much.

akita1987 commented Mar 2, 2017

Follow your instruction, I configure my CMakeLists.txt like this:

cmakelists

and I also configure GOTURN/cmake/Modules/FindCaffe.cmake like this:

findcaffe

After all are done, I excute cmake in /build directory, and it successes with only a few warnings like this:

"WARNING: Target "test_tracker_alov" requests linking to directory "/home/wxb/git/caffe/build/lib". Targets may link only to libraries. CMake is dropping the item."

But after I excute "make" order, a fatal error happend:

fatal_error

Can't find "cublas_v2.h". That's weird. I open the file "device_alternate.hpp", locate to line 34 and find that "cublas_v2.h" will be included only if CPU_ONLY=0. But I certainly define CPU_ONLY=1 in Makefile.configure before installing caffe.

I google a lot and find some people have the same problem(BVLC/caffe#2704). I still don't know how to solve the error. Do you have any idea about this error? I hope not wasting you too much time.Thank you very much.

@davheld

This comment has been minimized.

Show comment
Hide comment
@davheld

davheld Mar 2, 2017

Owner

Did you build CAFFE with -DCPU_ONLY?

Owner

davheld commented Mar 2, 2017

Did you build CAFFE with -DCPU_ONLY?

@akita1987

This comment has been minimized.

Show comment
Hide comment
@akita1987

akita1987 Mar 2, 2017

NO, shoud I build Caffe like order below?

cmake -D CPU_ONLY=ON ..

akita1987 commented Mar 2, 2017

NO, shoud I build Caffe like order below?

cmake -D CPU_ONLY=ON ..

@davheld

This comment has been minimized.

Show comment
Hide comment
@davheld

davheld Mar 2, 2017

Owner
Owner

davheld commented Mar 2, 2017

@akita1987

This comment has been minimized.

Show comment
Hide comment
@akita1987

akita1987 Mar 2, 2017

I add -DCPU_ONLY when build Caffe and all are normal. But when building GOTURN, the error is still there, even when I try to build GOTURN with -DCPU_ONLY.

This error almost made me crazy now. I want to give up and be back to my lab's server. Anyway, I appreciate your help, you help me a lot. Now I'm reading the source, if I have any questions, could I email you?

Thanks a lot! Have a good weekend!

akita1987 commented Mar 2, 2017

I add -DCPU_ONLY when build Caffe and all are normal. But when building GOTURN, the error is still there, even when I try to build GOTURN with -DCPU_ONLY.

This error almost made me crazy now. I want to give up and be back to my lab's server. Anyway, I appreciate your help, you help me a lot. Now I'm reading the source, if I have any questions, could I email you?

Thanks a lot! Have a good weekend!

@akita1987

This comment has been minimized.

Show comment
Hide comment
@akita1987

akita1987 Mar 3, 2017

@davheld Hi, finally I solved all errors and now I can run GOTURN with CPU only on my ubuntu 16.04LTD. Here are my advices:
(1)To run with CPU only, uncomment CPU_ONLY=1 and TEST_GPUID := 0, and comment all items related to CUDA. Then compile Caffe with "cmake -DCPU_ONLY=ON .." in /build directory, if not , you may find CPU_ONLY equal OFF in the return information of cmake . Also you should add "#define CPU_ONLY 1" to all header files in /src/network directory. Beside , I also follow @davheld's advice and add it to other main cpp files in other directory like /train.
(2)After Caffe is successfully installed and tested, firstly install trax (#2) (just download and make it), or you will meet errors like "undefined reference to `trax_server_setup" during make. Then configure GOTURN/CMakeLists.txt like below:

screenshot from 2017-03-03 11-52-17
screenshot from 2017-03-03 11-53-15
(Caff_LIBRARIES should be set to /path-to-caffe/build/install/lib/libcaffe.so, not /path-to-caffe/build/install/lib. If not , errors like "Target:...requests linking to directory ...Targets may link only to libraries. CMake is dropping")

and congiure GOTURN/cmake/Modules/FindCaffe.cmake like this:

screenshot from 2017-03-03 11-55-58

(3)Finally, build GOTURN using "cmake -DCPU_ONLY=ON .." and then make it.
Maybe some statments are reduntant, but I meet a hell lot of errors before I configure these two files right. @davheld gives me a lot help, thank you again!

akita1987 commented Mar 3, 2017

@davheld Hi, finally I solved all errors and now I can run GOTURN with CPU only on my ubuntu 16.04LTD. Here are my advices:
(1)To run with CPU only, uncomment CPU_ONLY=1 and TEST_GPUID := 0, and comment all items related to CUDA. Then compile Caffe with "cmake -DCPU_ONLY=ON .." in /build directory, if not , you may find CPU_ONLY equal OFF in the return information of cmake . Also you should add "#define CPU_ONLY 1" to all header files in /src/network directory. Beside , I also follow @davheld's advice and add it to other main cpp files in other directory like /train.
(2)After Caffe is successfully installed and tested, firstly install trax (#2) (just download and make it), or you will meet errors like "undefined reference to `trax_server_setup" during make. Then configure GOTURN/CMakeLists.txt like below:

screenshot from 2017-03-03 11-52-17
screenshot from 2017-03-03 11-53-15
(Caff_LIBRARIES should be set to /path-to-caffe/build/install/lib/libcaffe.so, not /path-to-caffe/build/install/lib. If not , errors like "Target:...requests linking to directory ...Targets may link only to libraries. CMake is dropping")

and congiure GOTURN/cmake/Modules/FindCaffe.cmake like this:

screenshot from 2017-03-03 11-55-58

(3)Finally, build GOTURN using "cmake -DCPU_ONLY=ON .." and then make it.
Maybe some statments are reduntant, but I meet a hell lot of errors before I configure these two files right. @davheld gives me a lot help, thank you again!

akita1987 added a commit to akita1987/GOTURN that referenced this issue Mar 3, 2017

Create CMakeLists_CPU_only.txt
I use this makefile to run GOTURN with CPU only on Ubuntu 16.04LTD. 
NOTE: I compile GOTURN like:
mkdir build & cd build
sudo cmake -DCPU_ONLY=ON ..
sudo make
Other tips about compile Caffe, see my issue on davheld#39
@Chen-Su

This comment has been minimized.

Show comment
Hide comment
@Chen-Su

Chen-Su Mar 3, 2017

@akita1987 Hi, I wanna test this amazing alg in CPU mode too.
Could you tell me how to run the program to test VOT2014? or did you change the scripts in bash folder?
Thank you !

Chen-Su commented Mar 3, 2017

@akita1987 Hi, I wanna test this amazing alg in CPU mode too.
Could you tell me how to run the program to test VOT2014? or did you change the scripts in bash folder?
Thank you !

@SoulmateB

This comment has been minimized.

Show comment
Hide comment
@SoulmateB

SoulmateB Mar 4, 2017

@akita1987 I have followed your advices, and add "#define CPU_ONLY 1" to the header files in /src/network ,and add it to the other main cpp, but I also have the same problem "cublas_v2.h:no such file...". Could you please tell me the details? which cpp file I should add it to? Thank you !!

SoulmateB commented Mar 4, 2017

@akita1987 I have followed your advices, and add "#define CPU_ONLY 1" to the header files in /src/network ,and add it to the other main cpp, but I also have the same problem "cublas_v2.h:no such file...". Could you please tell me the details? which cpp file I should add it to? Thank you !!

@akita1987

This comment has been minimized.

Show comment
Hide comment
@akita1987

akita1987 Mar 5, 2017

@SoulmateB Hi, you may try to add " -DCPU_ONLY=ON" when cmake GOTURN in /build directory.

akita1987 commented Mar 5, 2017

@SoulmateB Hi, you may try to add " -DCPU_ONLY=ON" when cmake GOTURN in /build directory.

@akita1987

This comment has been minimized.

Show comment
Hide comment
@akita1987

akita1987 Mar 5, 2017

@ChaselS314 Sorry I 'm working on your problem too. But I believe you can find a way link in README file.

akita1987 commented Mar 5, 2017

@ChaselS314 Sorry I 'm working on your problem too. But I believe you can find a way link in README file.

@bei91

This comment has been minimized.

Show comment
Hide comment
@bei91

bei91 Jun 30, 2017

@SoulmateB I also have the same problem. Could you please tell me your solution? Thank you!

bei91 commented Jun 30, 2017

@SoulmateB I also have the same problem. Could you please tell me your solution? Thank you!

@davheld davheld closed this in #43 Jul 11, 2017

@davheld

This comment has been minimized.

Show comment
Hide comment
@davheld

davheld Jul 11, 2017

Owner

I just merged #43 by @brunobowden which should solve this issue. Let me know if there is still a problem.

Owner

davheld commented Jul 11, 2017

I just merged #43 by @brunobowden which should solve this issue. Let me know if there is still a problem.

@shouguicai

This comment has been minimized.

Show comment
Hide comment
@shouguicai

shouguicai Oct 10, 2017

I am trying to train the caffe model on cpu only server(which has 64 cups), only one cup is used.
Can i set the it to use as much cpu as i have to train,just like tensorflow do?

shouguicai commented Oct 10, 2017

I am trying to train the caffe model on cpu only server(which has 64 cups), only one cup is used.
Can i set the it to use as much cpu as i have to train,just like tensorflow do?

@foolwood

This comment has been minimized.

Show comment
Hide comment
@foolwood

foolwood Oct 24, 2017

@shouguicai
you can try our matconvnet version.(not official)
https://github.com/foolwood/GOTURN_matconvnet

It's rather fast in CPU.

foolwood commented Oct 24, 2017

@shouguicai
you can try our matconvnet version.(not official)
https://github.com/foolwood/GOTURN_matconvnet

It's rather fast in CPU.

@pengfeix

This comment has been minimized.

Show comment
Hide comment
@pengfeix

pengfeix Nov 7, 2017

[ 57%] Building CXX object CMakeFiles/test_tracker_alov.dir/src/test/test_tracker_alov.cpp.o
make[2]: *** No rule to make target '/home/xpf/task1/caffe/build/lib/libcaffeproto.a', needed by 'test_tracker_alov'。 停止。
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/test_tracker_alov.dir/all' failed
make[1]: *** [CMakeFiles/test_tracker_alov.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
When I compiled the goturn,I met this error,could you give me any help?

pengfeix commented Nov 7, 2017

[ 57%] Building CXX object CMakeFiles/test_tracker_alov.dir/src/test/test_tracker_alov.cpp.o
make[2]: *** No rule to make target '/home/xpf/task1/caffe/build/lib/libcaffeproto.a', needed by 'test_tracker_alov'。 停止。
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/test_tracker_alov.dir/all' failed
make[1]: *** [CMakeFiles/test_tracker_alov.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
When I compiled the goturn,I met this error,could you give me any help?

@pengxin99

This comment has been minimized.

Show comment
Hide comment
@pengxin99

pengxin99 Dec 18, 2017

@pengfeix
try to git trax form https://github.com/votchallenge/trax.git,and then compile it by cmake, make like what guturn did .

pengxin99 commented Dec 18, 2017

@pengfeix
try to git trax form https://github.com/votchallenge/trax.git,and then compile it by cmake, make like what guturn did .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment