computing systems

30
[email protected] 1 Computing Systems Assessing and Understanding Performance

Upload: thane-wong

Post on 03-Jan-2016

30 views

Category:

Documents


0 download

DESCRIPTION

Computing Systems. Assessing and Understanding Performance. Performance. Measure, Report, and Summarize performance Make intelligent choices See through the marketing hype - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Computing Systems

[email protected] 1

Computing Systems

Assessing and Understanding Performance

Page 2: Computing Systems

[email protected] 2

Performance

Measure, Report, and Summarize performance Make intelligent choices See through the marketing hype Key to understanding underlying organizational motivation

Why is some hardware better than others for different programs?

What factors of system performance are hardware related?(e.g., Do we need a new machine, or a new operating system?)

How does the machine's instruction set affect performance?

We are looking for metrics for measuring performance from the viewpoint of both a computer user and a designer

Page 3: Computing Systems

[email protected] 3

Defining performance

Airplane Pass. capacity

Range

(miles)

Speed

(m.p.h.)

Pass. throughput

(pass. x m.p.h.)

Boeing 777 375 4630 610 228750

Boeing 747 470 4150 610 286700

Concorde 132 4000 1350 178200

Douglas DC 8-50

146 8720 544 79424

• How much faster is the Concorde compared to the 747 ?• Is the Concorde faster compared to the 747 ? • How much bigger is the 747 than the Douglas DC-8?• Which of these airplanes has the best performance ?

Page 4: Computing Systems

[email protected] 4

Understanding performance

The performance of a program depends on:

- the algorithm,- the language, - the compiler, - the architecture- the actual hardware

Page 5: Computing Systems

[email protected] 5

Computer performance: Time, Time, Time !!!

Response Time = Execution Time = Latency

- The time between the start and completion of a task

Throughput- Total amount of work completed in a given time

If we upgrade a machine with a new faster

processor what do we increase?

If we add a new processor to a system that uses

multiple processors what do we increase?

Page 6: Computing Systems

[email protected] 6

Execution Time Execution Time (response time or elapsed time)

total time to complete a program, it counts everything (disk accesses, memory accesses, input/output activities)

a useful number, but often not good for comparison purposes

CPU (execution) time doesn't count time spent waiting for I/O or time spent running

other programs can be broken up into system time (CPU time spent in the

OS), and user time (CPU time spent in the program)

Our focus: user CPU time time spent executing the lines of code that are "in" our

program

Page 7: Computing Systems

[email protected] 7

Book’s definition of performance

- For some program running on machine X,

- "X is n times faster than Y"

xX TimeExecution

1ePerformanc

nTimeExecution

TimeExecution

ePerformanc

ePerformanc

X

Y

Y

X

Problem (Relative Performance) :– machine A runs a program in 10 seconds– machine B runs the same program in 25 seconds– How much faster is machine A compared to B ?

Page 8: Computing Systems

[email protected] 8

Measuring Time

Instead of reporting execution time in seconds, we often use cycles (= clock cycles = ticks = clock ticks = clocks = clock periods)

Clock “ticks” indicate when to start activities:

cycle time = time between ticks = seconds per cycle clock rate (frequency) = cycles per second (1 Hz. = 1 cycle/sec)

Example: a 4 GHz. clock has a 250 ps. cycle time

time

cycle

seconds

program

cycles

program

seconds

Page 9: Computing Systems

[email protected] 9

How to improve performance

So, to improve performance (everything else being equal) you can either (increase or decrease?)

________ the # of required cycles for a program, or________ the clock cycle time or, said another way, ________ the clock rate.

e_timeclock_cycl_a_programcycles_forCPU_clock_

programa_for__time_execution_CPU

cycle

seconds

program

cycles

program

secondsTime

Page 10: Computing Systems

[email protected] 10

Example - improving performance

Our favorite program runs in 10 seconds on computer A, which has a 4 GHz. clock. We are trying to help a computer designer build a new machine B, that will run this program in 6 seconds. The designer can use new (or perhaps more expensive) technology to substantially increase the clock rate, but has informed us that this increase will affect the rest of the CPU design, causing machine B to require 1.2 times as many clock cycles as machine A for the same program. What clock rate should we tell the designer to target?"

Page 11: Computing Systems

[email protected] 11

