Two computer x and y.
The compouter x is n times faster than computer y.
(performance ratio)
\[
(\rightarrow )
\frac{\text{Performance}_{\color{blue}x}}{\text{Performance}_{\color{red}y}} = n
\]
\[
(\leftarrow )
\frac{\text{Execution Time}_{\color{red}y}}{\text{Execution Time}_{\color{blue}x}} = n
\]
Execution Time
Focus user cpu execution time.
時間定義:
wall-clock time + response time + elapsed time
也就是完成工作的總時間,包括磁碟存取時間、記憶體存取時間、
輸入/輸出動作時間、作業系統時間
(operating system overhead)等。
CPU execution time without waiting I/O and other processes.
\(
\text{執行一個程式所需時間(elapsed time)}
\begin{cases}
\text{程式執行及等待I/O時間}\\
\text{程式使用CPU時間}
\begin{cases}
\text{CPU執行作業系統時間(System CPU time)}
\rightarrow \text{For servering user process}\\
\text{CPU執行使用者程式時間(User CPU time)}\\
\end{cases}
\end{cases}
\)
CPU Performance and Its Factors
\(
\text{CPU execution time for a program}
=
\text{CPU clock cycles for a program}
\times
\text{Clock cycle time}
\)
Alternatively, because clock rate and clock cycle time
are inverses,
\(
\text{CPU execution time for a program}
=
\frac{
\text{CPU clock cycles for a program}
}
{
\text{Clock rate}
}
\)
A certain machine with a 10ns
\(
(10\times 10^{-9}\text{s})
\)
clock can perform
jumps (1 cycle),
branches (3 cycles),
arithmetic instructions (2 cycles),
multiply instructions (5 cycles),
and memory instructions (4 cycles).
A certain program has
10% jumps,
10 branches,
50% arithmetic,
10% multiply,
and 20% memory instructions.
Answer the following question.
Show your derivation in sufficient detail.
What is the CPI of this program on this machine?
If the program executes \( 10^9 \) instructions,
what is its execution time?
A 5-cycle multiply-add instruction is implemented
that combines an arithmetic and a multiply instruction.
50% of the multiples can be tuned into multiply-adds.
What is the new CPI?
Following (3) above, if the clock period remains the same,
what is the program's new execution time.
P = Performance
ET = Execution Time
Parallel portion is the part that can be improved.
\[
\text{Overall Speedup}
=
\frac{\text{After }P}{\text{Before }P}
=
\frac{\text{Before }ET}{\text{After }ET}
=
\frac{\text{Before } ET}{\frac{\text{ET of Parallel portion}}{\text{speedup of Parallel portion}}+\text{unimproved time}}
\]
For percentage
\[
\text{speedup}_\text{total}=
\frac{\cancelto{1}{\frac{\text{all time}}{\text{all time}}}}{\frac{\text{improved time/all time}}{\text{speedup}_\text{improved part}}+\cancelto{\frac{\text{unimproved time}}{\text{all time}}}{(1-\frac{\text{improved time}}{\text{all time}}})}
\]