Hi Andreas! I saw that you're checking the ndarray.flags.forc flag. I think that is insufficient, because the array can either be C_CONTIGUOUS of F_CONTIGUOUS. This fixes issues with striding, but not the transpose issue below. Shouldn't the check be on ndarray.flags.c_contiguous only?
Alternatively, one could convert the input using "numpy.ascontiguousarray", but that might lead to unwanted and difficult to debug overhead. Best, Lars On Thu, May 3, 2012 at 1:14 PM, Andreas Kloeckner <[email protected]> wrote: > On Fri, 27 Apr 2012 15:52:03 -0400, Lars Pastewka <[email protected]> wrote: >> Hello Everybody, >> >> I ran into the following problem with PuCUDA. When I calling for example >> >> import pycuda.gpuarray as gpu >> a = np.array([ [ 0, 1, 2 ], [ 1, 2, 3 ] ], dtype=np.float64) >> a_gpu = gpu.to_gpu(np.transpose(a)) >> >> a_gpu does not contain the transposed, but the original array. >> >> When looking into the numpy source I find that the transpose operation >> just flips the FORTRAN flag. This can be easily checked: >> >> >>> a.flags.fortran >> False >> >>> b=np.transpose(a) >> >>> b.flags.fortran >> True >> >>> c=np.transpose(b) >> >>> c.flags.fortran >> False >> >>> >> >> GPUArray.set just copies the raw data. So if the FORTRAN flag is set, >> the array on the GPU will end up transposed. Does anybody know an easy >> fix for this behavior? > > You should now get a warning if you try this. I didn't quite dare make > this an error just yet, but it is now deprecated behavior and will go > away in 2013.x. > > Andreas _______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