Cycles required for a program Can we assume that # cycles = # instructions ?

This assumption is incorrect. Different instructions take different amounts of time. Why? remember that these are machine instructions, not lines of C code Multiplication takes more time than addition Floating point operations take longer than integer ones Accessing memory takes more time than accessing registers

Important point: changing the cycle time often changes the number of cycles required for various instructions (more later)

Page 12: Computing Systems

[email protected] 12

Clock cycles per instruction

It is clear that the execution time of a program must depends on the number of machine instructions generated by the compiler:

the average number of clock cycles each instruction takes to execute is often abbreviated CPI

CPI provides a way of comparing two different implementations of the same ISA (since the IC required for a program will be the same)

uction_per_instrock_cyclesaverage_cl

rogramns_for_a_pinstructiocyclesCPU_clock_

Page 13: Computing Systems

[email protected] 13

The “performance equation”

A given program will require:

some number of instructions (machine instructions)

some number of cycles per each instruction

some number of seconds per cycle

This useful formula separate the 3 key factors that affect performance.

timecycle_clock_CPIcount_ninstructioimeCPU_t

Page 14: Computing Systems

[email protected] 14

Performance - the BIG picture The only complete and reliable measure of performance is

determined by execution time

Do any of the other variables equal performance? NO! # of cycles to execute program? # of instructions in program? # of cycles per second? average # of cycles per instruction (CPI)? average # of instructions per second (MIPS)?

Common pitfall: thinking one of the variables is indicative of performance when it really isn’t.

cycle_Clock

Seconds

nInstructio

cyclesClock_

Program

nsInstructio

Program

SecondsTime

Page 15: Computing Systems

[email protected] 15

Example - CPI Suppose we have two implementations of the same

instruction set architecture (ISA). For some program: Machine A has a clock cycle time of 250 ps and a CPI of 2.0 Machine B has a clock cycle time of 500 ps and a CPI of 1.2

What machine is faster for this program, and by how much?

If two machines have the same ISA which of the following quantities will always be identical?

- clock rate, - CPI, - execution time, - # of instructions, - # of cycles, - MIPS

Page 16: Computing Systems

[email protected] 16

Example - Number of InstructionsA compiler designer is trying to decide between two code sequencesfor a particular machine. Based on the hardware implementation, there are three different classes of instructions: Class A, Class B, and Class C, and they require one, two, and three cycles (respectively).

The first code sequence has 5 instructions: 2 of A, 1 of B, and 2 of C. The second sequence has 6 instructions: 4 of A, 1 of B, and 1 of C.

Which sequence will be faster? How much?What is the average CPI for each sequence?

Hint:

N = number of instruction classes,

Ci = count of the # of instructions of class i executed

N

1iii )C(CPIcyclesCPU_clock_

Page 17: Computing Systems

[email protected] 17

MIPS

Million instructions per second

Problems using MIPS for comparing computers MIPS specifies the instruction execution rate but does not

take into account that instructions may have different capabilities

MIPS varies between programs on the same computer; thus a computer cannot have a single MIPS rating for all programs

MIPS can vary inversely with performance !!!

610timeExecution

countnInstructioMIPS

Page 18: Computing Systems

[email protected] 18

Example – MIPS Two different compilers are being tested for a 4 GHz. 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.

The first compiler's code uses:

- 5 million Class A instructions, - 1 million Class B instructions,- 1 million Class C instructions.

The second compiler's code uses:

- 10 million Class A instructions, - 1 million Class B instructions, - 1 million Class C instructions.

Which sequence will be faster according to MIPS? Which sequence will be faster according to execution time?

Page 19: Computing Systems

[email protected] 19

Benchmarks

Performance best determined by running a real application Use programs typical of expected workload or typical of expected class of applications

(e.g., compilers/editors, scientific applications, graphics, etc.)

Small benchmarks nice for architects and designers easy to standardize can be abused

SPEC (System Performance Evaluation Cooperative) companies have agreed on a set of real program and inputs valuable indicator of performance (and compiler technology) can still be abused (see Intel’s benchmark )

Page 20: Computing Systems

[email protected] 20

Benchmark “games” An embarrassed Intel Corp. acknowledged Friday that a bug in a

software program known as a compiler had led the company to overstate the speed of its microprocessor chips on an industry benchmark by 10 percent. However, industry analysts said the coding error…was a sad commentary on a common industry practice of “cheating” on standardized performance tests…The error was pointed out to Intel two days ago by a competitor, Motorola …came in a test known as SPECint92…Intel acknowledged that it had “optimized” its compiler to improve its test scores. The company had also said that it did not like the practice but felt to compelled to make the optimizations because its competitors were doing the same thing…At the heart of Intel’s problem is the practice of “tuning” compiler programs to recognize certain computing problems in the test and then substituting special handwritten pieces of code…

Saturday, January 6, 1996 New York Times

Page 21: Computing Systems

[email protected] 21

Benchmarks

Different classes and applications of computers requires different types of benchmark suites SPEC CPU2000 SPECweb99 EEMBC

The execution time measurements are normalized by dividing the execution time on a Sun Ultra 5_10 with a 300 MHz processor by the execution time on a measured computer (this measure is called SPEC ratio)

The guiding principle in reporting performance measurements should be reproducibility (an important aspect of reproducibility is the choice of input)

Page 22: Computing Systems

[email protected] 22

Spec’89 – Compiler enhancement and performance

0

100

200

300

400

500

600

700

800

tomcatvfppppmatrix300eqntottlinasa7doducspiceespressogcc

BenchmarkCompiler

Enhanced compiler

SP

EC

pe

rfo

rman

ce r

atio

Page 23: Computing Systems

[email protected] 23

SPEC CPU2000

Page 24: Computing Systems

[email protected] 24

SPEC2000

Does doubling the clock rate double the performance?

Clock rate in MHz

500 1000 1500 30002000 2500 35000

200

400

600

800

1000

1200

1400

Pentium III CINT2000

Pentium 4 CINT2000

Pentium III CFP2000

Pentium 4 CFP2000

Ratio PIII P4CINT2000/clock rate in MHz 0.47 0.36CFP2000/clock rate in MHz 0.34 0.39

Page 25: Computing Systems

[email protected] 25

SPEC2000Can a machine with a slower clock rate have better performance?

0.0

0.2

0.4

0.6

0.8

1.0

1.2

1.4

1.6

SPECINT2000 SPECFP2000 SPECINT2000 SPECFP2000 SPECINT2000 SPECFP2000

Always on/maximum clock Laptop mode/adaptiveclock

Minimum power/minimumclock

Benchmark and power mode

Pentium M @ 1.6/0.6 GHz

Pentium 4-M @ 2.4/1.2 GHz

Pentium III-M @ 1.2/0.8 GHz

Page 26: Computing Systems

[email protected] 26

Performance, power, and energy efficiency

Power is increasingly becoming a key limitation in processor performance (especially for embedded processors)

In CMOS technology the primary source of power dissipation is:

For power limited application, the most important metric is energy efficiency, which is computed by taking performance and dividing by average power consumption when running the benchmark

_frequencyswitchingVoltage_loadcapacitivepowerswitching_ 2

Page 27: Computing Systems

[email protected] 27

Summarizing performance Although summarizing measurements result in less

information, marketers and even users often prefer to have a single number to compare performance

Arithmetic mean of the execution times (underlying assumption that the programs in the workload are each run an equal number of times)

Weighted arithmetic mean (wi frequency of the program in the workload)

n

1iiTime

n

1AM

n

1iii TimewWAM

Page 28: Computing Systems

[email protected] 28

Amdahl’s law

The performance enhancement possible with a given improvement is limited by the amount that the improved feature is used

Principle: make the common case fast

Execution time after improvement =

Execution time affected + Execution time unaffectedAmount of improvement

Page 29: Computing Systems

[email protected] 29

Example – Amdahl’s law

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?

Page 30: Computing Systems

[email protected] 30

SummaryPerformance is specific to a particular program

Execution time is the only valid and unimpeachable measure of performance

For a given ISA, increases in CPU performance come from threesources

Increases in clock rate Improvement in processor organization that lower the CPI Compiler enhancements that lower the instruction count and/or the

average CPI (e.g. by using simpler instructions)

Pitfalls Using a subset of the “performance equation” as performance

metric Expecting the improvement of one aspect of a machine’s

performance to increase total performance by an amount proportional to the size of the partial improvement

Designing only for performance without considering cost, functionality and other requirements is unrealistic