[PyOpenCL] PyOpenCL has kernel hang forever; doesn't happen in C?

Devin Jeanpierre jeanpierreda at gmail.com
Sun Apr 29 10:54:51 PDT 2012

My system is an Intel core i5 laptop, no GPU. It's running Fedora (the
most recent one, I've never been able to find version numbers), and
I'm using the Intel OpenCL implementation (version 1.5) for 64-bit
Linux. My PyOpenCL version is 2011.2 . Python is 2.7.2

In getting started for OpenCL development, I started writing a kernel.
That kernel did not ever halt. I've pared down the arguments to the
bare minimum -- if I remove one of those arguments, then the kernel
halts. That behavior is confusing and alarming. The arguments aren't
_used_, but as long as they are part of the function signature they
cause the OpenCL kernel to work forever rather than halting.

Furthermore, top reports 350+% CPU usage, so it's not blocking or
anything -- it's busy working. If my NDRange only has one work-item,
then I get about 100% CPU usage. So even just a single kernel instance
takes forever.

In an effort to rule out PyOpenCL problems, I managed to rule them in:
a C port of the Python program, with the same kernel, did not take
forever to execute. It's not an exact copy, and I don't really know
what I'm doing, so if there are different semantics please point them
out, as they could also explain differing behavior.

Here is a link to the Python and C code that reproduces and doesn't
reproduce this problem, respectively:


If you can offer any help or advice, it'd be much appreciated.

-- Devin

P.S. I asked a question on Stack Overflow some time ago, but I now
have reason to believe it's specifically a PyOpenCL problem rather
than OpenCL in general, so I figured I'd post here.

If you want to see the original, it is here:

It has had no responses, but this is a cross-post so I figured I'd let you know.

More information about the PyOpenCL mailing list