happynear / caffe-windows

Configure Caffe in one hour for Windows users.
Other
1.32k stars 649 forks source link

CPU Only build #188

Open Sky6596 opened 7 years ago

Sky6596 commented 7 years ago

Hi, can you give me the instructions to build CPU only, I don't have GPU. I changed CpuOnlyBuild to True and UseCuDNN to False but when I build libcaffe in VS2015, I meet some errors like that:

Severity Code Description Project File Line Suppression State Error C2333 'caffe::ProposalLayer::Backward_gpu': error in function declaration; skipping function body (compiling source file ....\src\caffe\layers\proposal_layer.cpp) libcaffe D:\Caffe\caffe-windows\include\caffe\layers\proposal_layer.hpp 36
Severity Code Description Project File Line Suppression State Error C2333 'caffe::ProposalLayer::Backward_gpu': error in function declaration; skipping function body (compiling source file ....\src\caffe\layers\proposal_layer.cpp) libcaffe D:\Caffe\caffe-windows\include\caffe\layers\proposal_layer.hpp 36
Severity Code Description Project File Line Suppression State Error C3861 'caffe_gpu_div': identifier not found libcaffe D:\Caffe\caffe-windows\src\caffe\layers\batch_norm_layer.cpp 203

And when I build project caffe:

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'pyconfig.h': No such file or directory caffe D:\Caffe\caffe-windows\windows\thirdparty\Boost\boost\python\detail\wrap_python.hpp 50
Severity Code Description Project File Line Suppression State Error (active) identifier "cudaGetDevice" is undefined libcaffe d:\Caffe\caffe-windows\src\caffe\parallel.cpp 112 Severity Code Description Project File Line Suppression State Error (active) "PyObject" is not a type name caffe d:\Caffe\caffe-windows\windows\thirdparty\Boost\boost\python\converter\builtin_converters.hpp 30

happynear commented 7 years ago

I fixed some bugs in the CPU_ONLY mode. Can you pull the latest version and try again?

Sky6596 commented 7 years ago

I'm sorry but it still has some errors:

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'cuda_runtime.h': No such file or directory libcaffe E:\Caffe\caffe-windows\src\caffe\parallel.cpp 3

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'cuda_runtime.h': No such file or directory caffe E:\Caffe\caffe-windows\windows\thirdparty\NCCL\include\nccl.h 32

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'cuda_runtime.h': No such file or directory pycaffe E:\Caffe\caffe-windows\windows\thirdparty\NCCL\include\nccl.h 32

Severity Code Description Project File Line Suppression State Error (active) cannot open source file "cuda_runtime.h" libcaffe e:\Caffe\caffe-windows\src\caffe\parallel.cpp 3

Severity Code Description Project File Line Suppression State Error (active) identifier "cudaGetDevice" is undefined libcaffe e:\Caffe\caffe-windows\src\caffe\parallel.cpp 112

Severity Code Description Project File Line Suppression State Error (active) identifier "cudaStream_t" is undefined libcaffe e:\Caffe\caffe-windows\windows\thirdparty\NCCL\include\nccl.h 148

Severity Code Description Project File Line Suppression State Error (active) identifier "CUDA_CHECK" is undefined libcaffe e:\Caffe\caffe-windows\src\caffe\parallel.cpp 112

Severity Code Description Project File Line Suppression State Error C2061 syntax error: identifier 'BatchNormLayer' libcaffe E:\Caffe\caffe-windows\src\caffe\layer_factory.cpp 96

I use VS 2015, Anaconda2, I copied full thirdparty to windows/thirdparty, changed CpuOnlyBuild to True, UseCuDNN to false, link to MATLAB, Anaconda2. But when I build it shows errors like that. Can you continue fixing it ?

happynear commented 7 years ago

NCCL is a library for multi-GPU processing. You should set USE_NCCL to false if you are using CPU_ONLY mode.

happynear commented 7 years ago

Because NCCL is newly added, the document wasn't updated.

Sky6596 commented 7 years ago

Sorry, I changed UseNCCL to false but I still have some errors:

https://i.imgsafe.org/26e2b0b751.png

I hope you can help me :(

Sky6596 commented 7 years ago

Additionally, I changed "(CudaVersion)8.0(/CudaVersion)" to "(CudaVersion)(/CudaVersion)", removed link from "(CuDnnPath)(/CuDnnPath)", but it hasn't built successfully yet

happynear commented 7 years ago

I forgot to rename CommonSettings.props to CommonSettings.props.example when I submit the last modification. You may use the new CommonSettings.props.example and try again.

happynear commented 7 years ago

Please pull the lastest version. I tried to compile in CPU_ONLY mode by myself. Now it works.

Sky6596 commented 7 years ago

OK, It built successfully. Thank you very much!!!

chenzeyuczy commented 7 years ago

I've use the latest version. Somehow it occurs to me with the same problem at the very begining of this issue..

1>....\src\caffe\layers\infimum_loss_layer.cpp(55): error C2995: “void caffe::Layer::Forward_gpu(const std::vector<caffe::Blob,std::allocator<_Ty>> &,const std::vector<caffe::Blob,std::allocator<_Ty>> &)”: 函数模板已经定义 1>....\src\caffe\layers\infimum_loss_layer.cpp(55): error C2995: “void caffe::Layer::Backward_gpu(const std::vector<caffe::Blob,std::allocator<_Ty>> &,const std::vector<bool,std::allocator> &,const std::vector<caffe::Blob,std::allocator<_Ty>> &)”: 函数模板已经定义 1>E:\Library\caffe-windows\include\caffe/layer.hpp(343): error C2333: “caffe::Layer::Forward_gpu”: 函数声明中有错误;跳过函数体 1>E:\Library\caffe-windows\include\caffe/layer.hpp(362): error C2333: “caffe::Layer::Backward_gpu”: 函数声明中有错误;跳过函数体 1>E:\Library\caffe-windows\include\caffe/layer.hpp(343): error C2333: “caffe::Layer::Forward_gpu”: 函数声明中有错误;跳过函数体 1>E:\Library\caffe-windows\include\caffe/layer.hpp(362): error C2333: “caffe::Layer::Backward_gpu”: 函数声明中有错误;跳过函数体

richipower commented 7 years ago

having the same error with the latest version :(

rb0518 commented 7 years ago

comment out the GPU_STUB code in infimum_loss_layer.cpp, i have success in CPU_ONLY

happynear commented 7 years ago

I tend to remove the infimum_loss_layer. Update: Removed by this commit https://github.com/happynear/caffe-windows/commit/e04a2f644ef2fb7482d8836722b766ec6a089e09 .

TyrionChou commented 7 years ago

the same error fatal error C1083: 无法打开源文件: “....\src\caffe\layers\fcn_data_layer.cpp”: No such file or directory

douhaoexia commented 7 years ago

Sorry! I have another error with the latest version in CPU_ONLY, "fatal error C1083: : “....\src\caffe\layers\fcn_data_layer.cpp”: No such file or directory". And I wonder what source files are vital and what can be removed.

happynear commented 7 years ago

@TyrionChou @douhaoexia , sorry I forgot to update the project file. Please try it again,

TyrionChou commented 7 years ago

@happynear thank you very much!

douhaoexia commented 7 years ago

@happynear thank you! The libcaffe and caffe have been built successful. But when I build the pycaffe , there is an error pointing to " DEFINE_BOOST_GET_POINTER(caffe::NCCL)" in "\python\caffe_caffe.cpp" . I commented out the line and no error occurred. Will what i have done affect the use of pycaffe?

happynear commented 7 years ago

oh, let me add a macro to prevent compiling the NCCL...