title: How to effectively swap OpenCL memory buffers?
body: <p>Exactly as the title suggests I am looking for how to effectively swap two OpenCL buffers. My kernel uses two gloabl buffers, one as input and one as output. However, I invoke my kernel in a for loop with the same NDRange, each time setting the kernel arguments, enqueueing the kernel, and swapping the buffers because the previous output buffer will be the input buffer seed for the next iteration.</p>
  
  <p>What is the appropriate way here, to swap these two buffers? I imagine that copying the buffer back to the host to one of the already malloc'd arrays and copying it into the next input buffer using <code>clEnqueueWriteBuffer()</code> and <code>clEnqueueReadBuffer()</code> is an inefficient way to go. Otherwise I am just using a temporary <code>cl_mem</code> variable to do my swapping.</p>