Forum Discussion
Altera_Forum
Honored Contributor
8 years agoWhat you are doing should work if only the thread that is running the FPGA kernel waits on clFinish(), and the total run time that you measure should be the run time of the slowest thread (which could be the FPGA or the CPU thread), rather than the sum of their run times. As fand suggested, can you tell us where your timing starts and ends?
You can also try something like this, even though I am not if that would work correctly with respect to multi-threaded OpenCL execution:initialize_opencl();
define_shared_opencl_event(event);
start_timing();
fork_threads();
if (thread_num == 1)
execute_fpga_opencl_code(&event);
else
execute cpu_cpp_code();
join_threads():
wait_on_opencl_event(event);
end_timing();