- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are some macros that I use to error check my OpenCL API functions:
https://gist.github.com/allanmac/9328bb2d6a99b86883195f8f78fd1b93
The two macros of interest are:
#define cl(...) cl_assert((cl##__VA_ARGS__), __FILE__, __LINE__, true); #define cl_ok(err) cl_assert(err, __FILE__, __LINE__, true);
And they're used like this:
cl_program program = clCreateProgramWithBinary(context,
1,
&device_id,
bins_sizeof,
bins,
&status,
&err);
cl_ok(err);
cl(BuildProgram(program,
1,
&device_id,
NULL,
NULL,
NULL));
Simply adding two ellipses will give you OpenCL API error checking to those OpenCL functions that return a cl_int error code.
The second "cl_ok(err)" form handles API functions that initialize an error as an argument.
Note there is also a useful function for converting OpenCL errors to strings:
char const * clGetErrorString(cl_int const err);
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There appears to be no way to edit a "first post".
Typo:
Simply adding two
ellipsesparentheses will give you OpenCL API error checking for those functions that return a cl_int error code.
I was thinking too much about vararg ellipses!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page