Homework 1 examples
Purposes:
(1) perform calculations with different units and prefixes;
(2) perform calculations using CPI values and the execution time
equation;
(3) perform calculations using Amdahl's Law;
(4) perform calculations to determine MIPS and MFLOPS.
Note:
For main memory size, interpret K, M, and G as powers of two.
Otherwise, interpret K, M, and G as powers of ten.
1. For a processor with 100 MHz clock frequency (a.k.a. clock rate),
what is the clock cycle time?
CCT = 1 / clock rate = 1 / ( 100 * 10^6 cycles per sec )
= 10 / 10^9 secs per cycle = 10 nsec
2. Consider making a complete backup of a full 40 GB hard drive using a
250 MB zip drive. How many 250 MB zip disks will be needed?
Use powers of ten for capacities other than cache or main memory.
# of zip disks = 40 GB / 250 MB = 4*10^10 / 2.5*10^8 = 160
3. Find the execution time for a program that executes 30 million
instructions on a processor with an avg. CPI of 2.0 and a clock
cycle time of 33.3 nsec.
exec. time = IC * CPI * CCT
= 30M insts. * 2 cycles/inst * 33.3 nsec/cycle
= 1.998 seconds = 2 seconds (rounded)
4. For the following instruction set workload and cycle values, find the
average CPI.
type | freq cycles
-------+--------------
alu | 0.5 2
branch | 0.2 6
ld/st | 0.3 6
avg. CPI = (0.5 * 2) + (0.2 * 6) + (0.3 * 6) = 4.0
5. Consider enhancing a scalar machine by providing a vector mode, which
is 4 times faster than the normal mode of operation.
(a) If the percentage of vectorization is 25%, what is the overall
speedup?
1 1 1
speedup = ----------------- = ---------- = ----- = 16/13 = 1.23
(1-1/4) + (1/4)/4 3/4 + 1/16 13/16
(b) What percent of vectorization is needed to achieve an overall
speedup of 2?
1
2 = ------------- => (1-f) + (f/4) = 1/2
(1-f) + (f/4)
=> 4-4f+f = 2
=> -3f = -2
=> f = 2/3 so % vectorization needed is 67%
6. Consider a program that executes 100 million instructions in 5 seconds.
What is the MIPS rating for this program?
100*10^6 insts
MIPS = -------------- = 20 MIPS
5 secs * 10^6
Consider a processor with a CPI value of 10 cycles/inst. and a clock
frequency of 200 MHz. What is the MIPS rating for this processor?
200 M cycles/sec
MIPS = --------------------- = 20 MIPS
10 cycles/inst * 10^6
7. Consider the program in question 2 that executes 100 million instructions
in 5 seconds. If 15% of these instructions are floating-point operations,
what is the MFLOPS rating for this program?
0.15 flops/inst * 100*10^6 insts
MIPS = -------------------------------- = 3 MFLOPS
5 secs * 10^6