[PyOpenCL] OpenGl Support in pyopencl in Mac OS X 10.6
Holger Rapp
holger.rapp at kit.edu
Wed Jul 21 01:37:35 PDT 2010
Hi,
Am 20.07.2010 um 19:31 schrieb Andreas Kloeckner:
> On Tue, 20 Jul 2010 08:53:02 +0200, Holger Rapp <holger.rapp at kit.edu> wrote:
>> Hi,
>>
>>>> I tried running the gl_interop_demo.py and hit a wall right away again:
>>>> Traceback (most recent call last):
>>>> File "gl_interop_demo.py", line 74, in <module>
>>>> initialize()
>>>> File "gl_interop_demo.py", line 34, in initialize
>>>> props = [(ctx_props.PLATFORM, plats[0]), (ctx_props.GL_CONTEXT_KHR,
>>>> AttributeError: type object 'context_properties' has no attribute 'GL_CONTEXT_KHR'
>>>>
>>>> Which is true, there is no such variable defined in the class. There is only platform, to_string and mro defined.
>>>
>>> Try uncommenting the cl_ext.h header include in
>>> src/wrapper/wrap_cl.hpp. I'm reluctant to do this by default yet because
>>> Nvidia doesn't seem to ship that header.
>
>> I added the include at the Mac Include section around line 14 and made sure that it really was included (by first adding a wrong file name and see the compile fail). The compile works, but the situation is the very same as described before. None of the GL_* variables are defined inside context_properties.
>>
>> Anything more I could try?
>
> Can you check if the device you are running on is supposed to support
> the cl_khr_gl_sharing extension?
I have two OpenCL devices, one is my CPU and the other is my GPU:
In [6]: cl.get_platforms()
Out[6]: [<pyopencl.Platform 'Apple' at 0x7fff0000>]
In [7]: cl.get_platforms()[0].get_devices()
Out[7]:
[<pyopencl.Device 'GeForce 8800 GS' at 0x1022600>,
<pyopencl.Device 'Intel(R) Core(TM)2 Duo CPU E8435 @ 3.06GHz' at 0x1020400>]
First my GeForce:
In [9]: cl.get_platforms()[0].get_devices()[0].get_info(cl.device_info.EXTENSIONS)
Out[9]: 'cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_APPLE_gl_sharing cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions '
So it only lists cl_APPLE_gl_sharing. What is this all about? The very same for my CPU:
In [10]: cl.get_platforms()[0].get_devices()[1].get_info(cl.device_info.EXTENSIONS)
Out[10]: 'cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_APPLE_gl_sharing cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions '
I found this document:
http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/gl_sharing.html
> Also, can you find the cl_gl.h header
> and see if it contains the declarations for cl_khr_gl_sharing?
Nope, it doesn't. It contains some definitions for cl_APPLE_gl_sharing though.
>
> You can see what the declarations should look like in this spec header:
> http://www.khronos.org/registry/cl/api/1.1/cl_gl.h
The header on my system looks extremely similar, but ends after the declaration of clEnqueueReleaseGLObjects. Especially all the defines below this point are not in my header.
Cheers,
Holger
More information about the PyOpenCL
mailing list