Docsity

Understanding Performance Metrics in Computer Science: Equations, MIPS, MFLOPS, & Amdahl's, Study notes of Computer Architecture and Organization

Partial preview of the text

Download Understanding Performance Metrics in Computer Science: Equations, MIPS, MFLOPS, & Amdahl's and more Study notes Computer Architecture and Organization in PDF only on Docsity!

CS472 1

Performance

CS472 2

Equations

Performance = 1 / Execution Time

Tp = 1 / frequency

I = # of instructions

CPI = ave. Cycles Per Instruction

# of clock cycles = I • CPI

# of clock cycles = ∑(I i • CPI i )

Tp

CS472 3

Equations

ET = Execution Time

ET = (# of clock cycles) • Tp

= I • CPI • Tp = I • CPI / f

Performance = f / (I • CPI) (because Performance= 1/ET)

I is determined by the program and the compiler. f is determined by the hardware being used. CPI is determined by the program, the compiler, the architecture

Performance is influenced by all 3 variables.

CS472 4

CPI = 1 CPI=2 CPI=

Code Seq.1 2 instr. 1 instr. 2 instr.

Code Seq. 2 4 inst. 1 instr. 1 instr.

# clock cyclescode seq 1 = (2+2+6) = 10

# clock cyclescode seq 2 = (4+2+3) = 9

I code seq 1 = 5

I code seq 2 = 6

code seq 2 is faster

I by itself does not indicate performance (You need all 3 variables.)

Example

CS472 7

Another Performance Metric

native MIPS = Millions of Instructions Per Second

We will just call it MIPS.

I / sec = f / CPI

So, MIPS rating = f / (CPI • 10^6 ) ← notice no I

cycles instructions -------- x -------------- sec cycle

CS472 8

MIPS

Pros

• Easy to understand.

• Faster machines have a bigger MIPS rating.

Cons

• We cannot compare machines with different

instruction sets using MIPS. (I will vary)

• The MIPS rating is dependent on the program.

• MIPS can go up while performance goes down!

CS472 9

MIPS Example

Two different compilers are being tested for a 100 MHz. machine with three different classes of instructions: Class A, Class B, and Class C, which require one, two, and three cycles (respectively). Both compilers are used to produce code for a large piece of software.

Which sequence will be faster according to MIPS?

Which sequence will be faster according to execution time?

ACPI=1 BCPI=2 CCPI=

Compiler 1 5M 1M 1M Compiler 2 10M 1M 1M

Instruction counts

CS472 10

Another Performance Metric

MFLOPS - Millions of Floating Point Operations

Per Second

consider only the # of floating pt instr.

= # floating pt instructions / time

Problem 1: There are other instructions that are not floating pt that take time, but do not get counted.

Problem 2: Floating pt add, sub, mult, and div are counted equally even though mult and div take much longer.

CS472 13

SPEC CPU

The SPEC CPU2000 suite includes applications

from the following areas:

AI game theory compilers

interpreters data compression

databases weather prediction

fluid dynamics physics

chemistry image processing

CS472 14

SPEC’

Clock rate (MHz) Pentium

SPECfp

Pentium Pro

2 0

4

6

8

3 1

5

7

9

10

50 100 150 200 250 Clock rate (MHz)

SPECint

2 0

4

6

8

3 1

5

7

9

10

50 100 150 200 250 Pentium Pentium Pro

  • Does doubling the clock rate double the performance for a specific chip?
  • Does a chip with a higher clock rate always outperform a chip with a slower clock?

CS472 15

Amdahl's Law

Execution Time After Improvement =

Execution Time Unaffected +( Execution Time Affected / Amount of Improvement )

  • Example: Suppose a program runs in 100 seconds on a machine, with multiply responsible for 80 seconds of this time. How much do we have to improve the speed of multiplication if we want the program to run 4 times faster?

How about making it 5 times faster?

  • Principle: Make the common case fast

CS472 16

Examples

  • Suppose we enhance a machine making all floating-point instructions run five times faster. If the execution time of some benchmark before the floating-point enhancement is 10 seconds, what will the speedup be if half of the 10 seconds is spent executing floating-point instructions?
  • We are looking for a benchmark to show off the new floating- point unit described above, and want the overall benchmark to show a speedup of 3. One benchmark we are considering runs for 100 seconds with the old floating-point hardware. How much of the execution time would floating-point instructions have to account for in this program in order to yield our desired speedup on this benchmark?