synchronizationopenclgpgpu

Passing arguments to OpenCL kernel, before execution finished


I have the following question about executing OpenCL kernel. Let kernel be some OpenCL kernel. I want to execute it twice with different arguments.

Can I set new arguments to this kernel after calling function "clEnqueueNDRangeKernel" but before this execution is finished? (Will it bring some problems?)

kernel = clCreateKernel(...);

clSetKernelArg(kernel, ...);

cl_event event;
clEnqueueNDRangeKernel(kernel, ..., &event)

clSetKernelArg(kernel, ...);//Can I call this function before "event" is completed?

clEnqueueNDRangeKernel(kernel, ...)

I saw the documentation on "khronos registry", but I did not found an answer for this question.


Solution

  • It seems that I was not too attentive. The answer to my question is "yes". I can set new arguments to a kernel immediately after calling "clEnqueueNDRangeKernel" without waiting for execution result. I found answer here: khronos forum