Presentation is loading. Please wait.

Presentation is loading. Please wait.

CDA 3101 Fall 2010 Discussion Section 08 CPU Performance.

Similar presentations


Presentation on theme: "CDA 3101 Fall 2010 Discussion Section 08 CPU Performance."— Presentation transcript:

1 CDA 3101 Fall 2010 Discussion Section 08 CPU Performance

2 Question 1 Assume that multiply instructions take 12 cycles and account for 15% of the instructions in a typical program, an the other 85% of the instructions require an average of 4 cycles for each instruction. What percentage of time does the CPU spend doing multiplication?

3 Question 1 CPU Time for multiply instructions CPU Time = IC * CPI * Clock cycle time = IC*0.15 * 12 * CC = 1.8*IC*CC CPU Time for all instructions CPU Time = IC * CPI * Clock cycle time = (IC*0.15*12 + IC*0.85*4)*CC = 5.2*IC*CC Percentage of time CPU spend doing multiplication 1.8*IC*CC/5.2*IC*CC = 34.6%

4 Question 2 Assume that in the current system multiply instructions take 12 cycles and account for 15% of the instructions in a typical program, an the other 85% of the instructions require anaverage of 4 cycles for each instruction. Your hardware engineering team has indicated that it would be possible to reduce the number of cycles required for multiplication to 8, but this will require a 20% increase in the cycle time. Nothing else will be affected by the change. Should they proceed with the modification?

5 Question 2 CPU Time for original hardware CPU Time = IC * CPI * Clock cycle time = (IC*0.15*12 + IC*0.85*4)*CC = 5.2*IC*CC CPU Time for new hardware CPU Time = IC * CPI * Clock cycle time = (IC*0.15*8 + IC*0.85*4)*1.2CC = 5.52*IC*CC Comparing original and new hardware We know, Performance α (1 / Time ) ‏ So Performance new /Performance org = 5.2*IC*CC/5.52*IC*CC = 0.942 Modification should not be made because it reduces performance

6 Question 3 Consider two different implementations, I1 and I2, of the same instruction set. There are 3 classes of instructions (A, B and C) in the instruction set. I1 has a clock rate of 6GHz, and I2 has a clock rate of 3 GHz. The average number of cycles for each instruction class on I1 and I2 is given in the following table: The table also contains a summary of average proportion of instruction classes generated by three different compilers. C1 is a compiler produced by the makers of I1, C2 is a compiler produced by the makers of I2, and the other compiler is a third-party product. Assume that each compiler uses the same number of instructions for a program but that the instruction mix is as described in the table. ClassCPI on I1CPI on I2C1 UsageC2 UsageC3 Usage A2 1 40% 60% B3 2 40%20%15% C5 2 20%40%25%

7 Question 3 Using C1 on both I1 and I2, how much faster can the makers of I1 claim I1 is compared to I2? Using C2, how much faster can the makers of I2 claim I2 is compared to I1? If you purchase I1, which compiler would you use? If you purchase I2, which compiler would you use? Which computer and compiler would you purchase if all other criteria are identical, including cost? ClassCPI on I1CPI on I2C1 UsageC2 UsageC3 Usage A2 1 40% 60% B3 2 40%20%15% C5 2 20%40%25%

8 Question 3  For I1  Compiler C1 (0.4*IC * 2 + 0.4*IC*3+0.2*IC*5) * (1/(6*10 9 )) = 3*IC /(6*10 9 )  Compiler C2 (0.4*IC * 2 + 0.2*IC*3+0.4*IC*5) * (1/(6*10 9 )) = 3.4*IC /(6*10 9 )  Compiler C3 (0.6*IC * 2 + 0.15*IC*3+0.25*IC*5) * (1/(6*10 9 )) = 2.9*IC /(6*10 9 )  For I2  Compiler C1 (0.4*IC * 1 + 0.4*IC*2+0.2*IC*2) * (1/(3*10 9 )) = 3.2*IC /(6*10 9 )  Compiler C2 (0.4*IC * 1 + 0.2*IC*2+0.4*IC*2) * (1/(3*10 9 )) = 3.2*IC /(6*10 9 )  Compiler C3 (0.6*IC * 1 + 0.15*IC*2+0.25*IC*2) * (1/(3*10 9 )) = 2.8*IC /(6*10 9 )

9 Question 3 Using C1 on both I1 and I2, how much faster can the makers of I1 claim I1 is compared to I2? I1 is faster, 3.2/3 = 16/15 as fast as I2 Using C2, how much faster can the makers of I2 claim I2 is compared to I1? I2 is faster, 3.4/3.2 = 17/16 as fast as I1 If you purchase I1, which compiler would you use? C3 If you purchase I2, which compiler would you use? C3 Which computer and compiler would you purchase if all other criteria are identical, including cost? I2 & C3

10 Question 3  For I1  Compiler C1 (0.4*IC * 2 + 0.4*IC*3+0.2*IC*5) * (1/(6*10 9 )) = 3*IC /(6*10 9 )  Compiler C2 (0.4*IC * 2 + 0.2*IC*3+0.4*IC*5) * (1/(6*10 9 )) = 3.4*IC /(6*10 9 )  Compiler C3 (0.6*IC * 2 + 0.15*IC*3+0.25*IC*5) * (1/(6*10 9 )) = 2.9*IC /(6*10 9 )  For I2  Compiler C1 (0.4*IC * 1 + 0.4*IC*2+0.2*IC*2) * (1/(3*10 9 )) = 3.2*IC /(6*10 9 )  Compiler C2 (0.4*IC * 1 + 0.2*IC*2+0.4*IC*2) * (1/(3*10 9 )) = 3.2*IC /(6*10 9 )  Compiler C3 (0.6*IC * 1 + 0.15*IC*2+0.25*IC*2) * (1/(3*10 9 )) = 2.8*IC /(6*10 9 )

11 Question 4 We are given a task which is split up into four parts: P1 = 11%, P2 = 18%, P3 = 23%, P4 = 48%, which add up to 100%. Then we say P1 is not sped up, P2 is sped up 5×, P3 is sped up 20x and P4 is sped up 1.6x. What is the overall speed boost?

12 Amdahl’s Law The law is concerned with the speedup achievable from an improvement to a computation that affects a proportion P of that computation where the improvement has a speedup of S. 1 (1-p) + p/s

13 Question 4 By using the formula p1/s1 + p2/s2 + p3/s3 +p4/s4 we find the running time is 0.11/1 + 0.18/5 + 0.23/20 + 0.48/1.6 = 0.4574 So the overall speedup is 1/ 0.4574 = 2.19


Download ppt "CDA 3101 Fall 2010 Discussion Section 08 CPU Performance."

Similar presentations


Ads by Google