What is equivalent to perror () for error codes in OpenCL?

If I have something like:

err = clEnqueueReadBuffer(cmdQueue, output, CL_TRUE, 0, sizeof(float) * data_sz, &results, 0, NULL, NULL); 

I would like to:

 if (err != CL_SUCCESS){ perror("Read Failed!"); } 

But error constants, such as "CL_HOST_OUT_OF_MEMORY", etc., (understandably) are not known perror ().

I could get around the grepping .h files associated with opencl, but this is not an ideal solution. I am open to any other convenient way to track error numbers. I'm on OSX Snow Leopard (including this just in case, but I don't think this is relevant)

+4
source share
2 answers

If you have an NVIDIA OpenCL SDK, you can use the oclErrorString() function provided by oclUtils.

+1
source

Not at present. I ended up writing my own, in the style of gluErrorString() . I simply enclosed all cl_error codes in a file and processed each line in Emacs to convert it to a bunch of cases inside the switch statement (to allow non-contiguous entries) that return constant lines. It was pretty easy and quite helpful. I can place it somewhere if you want.

+1
source

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


All Articles