matlab coder mex faster than exe?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am getting the Mex code to run 10x faster than Exe, both generated by Matlab coder. The function that consumes the most compute is lpc (which combines fft & levinson algos). Does this make sense? Is there some configuration difference between Mex and Exe that would account for this? How can I configure Mex generation to get back the 10x? Thanks!
0 comentarios
Respuestas (1)
Ryan Livingston
el 27 de Abr. de 2018
Editada: Ryan Livingston
el 27 de Abr. de 2018
It definitely makes sense that MEX could be faster. When generating MEX code, Coder has access to the high-performance libraries used by MATLAB. In standalone code that isn't always the case. In this case, it may be that fft is slower. You'd need to measure to be sure. Extracting the FFTs being performed, generating MEX and EXE, and comparing the performance will show you this. You could also use a C profiler to profile the generated EXE to determine the bottleneck.
If FFT computation is dominating the execution time in EXE, Coder MEX and MATLAB use an optimized FFT library. You can link in the optimized FFTW with the standalone code for EXE,LIB,DLL starting in R2017b:
Provided that the FFTs are the bottleneck, using that should reclaim a fair bit of the performance.
The Coder doc also provides a number of optimization techniques:
Are you enabling C compiler optimizations when compiling your EXE? When compiling the EXE using Coder, set the config setting BuildConfiguration to 'Faster Runs'
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Coder en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!