Suppose I first create a buffer using CL_MEM_USE_HOST_PTR:

mybuffer = clCreateBuffer(context, CL_MEM_READ_WRITE| CL_MEM_USE_HOST_PTR, sizeof(float)*n,myvec,&err);

where myvec is a float array of length n.

Next, some operations are performed in a kernel involving writing on array y.

Next, read the results using:

clEnqueueReadBuffer(queue, mybuffer, CL_TRUE, 0, sizeof(float)*n, myvec, 0, NULL, NULL);

Is this defined? Is this valid?