Using CPU's Cache Efficiently

조회 수: 6 (최근 30일)
Reynaldo
Reynaldo 2012년 5월 12일
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
Reynaldo
Reynaldo 2012년 5월 12일
Sorry... I forgot to mention that I am using MatLab R2011a. Thanks!

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

답변 (1개)

Walter Roberson
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.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by