Closed abhigoku10 closed 7 years ago
Hi abhigoku10, did you also post on the darknet group ? In any case, this is what you need to do to make it work on CPU:
Now you should be able to compile darknet with the Makefile.
After that you should be able to compile the C++ part of the wrapper.
I think this should be enough to make it work. Unfortunately, I can't test it right now.
I'm very happy that my wrapper is helping you. Best of luck with the cpu compilation, keep me posted.
@lhk thanks for the quick response . I am trying to follow the steps which you had suggested . Having doubt inthe makefile and cmakelist.txt
Earlier i have build it gpu system and it was working very good . I am testing with changes suggested just reconfirming this is the changes you meant
Thanking you a ton lot
Hm, I'm sorry, it's probably not that easy after all. I just reread our makefiles and scripts. Here's more tips on how to get it to work:
The Makefile is for compiling darknet itself. That is C code and uses the gcc compiler, you don't have to switch it to g++.
You need to set GPU=0 at the top of the Makefile to switch off Cuda compilation. That is here https://github.com/lhk/darknet_wrapper/blob/ede308df0e135da6182b6ccc2040e94899ac3892/darknet/Makefile#L1
And I've reread the Makefile code, we are adding some cuda dependencies in the opencv section. You'll probably have to remove everything that mentions cude, here too: https://github.com/lhk/darknet_wrapper/blob/ede308df0e135da6182b6ccc2040e94899ac3892/darknet/Makefile#L37
In the CMake file, you should remove everything that depends on CUDA. The package, the directories, the libraries.
Unfortunately we also build opencv with CUDA support. You wanted to know if opencv320 is necessary, I honestly don't know. I think it should be fine. We only used opencv320 because other components in the system depended on it. But for this code, I don't think that the difference is critical. That being said you should keep it in mind as a potential source of errors. If you have a working opencv310 installation, you should try to include that in the CMakeLists.txt To do that, you need to set this directory: https://github.com/lhk/darknet_wrapper/blob/ede308df0e135da6182b6ccc2040e94899ac3892/CMakeLists.txt#L6
Building something with opencv can be quite tricky. That opencv installation bash script is meant to do the job for you. If you can't get your opencv310 to work, I would recomment using the bashscript to install 320. You'll have to edit this, too. Since we are compiling opencv with CUDA support. Switch off CUDA support in this line: https://github.com/lhk/darknet_wrapper/blob/ede308df0e135da6182b6ccc2040e94899ac3892/install_opencv320.bash#L30
@lhk i have played around this steps and i am pretty much successful till the end one i . e in the cmakelist for this line "target_link_libraries(main ${OpenCV_LIBS} cuda cudart cublas curand darknet)" should i remove all the cuda stuffs and just have "target_link_libraries(main ${OpenCV_LIBS} darknet)" or "target_link_libraries(main ${OpenCV_LIBS} )"
can u pls look into the cmakelist.txt and let me knw if i need to make the other changes
Thanking you
You will need to keep darknet.
@lhk thanks for the tips i was successfully able to build it on the CPU
Nice, thanks for updating me on the successful build.
Could you make a list of the changes that were necessary. I'm sure that would help other people, too
@lhk ya sure i shall make a doccument which will be able to build it on CPU (over the weekend)
Hm, I'm sorry, it's probably not that easy after all. I just reread our makefiles and scripts. Here's more tips on how to get it to work:
The Makefile is for compiling darknet itself. That is C code and uses the gcc compiler, you don't have to switch it to g++.
You need to set GPU=0 at the top of the Makefile to switch off Cuda compilation. That is here
Unfortunately, if my system has GPU and CUDA support, and I wilfully do want to use CPU only for compilation, the cmake -D GPU=0 and -D CUDA=0 .. still detects cuda and enables it no matter if I don't want it.
So, the solution is to edit CMakeCache.txt in your build directory after running cmake .. and set these lines as follows //Enable CUDA support ENABLE_CUDA:BOOL=OFF
//Enable CUDNN ENABLE_CUDNN:BOOL=OFF
//Enable CUDNN Half precision ENABLE_CUDNN_HALF:BOOL=FALSE
After that, make will continue to build if you use the known make -j(NPROC) setting
@lhk HI thanks for an wonderful wrapper , i just wanted to the know what are the modifications or the changes to be in the makefile to build it for CPU and without CUDA. This would be of great help