This preview shows page 1. Sign up to view the full content.
Unformatted text preview: we have dubbed the memory mountain) that can vary by orders of magnitude. Programs with good locality access most of their data from fast L1 and L2 cache memories. Programs with poor locality access most of their data from the relatively slow DRAM main memory. Programmers who understand the nature of the memory hierarchy can exploit this understanding to write more efﬁcient programs, regardless of the speciﬁc memory system organization. In particular, we recommend the following techniques: ¯ ¯ ¯ ¯ Focus your attention on the inner loops where the bulk of the computations and memory accesses occur. Try to maximize the spatial locality in your programs by reading data objects sequentially, in the order they are stored in memory. Try to maximize the temporal locality in your programs by using a data object as often as possible once it has been read from memory. Remember that miss rates are only one (albeit important) factor that determines the performance of your code. The number of memory accesses also plays an important role, and somet...
View Full Document
- Spring '10
- The American