naibaf7 / caffe

Caffe: a fast open framework for deep learning. With OpenCL and CUDA support.
http://caffe.berkeleyvision.org/
Other
85 stars 20 forks source link

can't build with opencl only on windows 7 64bit #9

Closed Jadecity closed 9 years ago

Jadecity commented 9 years ago

Hi, @naibaf7 , I want to build the code with opencl only on windows, so I exclude all .cu files, because I only have an AMD GPU. There are many link errors. The linker can't find definitions of Forward_gpu and Backward_gpu for each layer, and I don't find any Forward_gpu and Backward_gpu definitions in .cl files. What can I do to fix this ?

bhack commented 9 years ago

@willyd is working on a windows port of caffe but he has not included the Opencl PR. @naibaf7 ask to @willyd if you want Opencl branch build tested on windows.

naibaf7 commented 9 years ago

@bhack It would presumably not be a lot to do compared to original Caffe. The only new real dependency would be ViennaCL, and that is header-only and works well on Windows.

However, my CMake file is adapted a lot compared to the original, so @willyd would have to write a new one if he wants to support this OpenCL branch. I support OS X and Linux only at the moment. Sorry for that :)

If someone is really willing to do the CMake port then I will accept it as a pull request as additional build infrastructure, and also test it out.

Oh and by the way, you can't just exclude the .cu files. What you have to do is x-compile (-x c++) them with a C++ compiler while not defining USE_CUDA but with the -DUSE_GREENTEA flag.

Jadecity commented 9 years ago

@bhack @naibaf7 Thanks for your help ! As @naibaf7 said, I really shouldn't exclude .cu files. Instead of x-compile, I rename those .cu files to *_cl.cc files and include them in my project. It works !

naibaf7 commented 9 years ago

@Jadecity Would be great if it works "just like that" on Windows. Please report back if you have complete success running your examples or something :)