Error while reading same mem positions on different threads
问题 I have a problem while reading a couple of positions in a double array from different threads. I enqueue the execution with : nelements = nx*ny; err = clEnqueueNDRangeKernel(queue,kernelTvl2of,1,NULL,&nelements,NULL,0,NULL,NULL); kernelTvl2of has (among other) the code size_t k = get_global_id(0); (...) u1_[k] = (float)u1[k]; (...) barrier(CLK_GLOBAL_MEM_FENCE); forwardgradient(u1_,u1x,u1y,k,nx,ny); barrier(CLK_GLOBAL_MEM_FENCE); and forwardgradient has the code: void forwardgradient(global