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.
1663 Discussions

Bug report: clCreateKernelsInProgram is not thread-safe

Bo__Yang
Beginner
373 Views

When invoking clCreateKernelsInProgram to the same cl_program from many different threads. The Intel OpenCL runtime will randomly raise a CL_INVALID_VALUE error.

0 Kudos
2 Replies
Bo__Yang
Beginner
373 Views

It should be thread safe according to OpenCL specification appendix A.2 ("Multiple Host Threads")

 

All OpenCL API calls are thread-safe except clSetKernelArg.

Michael_C_Intel1
Moderator
373 Views

Hi YangB,

Thanks for your sighting.

  • Which OCL runtime are you using and for which platform? Can you identify the version and/or install package you used?
  • If you're using a runtime that leverages ocl spec >= 2.0 it's slightly different, if read extremely strictly the spec's section A.2 suggests any function that modifies the state of cl_kernel objects is not thread safe.
  • ​Can you give a minimal reproducer to demonstrate the issue? (While staying away from unsharable code of course?)

Thanks,

-MichaelC

Reply