OpenCL: manually throw an exception in the kernel

Is it possible to manually throw an exception in OpenCL for debugging purposes only? I have a very strange error in my code: when I calculate two double values ​​and add them, the host reports "CL_OUT_OF_RESOURCE". However, if I do not add these two values, the host does not report any error.

+4
source share
1 answer

OpenCL exceptions are not supported - it is based on the C99 language.

On AMD GPUs, you can use printf inside the kernel - see the cl_amd_printf extension. To use this, put this at the top of your .cl file:

 #pragma OPENCL EXTENSION cl_amd_printf : enable 
+1
source

Source: https://habr.com/ru/post/1432037/


All Articles