event callback problem

event callback problem

Portrait de r_ohara

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?

3 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Evgeny Fiksman (Intel)

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

Portrait de r_ohara

Thank you. This has indeed solved the problem.

Connectez-vous pour laisser un commentaire.