# CDA 3101 Fall 2010 Discussion Section 08 CPU Performance

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

CDA 3101 Fall 2010 Discussion Section 08 CPU Performance

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?

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 = (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%

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?

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 = (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 Performancenew/Performanceorg = 5.2*IC*CC/5.52*IC*CC = 0.942 Modification should not be made because it reduces performance

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. Class CPI on I1 CPI on I2 C1 Usage C2 Usage C3 Usage A 2 1 40% 60% B 3 20% 15% C 5 25%

Question 3 Class CPI on I1 CPI on I2 C1 Usage C2 Usage C3 Usage A 2 1 40% 60% B 3 20% 15% C 5 25% 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?

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

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? Which computer and compiler would you purchase if all other criteria are identical, including cost? I2 & C3

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

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?

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

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