NFFT / nfft

The official NFFT library repository
https://tu-chemnitz.de/~potts/nfft/
GNU General Public License v2.0
174 stars 46 forks source link

Request: possibly replace FFTW with CUFFT #75

Closed fbergama closed 6 years ago

fbergama commented 6 years ago

I'm not sure if this would provide a real benefit in terms of processing speed, but the idea of replacing FFTW with the CUDA-compabible implementation CUFFT is somehow appealing.

I've tried to replace the #include< fftw3.h> with #include< cufftw.h > but the compilation fails because CUFFT do not support double precision. Is there a way to disable long doubles via configure script?

tvolkmer commented 6 years ago

Please try ./configure --enable-single

fbergama commented 6 years ago

I did it, but it still complains about the fact that in cufftw there is no fftwl_complex type

tvolkmer commented 6 years ago

I'm sorry, we do not support CUFFT and we currently do not plan to support this in the near future.

The FFTW-compatible interface of CUFFT does not implement all definitions and features of FFTW3 as far as I see.

Some last hints. Maybe it works after following these steps, maybe not:

fbergama commented 6 years ago

Thank you very much for your assistance. Indeed, I was in the right direction! Just before your last reply I tried to just link cufftw lib instead of fftw3 (by modifying the configure scripts as you suggested and removing matlab/openmp/etc). Looks like that is working. I mean, if I run examples/nfft/nfft_times I see the GPU utilization going up to over 80%. Now I need to check if also the numbers are ok...

If you are interested I can keep you updated if I make any progress.

tvolkmer commented 6 years ago

This would be very interesting.

Please note that the NFFT consists of three major steps and the FFT is only one of these steps. Parallelizing only the FFT with CUDA will probably not give much speedup.

Please also have a look at the CUDA-based implementation Nonequispaced FFTs on GPUs from the homepage of Stefan Kunis.

fbergama commented 6 years ago

Oh god, the GPU implementation of Stefan Kunis was exactly what I was looking for! Thank you so much!

Anyway, I've checked the results of the NFFT library compiled with CUFFT. Numbers are all correct (same results than the CPU version) but the compute time is even higher due to the overhead introduced by the host-device copy. The FFT itself is faster (as expected) but overall the performance of the transform is worse.

For reference, I've collected the results of the nfft_times demo:

https://www.overleaf.com/read/vcfsmdqcpknw

I think that you can close the issue if you want. I'll definitely look at the Kunis implementation. Thanks again

tvolkmer commented 6 years ago

Thank you very much for your feedback and the results. I'm glad we could help.

tvolkmer commented 6 years ago

There may be another implementation available at https://github.com/gadgetron/gadgetron/tree/master/toolboxes/nfft/gpu