Maybe I am misunderstanding, I am not so familiar with the buffer
terminology (having not dealt much with opencl), but it sounds like a kind
of slice operation, no? GPUArray supports this and I use it all the time to
work on different parts of a large array.

Would the following be sufficient?

a = pycuda.gpuarray.to_gpu(numpy.zeros(N))

sub_region1 = a[0:N/4]
sub_region2 = a[3N/4:N]


On Sat, Feb 9, 2013 at 9:40 AM, Bogdan Opanchuk <[email protected]> wrote:

> Hello,
>
> I need to construct several sub-buffers of a big GPUArray (same thing
> pyopencl.Buffer.get_sub_region() does). For example, given a GPUArray
> of size N, I need two arrays of size N/4 starting from offset 0 and
> 3N/4 in the memory buffer of the main array. Is there some way to do
> it in PyCuda?
>
> DeviceAllocation instances do not allow integer additions, and
> Function.__call__() only takes DeviceAllocation or
> PooledDeviceAllocation instances (which it converts to integers
> anyway, so this limitation seems to be there only for protection). For
> the same reason the custom allocator does not work — despite the
> documentation of GPUArray stating that the allocator has to return "an
> object that can be cast to an int", it really requires a
> DeviceAllocation.
>
> So, is there some way to do it, or is such functionality currently
> missing in pycuda?
>
> _______________________________________________
> PyCUDA mailing list
> [email protected]
> http://lists.tiker.net/listinfo/pycuda
>
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to