Closed aharrison24 closed 9 years ago
This could be better handled directly in the build infrastructure instead that ifdefs.
@aharrison24 Did you test the OpenCL backend on OS X? Is it working? Hardware specs?
@bhack Yes, but there is still the ambiguity between Makefile and CMake build. Let's not do this too complicated at the moment. But the CMake definitely would need a complete remake, there's so many issues with it.
I agree that it's much better to put this sort of stuff in the build system. I mainly wanted to just let you know there was a problem, but for some reason I couldn't raise an issue on @naibaf7's github repo, so it had to be a PR.
I don't know what your policy is on include-what-you-use, but ViennaCL already takes care of getting the correct OpenCL header for the platform, so technically you could leave out the #include entirely.
@naibaf7 I'm trying to build on a Macbook Pro with OSX 10.9. Still having a number of compile issues which I haven't properly looked in to yet. I've been using the CMake build. Is that known to be broken on this branch?
In Cmake this is already handled. See official module https://github.com/Kitware/CMake/blob/master/Modules/FindOpenCL.cmake
So the OpenCL Find script will sort out the include paths, but I don't believe it allows for a platform independent #include directive.
I suppose you would need to either have the build system define a preprocessor macro so that you could do:
or just hide the platform check in a separate header, so you could do something like:
The former is not very idiomatic and doesn't play well with IDEs, while the latter is not really any different from just relying on ViennaCL to bring in the correct header, but requires more maintenance.
If OpenCL_INCLUDE_DIR include directory prefix you need only to point to cl.h in header and source files
Oh, I see what you mean. On OSX, OpenCL lives inside a Framework. So the cmake find script resolves OpenCL_INCLUDE_DIR to: /System/Library/Frameworks/OpenCL.framework
The actual location of the header is: /System/Library/Frameworks/OpenCL.framework/Versions/A/Headers/cl.h
The compiler has special handling for includes within frameworks. More info here: http://stackoverflow.com/a/8060434/4554650
I think the upshot is that on OSX, you are obliged to use #include "OpenCL/...".
On 6 July 2015 at 11:04, bhack notifications@github.com wrote:
If OpenCL_INCLUDE_DIR include directory prefix you need only to point only to cl.h in header and source files
— Reply to this email directly or view it on GitHub https://github.com/naibaf7/caffe/pull/3#issuecomment-118779739.
@aharrison24 Let me know about the errors then. It is supposed to work by now.