Hey all,

Andreas Kloeckner <[email protected]> writes:
> Relatedly, there's Toby StClere Smithe's PyViennaCL [1] which provides a
> Python binding for ViennaCL. Toby--what's the status of the PyOpenCL
> integration? I know I still owe you the .get() patch...

Yeah, PyOpenCL integration is pretty complete right now, at least in git
master. There should be a stable release with all the new functionality
in the next month or two. You can create PyViennaCL objects from
PyOpenCL Buffer or Array objects, and you can get PyOpenCL Buffer or
Array objects from PyViennaCL objects; all without incurring copy
operations. There is still a bit of missing functionality for sparse
matrices, but for dense matrices it's all there. It's also pretty easy
to execute custom kernels on PyViennaCL objects, and even to integrate
your custom kernels into the PyViennaCL expression graph.

There are a couple of simple examples demonstrating this latter
functionality[1][2], but the documentation is somewhat sparse right now
(I'm working on it!). If you're interested and stuck, do get in
touch.

Briefly, if you want the PyOpenCL Buffer for a given PyViennaCL Matrix
``mat``, you need to look at ``mat.handle[0]`` (there is only one
element in Matrix.handle, because there is only one underlying
buffer). Also: if you have a PyOpenCL Array object, you can pass that to
the Matrix class constructor to get a PyViennaCL Matrix; look at the
documentation for Matrix for this (in git master). The constructor from
a PyOpenCL Buffer is just slightly more complicated.

As for PyViennaCL performance, it's pretty good, and can get close to
peak performance for the hardware[3]. The one caveat is that, in order
to get peak performance, your hardware has to have been 'auto-tuned'; if
it has not already been tuned, there is code you can run to determine
the most performant parameters for the various algorithms.

[1] 
https://github.com/viennacl/pyviennacl-dev/blob/platform-support/examples/simple-opencl-vector-sum.py
[2] 
https://github.com/viennacl/pyviennacl-dev/blob/custom-kernels/examples/simple-custom-node-sum.py
[3] http://viennacl.sourceforge.net/pyviennacl/benchmarks/

Cheers,

Toby



> [1] https://github.com/viennacl/pyviennacl-dev
>
> HTH,
> Andreas
>

-- 
Toby St Clere Smithe
http://tsmithe.net


_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to