Store programs or kernels?

Hi gals/guys,

I’ve an application where I basically apply some image processing algorithms on each image of the database. So far, I compile the OpenCL programs when I start the application and store them in some cl_program instance variables. When I consider a new image, I create the kernels, set the parameters, enqueue the kernel, etc. I was thinking that maybe it would be more efficient to store the kernels instead of the program? What do you think?

Thanks.

Yes, you should re-use your kernel instead of re-creating it all the time. It’s hard to tell what goes on behind the scenes when one creates a new kernel (maybe most structures are cached, maybe not), so better use only one instance.

I’m going to follow your advice.
Thank you!