How to keep memory on device

Hi, I’m new on OpenCL programming and I have one doubt.

I need to execute a kernel that use 3 buffers. I have a lot of iterations that only change data of one buffers and the other two are the same in all iterations.
My question is how i can keept the 2 buffers on device to avoid transfer data in all the iterations?

I’ve read a lot about the benefits of keep data and reuse in different kernels to reduce the data transfer between host and device but I can’t find how to do it.

Thats simple: don’t do anything that would transfer the data from the device. The operations I can think of from the top of my head that would start a memory transfer are clEnqueueCopyBuffer, clEnqueueMap, and clEnqueue[NDRange|Task] for a kernel that uses the same buffer on another device. There may be other as well.

Just running you kernel over and over again on the same device will keep the data on that device just like you want it to.

Thanks Martin, i’ve done the first tiem as you said, but it failed for another problem and i’m thinking the problem was in data transfer but it wasn’t.