Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV 3.1.0 & OpenCL version?

Q1. Which version of OpenCL is supported by OpenCV 3.1.0?

My guess is OpenCL 1.2 based on the set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2") statement in the file opencv-3.1.0/cmake/OpenCVDetectOpenCL.cmake.

Also, the cl.h OpenCL include path is opencv-3.1.0/3rdparty/include/opencl/1.2/CL

OpenCV 3.1.0 & OpenCL version?

Q1. Which version of OpenCL is supported by OpenCV 3.1.0?

My guess is OpenCL 1.2 based on the set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2") statement in the file opencv-3.1.0/cmake/OpenCVDetectOpenCL.cmake.

Also, the cl.h OpenCL include path is opencv-3.1.0/3rdparty/include/opencl/1.2/CL

Q2. If OpenCL 1.2 is a supported version, would the following build errors be a bug to report? or some other action to resolve?

opencv-3.1.0/modules/core/src/opengl.cpp:1644:9: error: use of undeclared identifier
   'clGetGLContextInfoKHR_fn'; did you mean 'clGetContextInfo'?
    clGetGLContextInfoKHR_fn clGetGLContextInfoKHR = (clGetGLContextInfoKHR_fn)
    ^~~~~~~~~~~~~~~~~~~~~~~~
    clGetContextInfo

opencv-3.1.0/modules/core/src/opengl.cpp:1646:14: error: use of undeclared identifier
  'clGetGLContextInfoKHR'; did you mean 'clGetContextInfo'?
    if (!clGetGLContextInfoKHR)
         ^~~~~~~~~~~~~~~~~~~~~
         clGetContextInfo

opencv-3.1.0/modules/core/src/opengl.cpp:1669:52: error: use of undeclared identifier
  'CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR'
    status = clGetGLContextInfoKHR(properties, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR, ...
                                               ^

opencv-3.1.0/modules/core/src/opengl.cpp uses the symbols clGetGLContextInfoKHR, clGetGLContextInfoKHR_fn, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR

However, /System/Library/Frameworks/OpenCL.framework/Headers/cl.h does not contain those particular 3 symbols.

BUILD FAILS WITH_OPENCL

cmake -D CMAKE_INSTALL_PREFIX=/opt/opencv/3.1.0_test \
  -D WITH_QT=5 \
  -D WITH_OPENGL=ON \
  -D WITH_OPENCL=ON \
  -D CMAKE_BUILD_TYPE=RELEASE  ..

BUILD OTHERWISE SUCCEEDS WITHOUT OPENCL

cmake -D CMAKE_INSTALL_PREFIX=/opt/opencv/3.1.0_test \
  -D WITH_QT=5 \
  -D WITH_OPENGL=ON \
  -D WITH_OPENCL=OFF \
  -D CMAKE_BUILD_TYPE=RELEASE  ..

PLATFORM: OS X 10.10.5, Qt 5.5.1, OpenCL 1.2 (/System/Library/Frameworks/OpenCL.framework/Headers/cl.h)

Device Intel Core i7-4960HQ CPU @ 2.60GHz supports OpenCL 1.2
Device Iris Pro supports OpenCL 1.2 
Device GeForce GT 750M supports OpenCL 1.2