Fabrizio Milo aka misto skrev:
> The integration would allow extension to use OpenCL from inside the
> C-extension without
> going into python-space.
>
Yes, but why? What do you hope to gain? The Python overhead is always
amortized.
You have much bigger overhead here: the PCI bus trafficing data to and
from video ram! That is slow. It is so slow that even a pure Python
implementation will be faster for simple computations. You have to do a
lot of computation on the GPU to amortize away this cost. I've seen some
measurements indicating that a CPU can do hundreds of multiplications in
the time needed just to tranfer just one byte. This is why GPUs are not
used on massive supercomputers. So then a couple of extra Python objects
will not matter for sure.
Anyway, the OpenCL API is just a few C functions you can easily define
to Cython using
cdef extern from "opencl.h":
whatever
But PyOpenCL will save you some headache setting it up correctly.
Getting rid of PyOpenCL's Python overhead belongs to the realm of
immature optimization. Start by using PyOpenCL, if it proves to slow,
and this is due to Python, then get rid of it. The real work is in
writing the kernel anyway. The rest is just boilerplate.
Sturla
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev