On Mon, 19 Jul 2010, Gregor Thalhammer wrote:
> Last week I thought about writing a OpenCL wrapper with Cython. I > spent nearly two days trying to compile PyOpenCL on my 64bit Win 7 > system. On the other hand, compiling extensions with cython was always > smooth. The boost::python dependency was annoying, yes; you'll be happy to know that Andreas (author of PyOpenCL) has started shipping the minimal subset of boost::python that PyOpenCL needs instead of relying on it as an external dependency. We encouraged him at the SciPy10 sprints to port to Cython but he realized that this would require a lot of effort and become far less maintainable (I think C++ templating really helps keep PyOpenCL fairly compact). I think bundling a subset of boost is a reasonable compromise. > I see clear advantages of using cython on maintability (e.g., > porting to Python 3.1) and easy support for numpy arrays. NumPy arrays are actually extremely easy to support using boost. Not as nice as Cython, I don't think, but close. > I believe it's quite straightforward, ideally replicating the > C++ interface to OpenCL. Now I managed to compile PyOpenCl, so my > efforts are fading away. I think one can do significantly better than the C++ interface; PyOpenCL is most of the way there. > I like the idea of clyther very much, to write OpenCL kernels in > python. Clyther is a young project, perhaps cython will rule it out. For a slightly different tack, you should take a look at Theano: http://www.deeplearning.net/software/theano -- which aims to do code generation from symbolic computation graphs. Currently they can generate C code, compile and dynamically load Python extension modules, as well as do something similar with CUDA code, though James (one of the principal developers) is very interested in OpenCL, especially in its potential to target both CPU and GPU with only very minor modifications and thus reduce the complexity of Theano (though CPU implementations of OpenCL seem empirically more sluggish than what their C code generator + gcc can pull off currently, hopefully this will improve). David _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
