Hi all,
I'm writing about PyOpenCL's support for complex numbers. As of right
now, PyOpenCL's complex numbers are typedefs of float2 and double2,
which makes complex+complex addition and real*complex addition match the
desired semantics, but lots of other operators silently do the wrong
thing, such as
- complex*complex
- real+complex
I've come to regard this as a major flaw, and I can't count the number
of times I've had to hunt bugs related to this, and so I'd like to get
rid of it. I've thought about ways of doing this in a
backward-compatible manner, and they all strike me as flawed, and so I'd
prefer to move to a simple struct (supporting both .real and .imag as
well as the old .x and .y members) in one big change.
If you have code depending on PyOpenCL's complex number support and are
opposed to this change, please speak up now. I'll make the change in git
today to give you a preview.
What do you think?
Andreas

Eric and Lars,
Eric Hunsberger <erichuns(a)gmail.com> writes:
> Looking at old mailing list messages, it looked like there had been past
> interest in wrapping the AMD OpenCL BLAS library, but that no-one had
> gotten around to it yet:
>
> http://lists.tiker.net/pipermail/pyopencl/2013-August/001573.html
>
> So I wrote my own wrapper the other day, only to find that Lars Ericson has
> just done a very similar thing:
>
> http://lists.tiker.net/pipermail/pyopencl/2015-June/001890.html
>
> There are some differences, though. I'm interfacing with the new clBLAS
> library as available on GitHub (https://github.com/clMathLibraries/clBLAS).
> The interfaces are also different: Lars incorporates a lot more stuff in
> the Cython files, so that you can write your own Cython programs to use the
> BLAS functions, whereas my approach is just to make basic wrappers for the
> functions so that they're easy to call on PyOpenCL Arrays from Python.
>
> I haven't done a lot of profiling yet, but the performance seems to be
> pretty good on my NVIDIA GPU, especially for larger matrices (I haven't
> done a comparison with cuBLAS, though).
>
> My wrapper is available here:
>
> https://github.com/hunse/pyopencl_blas
>
> Hopefully it's not too difficult to install; I've only tried on Linux.
Thanks for making your wrappers available! I've added links to them from
the front page of the PyOpenCL docs:
http://documen.tician.de/pyopencl/
Andreas

Hi,
Looking at old mailing list messages, it looked like there had been past
interest in wrapping the AMD OpenCL BLAS library, but that no-one had
gotten around to it yet:
http://lists.tiker.net/pipermail/pyopencl/2013-August/001573.html
So I wrote my own wrapper the other day, only to find that Lars Ericson has
just done a very similar thing:
http://lists.tiker.net/pipermail/pyopencl/2015-June/001890.html
There are some differences, though. I'm interfacing with the new clBLAS
library as available on GitHub (https://github.com/clMathLibraries/clBLAS).
The interfaces are also different: Lars incorporates a lot more stuff in
the Cython files, so that you can write your own Cython programs to use the
BLAS functions, whereas my approach is just to make basic wrappers for the
functions so that they're easy to call on PyOpenCL Arrays from Python.
I haven't done a lot of profiling yet, but the performance seems to be
pretty good on my NVIDIA GPU, especially for larger matrices (I haven't
done a comparison with cuBLAS, though).
My wrapper is available here:
https://github.com/hunse/pyopencl_blas
Hopefully it's not too difficult to install; I've only tried on Linux.
Best,
Eric

Note: This is an existence proof, not an approach. I noticed some people getting halfway there. This gets all the way, but somebody with expert knowledge of pyOpenCL design would be best to integrate clMath into pyOpenCL.
Also AMD told me clAmdBlas is deprecated in favor of open source clMath on github, so clMath is the thing to incorporate. ClMath has a pyopencl wrapper in the distribution, but there is not a soup to nuts example of how to use it in a purely pyOpenCL and pure Python way. Also other features aren't wrapped.
Also there is githuib clRnd as well as clFFT mentioned.
Not clear to me where wrappers should go so that user in Python (not writing app code in Cython),can see all of these libraries in pyOpenCL. Should wrappers go in each package or in pyOpenCL package?