Using CPU's Cache Efficiently
조회 수: 6 (최근 30일)
이전 댓글 표시
Hey! I just had a brief question... Is there any way I can efficiently use the CPU's cache in MATLAB to improve performance? Is there any code segment that illustrates the effective use of L1 and L2 caches to improve overall execution? Thank you for your help!
답변 (1개)
Walter Roberson
2012년 5월 12일
MATLAB does not offer any ability to query cache sizes, or to align data in the cache, and makes few promises about the order of operations of anything if the JIT (Just In Time compiler) is turned on.
Variables can be silently copied to new memory if needed for "copy on write" purposes.
In situations where common vector or array operations are being done and the number of elements is high enough, the operations may be passed off to the LAPACK or BLAS libraries, which are tuned for efficiency -- but the nature of that tuning is a "black box" as far as the user is concerned.
Guidelines are difficult to give as the internal structure of MATLAB variables is mostly not documented. Well, we can give a guideline: if you work at the mex level, although it is possible to use system memory allocation routines to align data memory, doing so is risky, as MATLAB assumes that all memory has been allocated by its own allocation routines.
댓글 수: 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!