Using CPU's Cache Efficiently
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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!
Réponses (1)
Walter Roberson
le 12 Mai 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.
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!