Using CPU's Cache Efficiently

7 visualizaciones (últimos 30 días)
Reynaldo
Reynaldo el 12 de Mayo de 2012
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 comentario
Reynaldo
Reynaldo el 12 de Mayo de 2012
Sorry... I forgot to mention that I am using MatLab R2011a. Thanks!

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 12 de Mayo de 2012
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.

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by