Hello,

I recently found myself missing a certain feature in PyCuda (and, in
fact, the same can be said about PyOpenCL). Namely, the feature is a
view of a part of GPUArray.
For example, if I have some large array and want to perform some
operation on the part of it, I have to introduce additional parameters
like 'offset' and 'length':

a = GPUArray(full_size, dtype)
func(a, offset=1024, length=2048)

In my opinion, this can be too error-prone, and this would be better:

a = GPUArray(full_size, dtype)
a_view = a.get_view(offset=1024, length=2048)
func(a_view)

Now func() does not have to worry about offsets and can just work with
a_view as if it were a common GPUArray. This especially helps if
func() is some library function which you cannot/do not want to mess
with. Other advantage of views would be that you can reuse some large
temporary array by creating different views to use at different steps
(instead of creating many temporary arrays which take more memory).

So, at this point I am just interested whether I am the only one who
will find this feature useful. Unfortunately, in the nearest future I
will not have time to add it myself. I am not even sure whether it
should go to PyCuda/OpenCL or straight to compyte (or is it there
already?).

Best regards,
Bogdan

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to