PDA

View Full Version : Error Propagation in OpenCL Specification



GeoffHilton
08-12-2009, 01:04 PM
I'm new to OpenCL and have been reading the specs and examples supplied by NVIDIA's OpenCL implementation. Is it just me or is error detail propagation a tad iffy? Some functions such as clCreateCommandQueue or clCreateBuffer return objects and require a pointer to an error code variable, whereas others such as clRetainCommandQueue or clGetPlatformInfo return an error state.

While I agree that both styles are perfectly valid and acceptable, would it not be more consistent to pick one and stick with it? Is there a particular reason the two styles were mixed that I'm not aware of? If this is an unintended oversight, now is probably the best time to fix the spec (while the standard is still young and implementations are few or incomplete). I have no preference of one style over the other, however I would appreciate more consistency.

Thanks,
Geoff

affie
08-12-2009, 05:08 PM
The style the working group chose was to return the most important information as the return type. All functions that create an object (memory, command-queue etc.) return the object. Typically you check if the object value returned is NULL or not and then look at error code (or ignore it if you don't need to).

Functions that operate on objects return an error.

Hope this helps clarify your question.

GeoffHilton
08-13-2009, 10:37 AM
Indeed, that's good enough for me.

Thanks very much affie.