Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1 .M is an 8x8 square matrix containing integer elements (4 bytes each). The matrix is stored as a 2d array m in row major.

Q1 .M is an 8x8 square matrix containing integer elements (4 bytes each). The matrix is stored as a 2d array m in row major. The cache is a fully associative cache with block size 64 bytes and number of blocks is 2.

Consider the code given below. Successive elements in columns of m are accessed in each iteration of inner loop. The outer loop is used to select the next column. The FigureQ1 depicts how elements of m are accessed. Columnsum is an array of size 8 where each elements contains sum of one column of m matrix after execution of code.

int m[8][8];

int columnsum[8]={0,0,0,0,0,0,0,0};

int a=8,b=8;

for (j=0 ; j

for (i=0 ; i

columnsum[j]=columnsum[j]+m[i][j];

}

}

  1. Calculate the total number of misses for the entire execution of code. For simplification ignore the columnsum array and any space occupied by it in cache or any miss caused by it i.e. assume that only array m is read in the code. Show calculations
  2. It is decided to use matrix blocking while still accessing the array in columns. Tell the block size (in terms of x y elements of matrix) to bring in and utilize completely for computation in code, so that max temporal locality is used in code to calculate sum. This will also require adding more loop to code as well as changing the accumulating statement in code, so that accumulation is done for blocks and later combined, but for simplicity it is not asked to be provided. Just give a figure like FigureQ1 which tells how elements are accessed after blocking. Also describe in few words why you choose the particular block size (i.e Do not write answer only)

c. Calculate the no. of misses after blocking. Show calculations

image text in transcribed

. az' a8 ai/ap2 . 128 as as ass FigureQ1

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

1.who the father of Ayurveda? 2. Who the father of taxonomy?

Answered: 1 week ago

Question

Commen Name with scientific name Tiger - Wolf- Lion- Cat- Dog-

Answered: 1 week ago