Question

Given the following code sequence calculating a matrix norm. double c[96], a[96][96]; for (i=0; i<95; i=++...

Given the following code sequence calculating a matrix norm.

double c[96], a[96][96];

for (i=0; i<95; i=++ )

{

c[i] = c[i] + a[i][i]*a[i][i+1];

}

with a and c being arrays of double precision floating point numbers with each element being 8 bytes. No element of a or c is in the cache before executing this code. Please assume row-major ordering. Assuming that the cache is large enough to hold both a and c, and has a cache block size of 64 bytes, determine the number of cache misses (6 pts) and the cache miss rate (4 pts) for this code sequence.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Number of doubles that can be stored in 1 cache block = 64/8 = 8

Add a comment
Know the answer?
Add Answer to:
Given the following code sequence calculating a matrix norm. double c[96], a[96][96]; for (i=0; i<95; i=++...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the following matrix transpose routines: typedef int array[4][4]; void transpose (array dst, array src) {...

    Consider the following matrix transpose routines: typedef int array[4][4]; void transpose (array dst, array src) {     int i, j;     for (i=0; i<4; i++) {    for (j=0; j<4; j++) {           dst[i][j] = src[i][j];    }     } } void transpose2 (array dst, array src) {     int i, j;     for (i=0; i<4; i++) {    for (j=0; j<4; j++) {           dst[j][i] = src[j][i];    }     } } Assume this code runs on...

  • Incorrect 0/1 pts Question 10 Suppose that we have an L1 cache of this configuration: •...

    Incorrect 0/1 pts Question 10 Suppose that we have an L1 cache of this configuration: • B = 32 bytes • S= 64 • E = 1 • C = 2048 bytes What is the cache miss rate (as a percentage) when we execute the following C code? Assume that the grid data structure is aligned on a cache block boundary in memory and that the cache is cold. struct { double x; double y; } grid[16][16]; for(i = 0;...

  • 1) Write a script(in Bash shell) that characterizes the application performance. Specifically, your script should automatically...

    1) Write a script(in Bash shell) that characterizes the application performance. Specifically, your script should automatically test both algorithms of the matrix math program for each of the array sizes shown in Table. Also, extend your script to automatically parse the output of the program. Table (Array Sizes in Test Suite) Algorithm 1 Algorithm 2 256 256 512 512 768 768 1024 1024 1280 1280 1536 1536 1792 1792 2048 2048 C source file // Adapted from https://gustavus.edu/+max/courses/F2011/MCS-284/labs/lab3/ // Max...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT