I'm looking for a good OpenCL wrapper\library for Python, with good documentation. I tried to search some... but couldn't find one good enough.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
The most popular and best documented option seems to be PyOpenCL. It claims to be a complete wrapper for OpenCL and the documentation looks good.
Both CLyther and PyOpenCL look nicely documented to me.
pycl is a ctypes binding to OpenCL (hosted on bitbucket)
It's currently pretty new. I've been playing with it recently and it's working nicely. Not done timings compared to PyOpenCL, but the performance appears to be perfectly reasonable
I didn't work for me with OS X 10.6's OpenCL 1.0 (and an AMD Radeon 5870, see here), but works perfectly under 10.7 and OpenCL 1.1
As for documentation, it's a fairly direct bindings to the C libraries, so any documentation those will apply. Also "Adventures in PyOpenCL" is good, and applies to almost all bindings
We are developing opencl4py, higher level bindings. This project uses CFFI, so it works on Pypy.
The major issue we encountered with pyopencl is that 'import pyopencl' does OpenCL initialization and takes the whole virtual memory in case of NVIDIA driver, preventing from correct forking and effectively disabling multiprocessing (yes, we claim that using pyopencl disables multiprocessing at least with NVIDIA). opencl4py uses lazy OpenCL initialization, resolving this "import hell".
Later, it gained some nice features like super easy binary program caching, etc. Unfortunately, the documentation is somewhat brief. The best way to learn how it works is go through the tests.