Hi all, I'm really interested in the pyopencl project and on integrating with clBLAS [0], as discussed in a previous thread [1], and I'm currently working on building a Python C extension to use pyopencl objects with clBLAS.
However, I'm very new to building Python C extensions,
and I'm new to writing Python C extensions, and
the interoperability documentation [2] mentions pyopencl objects
contain `from_int_ptr()` and `int_ptr`, but unfortunately
no examples are given.
So, as a first step to help me learn about build a Python C extension
to interoperate with pyopencl, and to help anybody else,
I've created a project on GitHub [3] to show a simple usage.
It's still very much a work in progress and needs a lot of cleaning.
I'm sending this message to ask for help with a segfault I'm getting when
calling `clGetContextInfo`.
`example-usage.py` [4] shows the example I'm using to obtain a pyopencl
context, queue, and buffer.
The `int_ptr` fields are passed to `peb.c::peb_example_method()` [5],
the context segfaults when passed to `clGetContextInfo`, which
I added as a check because `clCreateProgramWithSource` was segfaulting.
I've added `printf("Calling. %p %d\n", &m_context, m_context);`
to `pyopencl::wrap_cl.hpp::context::data` to print the address and
first 32 bits of the context that's being returned to python.
Then, in `peb.c` I added `printf("%p %d\n", ctx, (int) ctx);`.
This may be misleading, but the following output shows
the memory addresses differing (red flag), but the first 32 bits
being the same.
[peb::example-usage.py] 0x1d722b8
[pyopencl::wrap_cl.hpp::context::data] Calling. 0x1b55130 30876344
1
2
3
[peb::peb.c::peb_example_method()] 0x1d722b8 30876344
For more information about my configuration, I'm using x86_64 Linux,
the latest `pyopencl` from `git`, and the Intel OpenCL 1.2 SDK.
I've seen a few posts on the `pyopencl` mailing list, so
I hope this isn't an issue with the Intel SDK,
because I can't easily develop on any other OpenCL device.
Let me know if I can provide any more information.
Thanks,
Brandon.
[0]: https://github.com/clMathLibraries/clBLAS
[1]: http://lists.tiker.net/pipermail/pyopencl/2013-August/001573.html
[2]:
http://documen.tician.de/pyopencl/misc.html#interoperability-with-other-opencl-software
[3]: https://github.com/bamos/peb
[4]: https://github.com/bamos/peb/blob/master/example-usage.py
[5]: https://github.com/bamos/peb/blob/master/src/peb.c
pgp5XCjtdzzFx.pgp
Description: PGP signature
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
