Hi David, On Sun, 31 Oct 2010 10:51:35 +0200, David Minor <[email protected]> wrote: > Maybe there is already a way to do this. For debugging purposes I'd like to > be able to print precisely all the parameters that eventually get fed into > the OpenCL API C calls.
There's no automated way of doing this. I also checked ltrace, but
unfortunately its manpage says it does not work on dlopen'd
libraries. (pyopencl's binary module gets dlopen'd--unless you bake it
into a Python interpreter).
It's probably easiest to incorporate logging for the calls you care
about into what PYOPENCL_TRACE already does.
I'm thinking along these lines:
#define PYOPENCL_PRINT_CALL_TRACE_WITH_ARGS(NAME, ARGFORMAT, __VA_ARGS__) \
fprintf(stderr, ARGFORMAT, __VA_ARGS__);
#define PYOPENCL_CALL_GUARDED(NAME, ARGFORMAT, ...) \
{ \
PYOPENCL_PRINT_CALL_TRACE(#NAME, ARGFORMAT, __VA_ARGS__); \
cl_int status_code; \
status_code = NAME(__VA_ARGS__); \
if (status_code != CL_SUCCESS) \
throw pyopencl::error(#NAME, status_code);\
}
This has obvious issues if __VA_ARGS__ has side effects, but since all
uses are within PyOpenCL itself, it should be ok.
If you implement this, I'd be happy to take a patch.
Out of curiosity: What are you debugging?
HTH,
Andreas
pgpyoTjvTZaZp.pgp
Description: PGP signature
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
