Results 1 to 3 of 3

Thread: problem with clFinish

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    1

    problem with clFinish

    Hi

    I have an application that runs opencl code and Im getting some unclear timing issues.

    I have a function similar to the one below and I call it every few milliseconds. I measure the time each clFinish takes and I expected to have no delay since there is a long time between the calls, but each time the second clFinish (line 3) has a delay of about 1 millisecond. I tried a few tests like removing the second clFinish but then the third one has the delay. I also tried adding another clFinish (with m_clRunKernelCommandQueue ) at the end after clEnqueueNDRangeKernel but still I got a delay on the second clFinish (line 3) ;

    can someone help me figure out what the problem is?

    void f()
    {
    1 clFinish(m_clWriteCommandQueue);
    2 clEnqueueWriteBuffer(m_clWriteCommandQueue,... , CL_FALSE, ....);
    3 clFinish(m_clRunKernelCommandQueue );
    4 clFinish(m_clReadCommandQueue );
    5 clEnqueueReadBuffer(m_clReadCommandQueue,..., CL_FALSE,...);
    6 clEnqueueNDRangeKernel(m_clRunKernelCommandQueue , ...);
    }

    thanks

  2. #2
    Junior Member
    Join Date
    Jan 2011
    Posts
    29

    Re: problem with clFinish

    The enqueued command might not be submitted to the device for execution until either a flush or a subsequent blocking call on the queue.

  3. #3
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: problem with clFinish

    General recommendation: don't call clFinish() unless you can explain in detail exactly why you need it.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. clflush or clfinish
    By jai in forum OpenCL
    Replies: 1
    Last Post: 01-23-2013, 01:08 AM
  2. Wondering when I should use clFlush or clFinish.
    By mercuryknight in forum OpenCL
    Replies: 9
    Last Post: 05-29-2012, 12:29 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
  •