Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 < 8; i++ ) for( j = 0; j<8000; j++ ) a[i][j] = b[i][0] + a[j][i] a) How many 32-bit integers can be stored in a 16-byte cache line? 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 , 1 ) + A( j , i ); end end d) References to which variables exhibit temporal locality? e) References to which variables exhibit spatial locality?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

2. How will the team select a leader?

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago