OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.

event callback problem

r_ohara
Beginner
161 Views
I am trying to run an OpenCL kernel on a node with multiple CPU and GPU devices. As part of the scheduling, I use an event callback to notify when a kernel has finished, and a new kernel should be sent to the device.

{
events[queue_num] = cl::Event();
error = queues_all_[queue_num]->enqueueNDRangeKernel(*(stereoMatchKernels_all_[queue_num]), cl::NDRange(0), cl::NDRange(global_sizes[queue_num]), cl::NDRange(wkgrp_sizes[queue_num]), NULL, events+queue_num);
events[queue_num].setCallback(CL_COMPLETE, &signal_complete, (void *)(available_devices + queue_num));

}

...

void CL_CALLBACK OpenCLPreparation::signal_complete(cl_event event, cl_int status, void* data)
{
/*Do something */
}

This works without a problem on the GPU devices, but the callback is only reached for a kernel sent to the CPU after a queue.finish() has been called. Until then, the CPU sits unused. This has been tested with both an i7 930, and dual Xeon 5600 under 64 bit Linux.

Is there some problem with either the event callbacks, or the command queues in the Intel OpenCL SDK?
0 Kudos
2 Replies
Evgeny_F_Intel
Employee
161 Views

Hi,

Thank you for your feedback.

This behaviour is expected.

According to OpenCL spec. (5.13) you are expected to call clFlush() in order to insure command execution on a device.

Regards,
Evgeny

r_ohara
Beginner
161 Views
Thank you. This has indeed solved the problem.
Reply