On Wed, 6 Jul 2011 00:37:27 +1000, Bogdan Opanchuk wrote:
Hello Andreas,

On Wed, Jul 6, 2011 at 12:04 AM, Andreas Kloeckner
<[email protected]> wrote:
Ok, we should introduce a warning when to_gpu'ing arrays that are not in C order. And probably also add a function gpuarray.i_know_about_strides() to
turn that warning off.

Yep, that'll work too.

I was analyzing this issue a bit further, and I couldn't actually find that there ever was a behavior change in PyCUDA with respect to this. I agree that
you need to be aware of the memory layout of the numpy arrays you're
transferring, but this seems to have been the case throughout PyCUDA's history. Thus introducing a warning doesn't seem wise, because it is behavior that we've tolerated all along. The only issue might be that the code now correctly remembers these memory layouts (and restores them upon transfer to host), but I'd consider that a fixed bug more than anything. Also, PyOpenCL seems to have dealt with array memory layouts somewhat more gracefully for longer, so it
doesn't seem affected, either.

What's your take on this?

In addition, I guess it's an issue that ElementwiseKernel happily copies between arrays with different strides. I guess we could warn about that, too, although it's a bit harder to tell where legitimate use ends and abuse
starts.

I think it's not ElementwiseKernel's fault. I could as well pass
proper strides to it (as additional parameters) and perform a normal
copy - the kernel has no way of determining whether I am aware about
strides or not.

Ok, agreed.

Andreas


_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to