Comments on: Adventures in PyOpenCL: Part 2, Particles with PyOpenGL http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/ casin' the joint since '85 Thu, 03 Mar 2016 20:39:33 +0000 hourly 1 https://wordpress.org/?v=4.4.5 By: Ryan http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1913 Sun, 29 Apr 2012 16:50:01 +0000 http://enja.org/?p=493#comment-1913 Thanks for this. I hacked the nbody algo into the kernel. It works fantastic on my gtx285 with around 10k particles.

]]>
By: joost http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1846 Sun, 25 Mar 2012 20:54:42 +0000 http://enja.org/?p=493#comment-1846 I also had the ImportError: cannot import name get_gl_sharing_context_properties first, so I built pyopencl-2011.2 from source.
Then I had the ‘GL_CONTEXT_KHR’ exception, which I tried to solve by following the advice above, but after some trial-and-error this worked for me:
./configure.py –cl-enable-gl

i am on Kubuntu 11.10 (same as Ubuntu), using the most recent nvidia driver.

]]>
By: tn http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1718 Fri, 17 Feb 2012 20:30:29 +0000 http://enja.org/?p=493#comment-1718 Hi,
Thanks for your interesting tutorial.
However, I was wondering how you would do the following thing:
at the moment, you have a single kernel doing all the math, but for some other problems, you can not do that.
Say for example that at a given time you want to sum the speed of all particles (silly example, but you get the idea) and stop on a condition for that value.

As you mention it in your code, we sometime need to keep the vectors in GPU memory, do some other computation and go back to the initial kernel.
How would you do that ?
Waiting for the next example :)

Thanks

]]>
By: Steve http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1716 Tue, 14 Feb 2012 17:22:49 +0000 http://enja.org/?p=493#comment-1716 @Aleksandar

I’ve just spent aaaaaaaall afternoon trying to fix this problem:

“I’ve installed pyopencl 2011.1 and when i run main.py I get this error:
AttributeError: type object ‘context_properties’ has no attribute ‘GL_CONTEXT_KHR'”

But I finally did it. It indicates that either your device doesn’t support OpenCL/OpenGL interoperability, or that PyOpenCL was compiled without it. To get it to work, I had to download cl_ext.h from the Khronos website and put it in /usr/include/CL/, then alter “siteconf.py” which was created by “configure.py” when building PyOpenCL and set CL_ENABLE_GL to True.

Since I also spent the day installing various versions of NVidia drivers, it’s possible something else also helped, but I’m pretty sure that’s what fixed it.

]]>
By: Matt http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1582 Thu, 29 Dec 2011 00:09:11 +0000 http://enja.org/?p=493#comment-1582 I get this as well. Google is short on solutions.

python main.py
Timings:
fountain_np | average: 23.1220722198 | total: 23.1220722198 | count: 1

Traceback (most recent call last):
File “main.py”, line 135, in
p2 = window()
File “main.py”, line 58, in __init__
self.cle = part2.Part2(num, dt)
File “/Users/xxx/pyopencl/enjalot-adventures_in_opencl-94f53cf/python/part2/part2.py”, line 15, in __init__
self.clinit()
File “/Users/xxx/pyopencl/enjalot-adventures_in_opencl-94f53cf/python/part2/part2.py”, line 78, in clinit
self.ctx = cl.Context(properties=get_gl_sharing_context_properties(),
File “/Library/Python/2.7/site-packages/pyopencl-2011.2-py2.7-macosx-10.7-intel.egg/pyopencl/tools.py”, line 282, in get_gl_sharing_context_properties
(ctx_props.CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, cl.get_apple_cgl_share_group()))
AttributeError: type object ‘context_properties’ has no attribute ‘CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE’

OS X 10.7.2 — Build 11C74
Active Graphics Card:

NVIDIA GeForce 9600M GT:

Chipset Model: NVIDIA GeForce 9600M GT
Type: GPU
Bus: PCIe
PCIe Lane Width: x16
VRAM (Total): 512 MB
Vendor: NVIDIA (0x10de)
Device ID: 0x0647
Revision ID: 0x00a1
ROM Revision: 3437
gMux Version: 1.7.3
Displays:
Color LCD:
Resolution: 1440 x 900
Pixel Depth: 32-Bit Color (ARGB8888)
Main Display: Yes
Mirror: Off
Online: Yes
Built-In: Yes

]]>
By: Erik Edin http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1051 Wed, 31 Aug 2011 18:56:47 +0000 http://enja.org/?p=493#comment-1051 Hi!

I just bought a new laptop, with an NVIDIA GT555M card, running Windows 7 x64.
I initially had issues running the Python part2 particle demo, with an error similar to some above.
The actual error I got was:
pyopencl.LogicError: Context failed: invalid gl sharegroup reference khr

I realized after a bit of worrying that the problem was in the Optimus device that the newer laptops have, that is the integrated powersaving graphics card, if I understand correctly.
I was however able to fix that by using the NVIDIA control panel and changing the Global settings to always use the NVIDIA GT555M card, instead of the integrated Optimus card. Then I was able to run the demo without the error message.

]]>
By: Jonathan Lettvin http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1046 Sun, 28 Aug 2011 06:37:31 +0000 http://enja.org/?p=493#comment-1046 I just installed ubuntu 11.04 and used synaptic package manager to install pyopencl.
When I try to run the example programs I get:

Xlib: extension “GLX” missing on display “:0.0”.
freeglut (main.py): OpenGL GLX extension not supported by display ‘:0.0’

Please advise how to fix this.

]]>
By: Ali http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1028 Sun, 07 Aug 2011 23:57:47 +0000 http://enja.org/?p=493#comment-1028 Hi,
I’m having this problem on my macbook pro. It has a built in graphics unit and ‘GeForce GT 330M’:

Timings:
fountain_np | average: 4.44102287292 | total: 4.44102287292 | count: 1

Traceback (most recent call last):
File “main.py”, line 135, in
p2 = window()
File “main.py”, line 58, in __init__
self.cle = part2.Part2(num, dt)
File “/Users/aarslan/Documents/PYTHON_TOOLS/enjalot-adventures_in_opencl-a5bb2a1/python/part2/part2.py”, line 15, in __init__
self.clinit()
File “/Users/aarslan/Documents/PYTHON_TOOLS/enjalot-adventures_in_opencl-a5bb2a1/python/part2/part2.py”, line 78, in clinit
self.ctx = cl.Context(properties=get_gl_sharing_context_properties(),
File “/Library/Frameworks/EPD64.framework/Versions/7.0/lib/python2.7/site-packages/pyopencl-2011.1.2-py2.7-macosx-10.5-x86_64.egg/pyopencl/tools.py”, line 272, in get_gl_sharing_context_properties
(ctx_props.CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, cl.get_apple_cgl_share_group()))
AttributeError: type object ‘context_properties’ has no attribute ‘CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE’

]]>
By: Omar http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1023 Sat, 06 Aug 2011 15:31:13 +0000 http://enja.org/?p=493#comment-1023 Thank you very much for the tutorial. It helped me further with learning the interaction between opengl and opencl. Here is my article: Visualizing OpenCL computations within OpenGL

]]>
By: Visualizing OpenCL computations within OpenGL | Omar Abo-Namous http://enja.org/2011/03/22/adventures-in-pyopencl-part-2-particles-with-pyopengl/comment-page-1/#comment-1022 Sat, 06 Aug 2011 14:18:09 +0000 http://enja.org/?p=493#comment-1022 […] them for the visualization without even bothering the main memory or the cpu for that matter. This article by Ian Johnson who is working on bringing OpenCL acceleration to blenders particle system – or […]

]]>