Question: Read about Cachegrind 1 which is a tool for simulating cache and branch misses in a program. Examine the attached toy example BP test toy.c

Read about Cachegrind 1 which is a tool for simulating cache and branch misses in a program. Examine the attached toy example BP test toy.c and understand how it works. Your task is to modify the BP test toy.c code such that the number of miss predictions is significantly reduced. • Compile the code with gcc using no optimization options (i.e., “-O0”) using the command: > gcc -O0 BP test toy.c -o BP toy • Observe the branch miss predict rate using: > valgrind --tool=cachegrind --branch-sim=yes ./BP toy M N #iter • Modify the code for reducing the branch miss predict rate and run cachegrind again. • Report the runtime, as well as the miss, predict rate before and after your modification. • Use different N, M and #iter values in your tests. Prepare a table with initially the following inputs: M = 100, N = 1000000, #iter = 3, M = 500, N = 1000000, #iter = 10, M = 2000, N = 200000, #iter = 5, You can add mode test cases to the table. • Explain the reasoning behind your modification to the code and how it affected the performance

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include include include int mainint argc char argv ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!