On Fri, 17 Jun 2011 21:59:42 +0100, Sebastian Nowozin <[email protected]> wrote:
> Dear Andreas,
> 
> I am a postdoc researcher in the field of machine learning and
> recently discovered your PyOpenCL package that makes OpenCL so much
> more pleasurable to use!
> 
> One question occured to me: I tried to search the documentation,
> examples, and wiki for any mention as to the support of the OpenCL
> type float4.  It seems from the kernel side this is no problem, and
> your examples use float2.  But on the host you allocate these as
> np.complex64.
>    I wonder, what is the correct way from PyOpenCL to allocate say a
> (64,64) array of float4 elements?  Can you show me a two line example,
> i.e. a cl.Buffer call, or pyopencl.array call, that does this?

Both

np.zeros((64, 64), pyopencl.array.vec.float4)

and

pyopencl.array.zeros(queue, (64, 64), pyopencl.array.vec.float4)

should work. (Feature only in git at the moment, new release version due
out next week.)

Docs: http://documen.tician.de/pyopencl/array.html#vector-types

> If float4 is not supported on the host side, then is it sufficient to
> simply call the kernel on a correctly-sized block of memory, i.e. a
> 64*64*4 vector of float elements?

Yes.

> Thank you very much for PyOpenCL, it is very much appreciated!

You're welcome. :) One final comment: Please do send such questions to
the mailing list.

Andreas

Attachment: pgp04t5uOXuBR.pgp
Description: PGP signature

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

Reply via email to