Hold Data for reentrance

Hi,
I’m doing some Eperiments with CUDA and OpenCL.

My last is, to program a Neuronal Network with both.
For this I must enter the same kernels a view times, to calculate the values.
On Cuda I can du something like this.

copy Initiating data to device
while(network is untrained)
{
run kernel
copy just “check conditions” out of device memory
check if network is trained
if not run next
else
exit while
}

Here I must copy the Data one time to device.
If I’ve manipulated it in the kernel function, on the next call, I can use the manipulated data, without any copy.

On OpenCL, this doesn’t run.
Every time, I call the kernel, there’s the same Data, as in the last “copy” call.
So I must copy the result out, of the device and after that, copy it in for the next call.

copy initiating data to kernel
while(network is untrained)
{
run kernel

copy “all” data out

check if network is trained
if not
copy all data to device
run next
else
exit while

}

This makes many traffic!
Is there any way, to do it like with CUDA?

It should work. Did you enable out of order execution in your command queue by any chance? Or did you flag this buffer as read-only?

I can attest such a while loop behaves like in CUDA in my code. And probably in the SDK samples as well.