Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFT produces unexpected transposed result when either input or output is Fortran-ordered #26

Open
cmey opened this issue May 4, 2016 · 1 comment

Comments

@cmey
Copy link

cmey commented May 4, 2016

I built a small test code to reproduce the issue: https://gist.github.com/cmey/e45ed9dc2b04bc216dcf032d50aeae99

It fails when either the input or the output array is Fortran-ordered, example output:
reikna: array([[ 1.4e+00+0.j, 8.3e-01+0.j],
[ -6.1e-01+0.j, -1.1e-03+0.j]], dtype=complex64)
np_fft: array([[ 1.4e+00+0.j, -6.1e-01+0.j],
[ 8.3e-01+0.j, -1.1e-03+0.j]])

@fjarri
Copy link
Owner

fjarri commented May 5, 2016

Yes, currently reikna only supports C-ordered arrays. Of course, it should, at the very least, raise an exception if a Fortran-ordered array is passed.

Technically, all global memory loads/stores are done through load_combined_idx() and store_combined_idx(), so the Fortran-order support is easy to add there. The problem is that many computations, including FFT, rely on the last dimension being the innermost, so they can take advantage of memory coalescing. Another option is to recognize F-ordered arrays at the point of creation of Type objects and reverse the shape if necessary, so that computations work with C-ordered shapes. I am not sure what is the best way to approach this, I'll have to think about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants