matlab coder mex faster than exe?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Ryan Livingston
le 27 Avr 2018
Modifié(e) : Ryan Livingston
le 27 Avr 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 commentaires
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!