Aaron Myles Landwehr <a...@udel.edu> writes:

> I figured out the issue. As I thought, it is a bug in the context creation
> of pyopencl. Essentially properties that are passed to cl.Context() as
> pointer types are handled incorrectly. The code takes the address of the
> pointer type instead of getting the address it points to; ergo, the context
> is invalid and causes segfaults when the underlying OpenCL runtime tries to
> interpret it.
>
>
> After the following modifications within cffi_cl.py, the example interop
> code provided with pyopencl runs and displays the particle fountain:
>
> def _parse_context_properties(properties):
>     ...
>     from ctypes import _Pointer, addressof
>     from ctypes import cast # add this
>
>     if isinstance(value, _Pointer):
>         #val = addressof(value) # remove this
>         val = cast(value, ctypes.c_void_p).value # add this
>     else:
>         val = int(value)

Thanks for investigating and finding a fix. Now in master:

https://github.com/pyopencl/pyopencl/commit/21008183734b9d13ae2c40ea2e3bdec20ac70250

It'd be great if you could try that and let me know if it works.

Andreas

_______________________________________________
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl

Reply via email to