Add code for print errors of OpenCL kernels runing

This commit is contained in:
vbystricky 2014-10-09 13:50:57 +04:00
parent 4f48a05906
commit 1d280352f4

View File

@ -47,6 +47,7 @@
#include <iostream> // std::cerr
#define CV_OPENCL_ALWAYS_SHOW_BUILD_LOG 0
#define CV_OPENCL_SHOW_RUN_ERRORS 0
#include "opencv2/core/bufferpool.hpp"
#ifndef LOG_BUFFER_POOL
@ -3037,6 +3038,13 @@ bool Kernel::run(int dims, size_t _globalsize[], size_t _localsize[],
cl_int retval = clEnqueueNDRangeKernel(qq, p->handle, (cl_uint)dims,
offset, globalsize, _localsize, 0, 0,
sync ? 0 : &p->e);
#if CV_OPENCL_SHOW_RUN_ERRORS
if (retval != CL_SUCCESS)
{
printf("OpenCL program returns error: %d\n", retval);
fflush(stdout);
}
#endif
if( sync || retval != CL_SUCCESS )
{
CV_OclDbgAssert(clFinish(qq) == CL_SUCCESS);