[PyCuda] pycuda memcpy_htod
lists at informa.tiker.net
Sun Mar 1 10:06:22 PST 2009
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),
> 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
PS: Please use the mailing list for all questions, for archival mainly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part.
More information about the PyCUDA