printf function doesn't work in OpenCL kernel

百般思念 提交于 2019-12-03 08:23:53

I don't know about the IBM implementation, but printf() is a non-standard OpenCL function. On the AMD platform, you have to enable the extension through:

#pragma OPENCL EXTENSION cl_amd_printf : enable

before printf() will work. Perhaps an extension needs to be enabled on the IBM platform as well?

(Update) From this page, the possible extension name to use might be cl_intel_printf, so try:

#pragma OPENCL EXTENSION cl_intel_printf : enable

It seems that your implementation of OpenCL doesn't support printf, or maybe you are using hardware device instead of emulated one.

In my opinion you shouldn't use printf at all, it is not sharp enough tool to give answers with more complex hardware-dependent problems. Try using additional argument aka '__global float* output'. Fill it inside the kernel with something like if (something_happened) { output[get_global_id(0)] = the_value_you_need_to_debug; } this will help you diagnose any possible issue and this approach is platform independent

printf function is not supported while building in the system. You can only use it in software and hardware emulation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!