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 64-bit integer. for (I = 0; I < 8; I++) for (J = 0; J < 8000; J++) A[I][J] = B[I][0] + A[J][I]; (a) How many 64-bit integers can be stored in a 16-byte cache block? (b) Which variable references exhibit temporal locality? (c) Which variable references exhibit spatial locality? (d) 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 in that it stores matrix elements within the same column contiguously in memory. for I 1:8 for J 1:8000 A(I,J) = B(1,0) + A(J,I); end end (e) Which variable references exhibit temporal locality? (f) Which variable references exhibit spatial locality? (g) How many 16-byte cache blocks are needed to store all 64-bit matrix elements being referenced using Matlab's matrix storage? How many using C's matrix storage? (Assume each row contains more than one element.)

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Answer only D E F and G.

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 64-bit integer.
for (I = 0; I < 8; I++)
for (J= 0; J < 8000; J++)
A[I][J] = B[I][0] + A[J][I];
(a) How many 64-bit integers can be stored in a 16-byte cache block?
(b) Which variable references exhibit temporal locality?
(c) Which variable references exhibit spatial locality?
(d) 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 in that it stores matrix elements within the same column contiguously in memory.
for I = 1:8
for J = 1:8000
A(I,J) = B(1,0) + A(J,I);
end
end
(e) Which variable references exhibit temporal locality?
(f) Which variable references exhibit spatial locality?
(g) How many 16-byte cache blocks are needed to store all 64-bit matrix elements being referenced using Matlab's matrix storage?
How many using C's matrix storage? (Assume each row contains more than one element.)
Transcribed Image Text: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 64-bit integer. for (I = 0; I < 8; I++) for (J= 0; J < 8000; J++) A[I][J] = B[I][0] + A[J][I]; (a) How many 64-bit integers can be stored in a 16-byte cache block? (b) Which variable references exhibit temporal locality? (c) Which variable references exhibit spatial locality? (d) 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 in that it stores matrix elements within the same column contiguously in memory. for I = 1:8 for J = 1:8000 A(I,J) = B(1,0) + A(J,I); end end (e) Which variable references exhibit temporal locality? (f) Which variable references exhibit spatial locality? (g) How many 16-byte cache blocks are needed to store all 64-bit matrix elements being referenced using Matlab's matrix storage? How many using C's matrix storage? (Assume each row contains more than one element.)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Fundamentals of Memory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning