icl-utk-edu / heffte

BSD 3-Clause "New" or "Revised" License
20 stars 15 forks source link

r2r testing #35

Closed mkstoyanov closed 1 year ago

mkstoyanov commented 1 year ago
mkstoyanov commented 1 year ago

@vmontanaro can you take a look at this PR. What is happening is that the output of fotward matches between CUDA and FFTW, which is exactly what we wanted. Unfortunately, the output of backward does not.

With the correct scaling, forward + backwards gets back where we started, but taking backward by itself will change the result. The trick is here:

https://github.com/icl-utk-edu/heffte/blob/6b7406080c6cea23bc73d4edb082a39fbe4275ff/include/heffte_fft3d.h#L636

Ideally, we want the scaling factor to depend only on the type of the transform (c2c, cos, sin, cos1, sin1, etc), but not the backend (CUDA or FFTW).

Do you think this is doable and how much effort would it be. I know you have experience with the indexing and you mentioned that it can be tricky.

vmontanaro commented 1 year ago

I will have a look at the master now that the commit is merged. Probably we will need to add another layer of abstraction for the back end and transform type, which is definetly doable, but might take a bit to be planned so that the whole system doesn't change...

mkstoyanov commented 1 year ago

Maybe we can just add the scaling step in the last post-processing kernel for the backward transform. The overhead will be negligible and it will ensure identical output.

On a different note, some of your commits show as @vmontanaro and some show with just your name. This usually happens when you sign commits with different email on different machines, laptop/desktop/cluster. You should make sure that all places where you use git have one of your emails and all of the email that you're using are registered in github. That allows github to collect analytics and give you proper credit for your contributions. Right now, you don't show up on the Insight page under "contributors" and you should be there.