0

when I use multiple kernel in opencl such that result of first kernel (K1) execution is input to second kernel (K2) execution,so two questions are:

  1. The event should be different for each kernel or should be same for each kernel?
  2. The command queue should be different for each kernel or should be same for each kernel?

Thanks.

1 Answer 1

1

You need a single command queue (assuming the kernels are executed on the same device).

Unless your command queue is created with CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, you don't need to create events in the scenario you describe: kernels are executed in the order they are enqueued.

For an out-of-order command queue, you should get an event from the first clEnqueueNDRangeKernel, and pass it as dependency to the second one. Remember to release the events with clReleaseEvent.

Sign up to request clarification or add additional context in comments.

3 Comments

I mean in your case you just need one command queue (created with no options), and no event.
can i use one kernel for some cores and another kernel for remaining cores simultaneously on same GPU
@reva It's called device fission and yes, it is supported by the OpenCL framework, but I am not aware of any GPU which currently supports this feature (CPU's do). This is because current GPU's are not preemptive and only run one task at a time (ever noticed how your screen froze if your kernel, no matter how simple, entered an infinite loop?). Future GPU's should have this feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.