1 Reply Latest reply on Apr 1, 2013 1:30 AM by himanshu.gautam

    What's the difference between clFinish and clWaitForEvents?

    shreedhar_pawar

      When do we actually use clFinish and when do we use clwaitForEvents..?

      When we create multiple command queues and want some set of queues to execute in parallel and other set of queues to execute in parallel but after first set of  queues have finished executing, do we have to give clFinish and clWaitForEvents both or just clFinish (after the first set of  queues)

        • Re: What's the difference between clFinish and clWaitForEvents?
          himanshu.gautam

          clFinish() will wait for all operations enqueued in the command queue to complete.

           

          clWaitForEvents() will only wait for those events that you asked to wait for.

           

          NOTE:

          For every command you enqueue to Command Queue, the run-time will return back a "cl_event" - which can use used to identify the command to the runtime.

          You can collect the interested events separately and then issue a clWait() on them.

          OR You can specify the selected events in the "eventWaitList" of any subsequently issued command. Such a command, will wait for its dependents to complete before commencing execution.

          So, these wait lists ( who waits on who) itself can itself be seen as a precendence graph.