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.1 s, while compiler B results in a dynamic instruction count of 1.2E9 and an execution time of 1.5 s. a. Find the average CPI for each program given that the processor has a clock cycle time of 1 ns. b. Assume the compiled programs run on two different processors. If the execution times on the two processors are the same, how much faster is the clock of the processor running compiler A’s code versus the clock of the processor running compiler B’s code? c. A new compiler is developed that uses only 6.0E8 instructions and has an average CPI of What is the speedup of using this new compiler versus using compiler A or B on the original processor?

Respuesta :

Answer

1.

CPI for Compiler A = 1.1

CPI for Compiler B = 1.25

2. The clock rate of A is 27% slower than clock rate of B

3. C is 1.67 times faster than A and 2.27 times faster than B

Explanation:

1.

Given

Cycle Time = 1ns = 10^-9

CPU Time for A = 1.1s

Instruction count = 10^9

CPU Time for B = 1.5s

Instruction Count = 1.2*10^9

CPU Time = Instructions * Cycle Time * CPI

So, CPI = CPU Time / (Instructions * Cycle Time)

CPI for A = 1.1/(10^9 * 10^-9)

CPI = 1.1

CPI for B = 1.5/(1.2 * 10^9 * 10^-9)

CPI = 1.5/12

CPI = 1.25

2.

Given

Execution Time on A = Execution Time on B

CPU Time for A = 1.1s

Instruction count = 10^9

CPI = 1.1

CPU Time for B = 1.5s

Instruction Count = 1.2*10^9

CPI = 1.25

Execution Time = Instructions * CPI/ Clock Rate

Execution Time A = Execution Time B

Instruction A * CPI A / Clock Rate A = Instruction B * CPI B/ Clock Rate B. ----- Make Clock Rate A the subject of formula

Clock Rate A = (Instruction A * CPI A * Clock Rate B) / (Instruction B * CPI B)

Clock Rate A = (10^9 * 1.1 * Clock Rate B) / (1.2 * 10^9 * 1.25)

Clock Rate A = 0.73 Clock Rate B

So the clock rate of A is 27% slower than clock rate of B

3.

For compiler A and C,

CPU Time = Instructions * Cycle Time * CPI

CPU Time of C = 6 * 10^8 * 1.1 * 10^-9 = 0.66s

Using ratio of CPU time and Compiler performance

i,e.

CPU Time of A * Performance of A = CPU Time of C * Performance of C

Given

CPU Time of A = 1.1

CPU Time of C = 0.66

1.1 * Performance of A = 0.66 * Performance of C

Performance of C: Performance of A = 1.1/0.66

Performance of C : Performance of A = 1.67

So, C is 1.67 times faster than A

Also,

CPU Time of B = 1.5

CPU Time of C = 0.66

1.5 * Performance of B = 0.66 * Performance of C

Performance of C: Performance of B = 1.5/0.66

Performance of C : Performance of B = 2.27

So, C is 2.27 times faster than B

The average CPI for each program is 1.1 and 1.25 when the given processor has a clock cycle time of 1 ns.

How to calculate the average CPI?

CPI stands for cycles per instruction, It can be calculated by the multiplicative inverse of instructions per cycle.

[tex]CPI =\dfrac { CPU \ Time} {(Instructions \times Cycle \ Time)}[/tex]

So,

[tex]CPI_{a} =\dfrac { 1.1} {(10^9\times 10^{-9})}[/tex]

[tex]CPI_{a} = 1.1[/tex]

For compilar-B:

[tex]CPI_{b} =\dfrac { 1.5} {(1.2 \times 10^9\times 10^{-9})}\\\\CPI_{b} = 1.25[/tex]

Therefore, the average CPI for each program is 1.1 and 1.25 when the given processor has a clock cycle time of 1 ns.

Learn more about CPI:

https://brainly.com/question/17484267

ACCESS MORE