In this exercise we look at memory locality properties of matrix computation. The following code is written
Question:
In this exercise we look at memory locality properties of matrix computation. The following code is written in C, where elements within the same row are stored contiguously. Assume each word is a 32-bit integer.
for (I=0; I
for (J=0; J
A[I] [J] =B [I] [0] +A[J] [I];
1. How many 32-bit integers can be stored in a 16-byte cache block?
2. Which variable references exhibit temporal locality?
3. Which variable references exhibit spatial locality? Locality is affected by both the reference order and data layout. The same computation can also be written below in Matlab, which differs from C by storing matrix elements within the same column contiguously in memory.
4. How many 16-byte cache blocks are needed to store all 32- bit matrix elements being referenced?
5. Which variable references exhibit temporal locality?
6. Which variable references exhibit spatial locality?
Step by Step Answer:
Computer Organization And Design MIPS Edition The Hardware/Software Interface
ISBN: 9780128201091
6th Edition
Authors: David A. Patterson, John L. Hennessy