Concurrent Kernels Execution

Concurrent Kernels Execution to Measure Execution Time

I’m a newbie in OpenCL. I want to measure the kernel execution time without using clGetEventProfilingInfo API. Two kernels, kernel_computation and kernel_counter; kernel_computation is for actual computational purpose and kernel_counter is for counting the clock cycles need for the kernel_computation.

Points need to remember

  • Their start and end time of execution will be exact; they start at the same time and also end together.
  • I want the output counter from kernel_counter when kernel_computation ends its execution.

If I use CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE while creating command queue, at the time of execution kernel_computation and kernel_counter will start execution at the same time or not? And their end time? How can I control their end of execution time?

My device

Xilinx VCU-1525 board

Development environment

SDAccel

Appreciate your help. Thank you in advance.

@KittoMi

I want to measure the kernel execution time without using clGetEventProfilingInfo API

You can measure CPU time between start of clEnqueueNDRangeKernel and end of clWaitForEvents function. It can be assumed as “Kernel execution time” but you should be know about OpenCL API calls’s overhead inside OpenCL driver.

cl_event event = 0;
tStart = GetCurrentTime();
clEnqueueNDRangeKernel(..., &event);
clWaitForEvents(1, &event); // waiting of kernel completing execution
t = GetCurrentTime() - tStart;

Thank you so much for your reply :slight_smile:.
From host side, I could use OpenCL profiling API to measure kernel execution time without the overhead. Actually, I want to measure the execution time for kernel ‘kernel_compution’ from kernel side and pass it to host side through global memory.

Hope you understand my problem.