Hi all
I’m trying to compute a kernel execution time. Following the example of the OpenCL Programing Guide my code look like this:
cl_event eventGlobal;
errcode_ret = clEnqueueNDRangeKernel ( hCmdQueue, hKernelGlobal, 2, 0, szGlobalWorkSize, szLocalWorkSize, 0, 0, &eventGlobal);
oclCheckError ( errcode_ret, CL_SUCCESS );
cl_ulong end, start;
errcode_ret = clWaitForEvents(1, &eventGlobal);
oclCheckError(errcode_ret, CL_SUCCESS);
errcode_ret = clGetEventProfilingInfo(eventGlobal, CL_PROFILING_COMMAND_END, sizeof(cl_ulong), &end, 0);
errcode_ret |= clGetEventProfilingInfo(eventGlobal, CL_PROFILING_COMMAND_START, sizeof(cl_ulong), &start, 0);
oclCheckError(errcode_ret, CL_SUCCESS);
cout<<"Global kernel time: "<<(end-start)*1.0e-6f<<"(ms)"<<endl;
The problem is that the errcode_ret returned from clGetEventProfilingInfo is always CL_INVALID_VALUE. I review the code several times but I can’t find the INVALID_VALUE error.
The rest of the code works fine, I mean, kernel execution is fine, the result is ok…
Does anyone know where the problem is?
Thank you.