Compilers can have a profound impact on the performance of an application. Assume that for a program, compiler A results in a dynamic instruction count of 1.0E9 and has an execution time of 1.5 s, while compiler B results in a dynamic instruction count of 1.2E9 and an execution time of 1.4 s.
a) Find the average CPI for each program given that the processor has a clock rate is 8000 MHZ
b) A new compiler is developed that uses only 4.0E8 instructions and has an average CPI of 1.2. What is the speedup of using this new compiler versus using compiler A or B on the original processor?
Answer:
a)
the average CPI (cycles per instruction) for program A = 12
the average CPI (cycles per instruction) for program B = 9.33
b)
the speedup of using the new compiler versus compiler A = = 0.04
the speedup of using the new compiler versus compiler B = 0.043
Step-by-step explanation:
Given that:
For compiler A:
number of dynamic instruction count = 1.0 × 10⁹
execution time = 1.5 s
For compiler B:
number of dynamic instruction count = 1.2 × 10⁹
execution time = 1.4 s
a)
Find the average CPI for each program given that the processor has a clock rate is 8000 MHZ
Clock rate = 8000 MHZ
Cpu count time =
= 0.125 × 10⁻⁹ ns
= 0.125 × 10⁻⁹ ns
So the average CPI (cycles per instruction) for program A can be calculated as:
1.5 s = 1.0×10⁹ ×
× 0.125 × 1.0⁻⁹ ns
1.5 s =
(0.125 ns) (
)
=
= 12
the average CPI (cycles per instruction) for program B can be calculated as:
1.4 s = 1.2×10⁹ ×
× 0.125 × 10⁻⁹ ns
1.4 s =
(0.15 ns) (
)
=
= 9.33
b)
Given that:
Number of instruction of new compiler = 4.0× 10⁸
Average CPI = 1.2
Execution time for the new compiler = Number of instruction of new
compiler × Average CPI × Cpu count
time
Execution time for the new compiler = 4.0 × 10⁸ × 1.2 × 0.125 × 10⁻⁹
= 0.6 (
)
= 0.6 × 10⁻¹
= 0.06 seconds
Therefore,
the speedup of using the new compiler versus compiler A =
= 0.04
the speedup of using the new compiler versus compiler B =
= 0.043