Forum Discussion
Altera_Forum
Honored Contributor
8 years agoHi fand, hi HRZ,
thank you very much. Yes, there are some clEnqueueWriteBuffer that get enqueued to the same queue, but I also used clFinish after it. Specifically, something like this: (also about my time measurement)
......
time1 = getCurrentTimestamp();
clStatus = clEnqueueWriteBuffer(clCommandQueue,......);
clFinish(clCommandQueue);
time2 = getCurrentTimestamp();
clSetKernelArg(......);
clStatus = clEnqueueNDRangeKernel(clCommandQueue,......);
std::thread cpu_thread(......);
clFinish(clCommandQueue);
cpu_thread.join();
time3 = getCurrentTimestamp();
......
where getCurrentTimestamp() is defined in opencl.cpp, and I used time3-time2 to measure kernel time, time2-time1 to measure transmission time. Is there any mistake? And thanks HRZ, I will try to use event then. Thanks again.