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.

OpenCL callback function

Shweta_Shree
Beginner
226 Views

void CL_CALLBACK myCallback( cl_event event,cl_int cmd_exec_status, void *user_data)

is giving an error on compilation.

Also, clSetEventCallback() statement is giving an error 'clSetEventCallback' identifier not found.
Does this mean that Intel SDK does not support callback functions?

0 Kudos
4 Replies
Evgeny_F_Intel
Employee
226 Views
Hi,

Intel SDK does support callback functions.

Can you provide more details on the problem?

Which development environment are you using?
Problematic code sample?

Thanks,
Evgeny
Shweta_Shree
Beginner
226 Views
Thank you Evgeny.
Sorry for the delayed reply.

Environment:
OS: Windows
CPU: Intel Core 2 Duo

Sample Code:

#include

#include

#include "cl.h"

void CL_CALLBACK myCallback(cl_event evnt,cl_int cmd_sts,void *user_data);

int main(int argc, char** argv)

{

/* Find platform and devices
Create Context, Command queue, program andkernel.
Set arguments to the kernel
*/

ret = clEnqueueNDRangeKernel(cqCommandQueue, ckKernel, 1, NULL, &global_item_size, &local_item_size, 0, NULL, &event1);

ret = clSetEventCallback(event1, CL_COMPLETE, &myCallback, NULL);

/* Read result from buffer
Release resources.
*/

}

void myCallback(cl_event evnt,cl_int cmd_sts,void *user_data)

{

/* Do something */

}

Evgeny_F_Intel
Employee
226 Views
The code looks fine.

Please check location of the cl.h.

Is it coming from Intel SDK?
IDZ_A_Intel
Employee
226 Views
Oh thanks!

I just noticed that I had 2 cl.h files.
I did not check if they were different because i assumed, no matter what the .h files would be the same.

Thanks once again.
Reply