[PyOpenCL] pyopencl.array padding for edge cases

Andreas Kloeckner lists at informa.tiker.net
Sun Aug 21 07:26:45 PDT 2011


On Sun, 21 Aug 2011 08:57:43 +0000 (UTC), Steven <keldor at centcom.com> wrote:
> The problem is that my_array.flatten[:16384] only returns an array with 
> 16384 elements if my_array is at least that large.  In my case, it's 
> actually slightly smaller in the edge case, since I have to add a dead zone 
> to the end of the image so that it slices into buffers of the same size. 
> However, the input image is unsliced and thus doesn't have this dead zone, 
> hence the final slice will go out of bounds and end up truncated.
> 
> This causes enqueue_copy to fail with an INVALID PARAMETER error, which I 
> strongly suspect is because the source array and destination buffer are of 
> different sizes.  Ideally, it would not fail, but rather simply copy 
> min(source_size,dest_size) bytes, which is the desired result in this case.

Copying a small source array into a big destination array is fine
according to my experiments. You can test this by simply allocating too
much memory in examples/demo.py. Can you post a simplified test that
exhibits the behavior you describe?

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pyopencl/attachments/20110821/43a8f99f/attachment.pgp>


More information about the PyOpenCL mailing list