On Donnerstag 29 April 2010, Amir wrote:
> I would like to create different views of a GPUArray. I have no idea how to
> do it.

1D slicing logic already exists. See GPUArray.__getitem__ on how it's
done.

> Let A be a 2D float32 c-continuous array. How do I create a 1D view of one
> of its rows? I am not sure how to set gpudata in the view. An example would
> be great. Is there a pointer arithmetic trick?

This would have to happen along the lines of how the view is built
above, but is hampered by the fact that our kernels don't yet have the
necessary stride support. (I.e. you could already implement contiguous
slices without touching the kernels, but non-contiguous ones need more
work.)

> Is it possible to create a float32 view of a complex64 array?

Yup, that should be easy. Just follow GPUArray.__getitem__. Is there a
conventional numpy spelling for this?

> I am trying to use gpuarray.multi_take_put to copy slices between
> float and complex arrays but it requires dtypes to match.

multi_take_put, in addition to being an undocumented feature, needs
index arrays and is therefore likely overkill for what you want.

> Is using gpuarray.multi_take_put the best way to copy a slice of an linear
> array?

No--'array[5:17].copy()' should be way faster, if you need a copy at
all.

Andreas

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net

Reply via email to