Hi Nicholas,

On Samstag 28 Februar 2009, Nicholas Tung wrote:
>     In much of the tutorial, numpy arrays are treated as buffer objects.

In the implementation, too. In particular, memcpy_htod doesn't really care 
what it's given, as long as that something adheres to the Python buffer 
interface. Numpy arrays do so most of the time.

> This doesn't always work, and should be pointed out somewhere... 

What's the failure? If it's something non-intuitive, we should catch it in 
PyCuda and give a nicer warning.

> I found
> out the hard way. I don't know if compressed matrices have the similar
> effects, but this code seems to fail for me.
>
> new = numpy.concatenate([original, numpy.zeros((original.shape[0], 0),
> uint32)], axis=1)
> gpu = drv.to_device(new.astype(uint32))
>
>     The ndarray.copy function seems to resolve the problem. Sorry I'm not
> familiar with numpy internals.

Please post the output of

print original.shape
print original.strides
print original.flags

Andreas

PS: Please use the mailing list for all questions, for archival mainly.


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

_______________________________________________
PyCuda mailing list
[email protected]
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to