Execution Speed of mex64 components in linux
조회 수: 3 (최근 30일)
이전 댓글 표시
All, I have written a GUI based application in R2011b which was compiled into a standalone application. It runs fine but its slow running under linux.
I have generated several mex64 components that run under the GUI with the gcc 4.2 compiler in linux and the current Microsoft C SDK under windows 7.
Windows 7 Matlab script function #1 27.11 sec function #2 246.9 sec.
Red Hat Matlab script function #1 33.30 sec function #2 661.81 sec
Red Hat Stand-alone app function #1 33.71 sec function #2 653.17 sec
The same code was used on all platforms. Does the gcc compiler generate non-optimized code compared to the Microsoft SDK? The difference in run times for function #2 is 2.5X... Thanks, Jim
댓글 수: 0
채택된 답변
Ken Atwell
2012년 3월 29일
It certainly seems that the Microsoft compiler has the edge in this situation! Can we assume you are controlling for other variables to the extent reasonable? That is, you are running on comparable computers at similar clock frequencies, etc. If function #2 involves a tight inner loop, even a modest differences in optomizations can have a magnified effect.
Make sure you are using (at least) the -O switch to gcc. Within MATLAB, you can use the -v switch to the mex function to confirm it is being used. You can experiment with more aggressive settings via the "CFLAGS" variable. This Stack Overflow question may give you some ideas.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!