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?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
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 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
steps

Step by step

Solved in 3 steps with 2 images

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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education