Originally posted by: Raistmer I do host buffer (pinned memory) unmapping, copy values from GPU memory to buffer, then map buffer again and use it in host code. This happens in loop. Question is - should I use wait on events, clFinish() between commands or some other form of synching or these commands (clEnqueueUnmapMemObject,clEnqueueCopyBuffer,clEnqueueMapBuffer) or they will be executed in order and will wait each other completion just because they placed in appropriate order in queue (as one kernel call will wait before earlier kernel finishes) ?
Before using mapped pointer, you should wait to complete Map command. you can use clFinish or events returned by clEnqueueMapBuffer or use blocking call of clEnqueueMapBuffer.
All commands will be executed in order as FIFO if command properties is not CL_QUEUE_OUT_OF_ORDER_EXEC_