ENGR 325 HOMEWORK 7.
(5) 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. (P&H 5.1, §5.1) for (I=0; I8; I++) for (J=0; J8000; J++) A[I][J]=B[I][0]+A[J][I]; a. How many 32-bit integers can be stored in a 16-byte cache block? b. References to which variables exhibit temporal locality? c. References to which variables 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. for I=1:8 for J=1:8000 A(I,J)=B(I,0)+A(J,I); end
Geschreven voor
- Instelling
-
Calvin College
- Vak
-
ENGR 325
Documentinformatie
- Geüpload op
- 2 juli 2022
- Aantal pagina's
- 7
- Geschreven in
- 2021/2022
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
- engr 325
-
engr 325 homework 7
Ook beschikbaar in voordeelbundel