How to use a code that uses FFTW in MATLAB?

4 visualizaciones (últimos 30 días)
Daigo
Daigo el 31 de Mzo. de 2022
Comentada: Daigo el 12 de Abr. de 2022
I have a slow MATLAB code that consists of many helper functions. The bottleneck seems to be one helper function that heavily uses FFT and IFFT so I'd like to speed it up. I already tried generating a MEX function from this specific helper function but the computation became even slower. Another approach is to generate FFTW Library calles as described in Speed Up Fast Fourier Transforms in Generated Standalone Code by Using FFTW Library Calls:
The procedure itself seems to be very similar to a MEX function generation. My questions are,
  • After I generate the code, how can I use it as a part of my MATLAB code? Is the generated code intended to be used in an execution environement other than MATLAB?
  • It seems like the fft function in MATLAB is already using FFTW. Then, what is the purpose of generateing FFTW library calls from MATLAB function? Does it really speedup the computation?
Correct me if I misunderstand something.

Respuesta aceptada

Bruno Luong
Bruno Luong el 31 de Mzo. de 2022
  • After I generate the code, how can I use it as a part of my MATLAB code? Is the generated code intended to be used in an execution environement other than MATLAB?
It depends if you compile as stand alone then it is not intended to be used in MATLAB. The only option is compile in MEX.
  • It seems like the fft function in MATLAB is already using FFTW. Then, what is the purpose of generateing FFTW library calls from MATLAB function? Does it really speedup the computation?
No, it is only interesting for people who compile in Stand alone or source code to be used elsewhere and reproduce similar behavioir as MATLAB FFT, based on FFTW.
I personally tried to interface FFTW library on C-code and used under MATLAB, I'm not able to make it as fast as MATLAB FFT. I believe Matlab FFT is compiled with better compiler/option than mine and it is quite hard to beat it.
However if you have good grahics card you might try to do FFT with GPU.
  1 comentario
Daigo
Daigo el 12 de Abr. de 2022
Thank you, Bruno! To tell the truth, I'm already using a GPU to speedup the FFT, so I will try to speed up something other than FFT.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by