I have a strange problem. I am calling the openCL kernel and waiting on it to finish execution. This is how I am doing it:
status = clEnqueueNDRangeKernel(commandQueue, kernel, 1, NULL, globalThreads, localThreads, 0, NULL, &events);
/* wait for the kernel call to finish execution */
status = clWaitForEvents(1, &events);
if(status != CL_SUCCESS)
"Error: Waiting for kernel run to finish. \
status = clReleaseEvent(events);
And after this I am reading back the memory buffers on the host side:
/* Enqueue cand_dist Buffer*/
status = clEnqueueReadBuffer(commandQueue, cand_dist_d, CL_TRUE, 0, LIST_SIZE*no_mimo_sym * sizeof(float), cand_dist, 0, NULL, &events);
But when I run Visual Studio debugger I see cand_dist get the values as soon as clWaitForEvents() returns. I do not understand how this could happen? At the end of the execution I am freeing memory so it is not stray values from old run. Does anyone know why this may happen?
I allocated device side memory like this:
cand_dist_d = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, sizeof(float)*LIST_SIZE*no_mimo_sym , cand_dist, &status);
So is it device writing back the data on the host side too?
Thanks for the help!