Results 1 to 3 of 3

Thread: clGetEventProfilingInfo error

  1. #1

    clGetEventProfilingInfo error

    Hi all

    I'm trying to compute a kernel execution time. Following the example of the OpenCL Programing Guide my code look like this:

    Code :
    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.

  2. #2
    Senior Member
    Join Date
    Nov 2009
    Posts
    118

    Re: clGetEventProfilingInfo error

    Has your command queue been created with profiling support?
    Furthermore I guess you should wait command processing end before querying end time.

    edit : oups I missed the clWaitForEVENTS

  3. #3

    Re: clGetEventProfilingInfo error

    Quote Originally Posted by matrem
    Has your command queue been created with profiling support?
    No That was the mistake. I didn't read that the queue must be created with param CL_QUEUE_PROFILING_ENABLE in order to set the profilings enabled.

    Thank you very much. Everything works fine now.

    Quote Originally Posted by matrem
    Furthermore I guess you should wait command processing end before querying end time.
    edit : oups I missed the clWaitForEVENTS
    Ok

Similar Threads

  1. Timing with clGetEventProfilingInfo
    By jprice in forum OpenCL
    Replies: 2
    Last Post: 08-02-2011, 02:49 PM
  2. Replies: 0
    Last Post: 03-31-2010, 03:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •