How much codegen speed up the performance ? Please give numbers!!!

Hello, Could you please validate my understanding. What does mcc ? mcc packages the matlab code in only file. So the execution is still based on the interpretation of the matlab language (no compilation). So there is no runtime speed improvement. Right ?
Assuming the vectorization is done, the algorithm is optimized...
To improve speed performance i must used codegen as described extensively on this site.
But quantitatively speaking, i would like to estimate the speeed will be increased. Are there some benchmark somewhere ?
Will the overall time execution will be divided by 2 or 10 or 50 ? I can see a lot of numbers on internet.
Could someone give me some indications ?
Very best regards Al

답변 (1개)

Adam
Adam 2017년 2월 7일
편집: Adam 2017년 2월 7일

0 개 추천

Matlab compiler creating an executable may have some effects on speed (either faster or slower), but as far as my experience goes timings are comparable between a compiled app and code run in Matlab so you are correct on that, to the best of my knowledge.
To estimate speed-up of codegen in a generic manner is impossible though. It depends on many factors, most obviously the code that you are generating the C++ code for. Some code in Matlab is more optimised than others, especially builtin functions. Some of these have gone through many iterations of optimisation.
If you write your own Matlab code with a bunch of nested for loops this will likely be very slow in Matlab, but C++ works fine with for loops so using codegen to turn it into C++ code will likely give a huge speedup there. But it is all qualitative. For all I know some code may even be slower if you use codegen than run the Matlab version if the latter is highly optimised.
You would have to test it for yourself on the code you actually want to use it for.

댓글 수: 1

For example, generating code for linear algebra is almost certain to be slower than using MATLAB, as MATLAB calls upon the highly optimized MKL or BLAS or LINPAK that uses multiple threads and which pay careful attention to buffering and cache effects.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Get Started with GPU Coder에 대해 자세히 알아보기

질문:

2017년 2월 7일

편집:

2017년 2월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by