Gregor Thalhammer <gregor.thalham...@gmail.com> writes:

>> Am 05.04.2016 um 22:08 schrieb Martin Weigert <mweig...@mpi-cbg.de>:
>> 
>> Hey Gregor, 
>> 
>> Thanks, upgrading to the latest github version (bbb2ca7dd) got rid of the 
>> INVALID_VALUE error, 
>> however the host-image copy still is off and empties the input data ndarray 
>> as a side effect
>> 
>> #--------code
>> from __future__ import print_function
>> import numpy as np
>> import pyopencl as cl
>> 
>> #host -> image
>> data = np.random.randn(100,100).astype(np.float32)
>> fmt = cl.ImageFormat(cl.channel_order.R, cl.channel_type.FLOAT)
>> im = cl.Image(ctx,cl.mem_flags.READ_WRITE, fmt, data.T.shape)
>> 
>> cl.enqueue_copy(queue,im,data, origin  = (0,0), region = data.T.shape)
>> 
>> #image -> host
>> out = np.empty_like(data)
>> cl.enqueue_copy(queue,out, im, origin  = (0,0), region = data.T.shape)       
>>  
>> 
>> print(np.allclose(out,data))
>> # prints False
>> # data is zeroed out 
>> #--------
>> 
>
> Hi Martin,
>
> I can confirm that your original snippet, essentially
>
> #OK
> data = np.random.randn(10,10).astype(np.float32)
> im = cl.image_from_array(ctx, data)
> out = np.zeros_like(data)
> cl.enqueue_copy(queue,out,im, origin  = (0,0), region = (10,10))
> print np.allclose(out, data)
>
> is ok for me, but host to device image transfer via
>
> cl.enqueue_copy(queue, im, data, 
>                 origin = (0,0), 
>                 region = (10,10),
>                 )
>
> seems to have no effect at all. I did not look further into detail.

Possibly fixed by 587d8fd. Could you give that a shot?

Thanks! (and thanks for reporting/looking into it, both of you!)

Andreas


_______________________________________________
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl

Reply via email to