Presentation is loading. Please wait.

Presentation is loading. Please wait.

Measuring Performance Based on slides by Henri Casanova.

Similar presentations


Presentation on theme: "Measuring Performance Based on slides by Henri Casanova."— Presentation transcript:

1 Measuring Performance Based on slides by Henri Casanova

2 2 Performance as Time Time between the start and the end of an operation  Also called running time, elapsed time, wall-clock time, response time, latency, execution time,...  Most straightforward measure: “my program takes 12.5s on a Pentium 3.5GHz”  Can be normalized to some reference time Must be measured on a “dedicated” machine

3 3 Performance as Rate Used often so that performance can be independent on the “size” of the application  e.g., compressing a 1MB file takes 1 minute. compressing a 2MB file takes 2 minutes. The performance is the same. Millions of instructions / sec (MIPS)  But “Instructions Set Architectures” are not equivalent 1 CISC instruction = many RISC instructions Different programs use different instruction mixes May be ok for same program on same architectures

4 4 Performance as Rate Millions of floating point operations /sec: (MFlops)  MFlops is application-specific  Very popular, but can be misleading  e.g., A high MFlops rate in a stupid algorithm could have poor application performance Application-specific:  Millions of frames rendered per second (graphics)frames rendered  Millions of amino-acid compared per second (bio-computing)  Millions of HTTP requests served per second (web) Application-specific metrics are often preferable and others may be misleading  For instance: I want to add two n-element vectors This requires n Floating Point Operations Therefore MFlops is a good measure

5 5 Measuring Performance Rates How do we measure performance rates? Time a section of code Count how many “items” are done in that section of the code: e.g. floating point operations Compute the rate as the number of items divided by the measured time

6 6 Measuring Performance Rates: II Example: start_timer(...) for (i=0; i<1000000; i++) x = y * z + a stop_timer(...)  Number of Mflop= 2 2 million floating point operations: 1000000 additions, 1000000 multiplications  Number of MFlops: 2 / time

7 7 “Peak” Performance? Computer vendors always talk about peak performance rate  computed based on specifications of the machine  For instance: I build a machine with 2 floating point units Each unit can do an operation in 2 cycles My CPU is at 1000 MHz = 1GHz Therefore I have a (1000M cycles/sec ) * (2 floating point operations / 2 cycles) = 1000 Mflops Machine (1GFlops Machine)

8 8 “Peak” Performance? II Problem:  In real code you will never be able to use the two floating point units constantly (all the time)  Data needs to come from memory and cause the floating point units to be idle Typically, real code achieves often only a small fraction of the peak performance

9 9 Benchmarks Since many performance metrics turn out to be misleading, people have designed benchmarks These benchmarks are typically a collection of several codes that come from “real-world software” Example: SPEC Benchmark  Integer benchmark  Floating point benchmark The question “what is a good benchmark?” is difficult  If the benchmarks do not correspond to what you’ll do with the computer, then the benchmark results are not relevant to you

10 10 How About GHz? This is often the way in which people say that a computer is better than another  More instruction per seconds for higher clock rate Faces the same problems as MIPS But usable within a specific architecture ProcessorClock RateSPEC FP2000 Benchmark IBM Power3450 MHz434 Intel PIII1.4 GHz456 Intel P42.4GHz833 Itanium-21.0GHz1356

11 11 Program Performance In this course we’re not really concerned with determining the performance of a compute platform (whichever way the performance is defined) Instead we’re concerned with improving a program’s performance

12 12 For a given platform, take a given program, run it and measure its wall-clock time Enhance it, run it again and quantify the performance improvement  i.e., the reduction in wall-clock time For each enhanced program version compute its performance  preferably as a relevant performance rate  so that you can say: the best implementation we have so far goes “this fast” (perhaps a % of the peak performance) Improving a Program’s Performance

13 13 The UNIX time Command You can put time in front of any UNIX command you invoke When the invoked command completes, time prints out timing (and other) information % time ls /home/casanova/ -la -R 0.520u 1.570s 0:20.58 10.1% 0+0k 570+105io 0pf+0w  0.520u0.52 seconds of user time  1.570s1.57 seconds of system time  0:20.5620.56 seconds of wall-clock time  10.1%10.1% of CPU was used  0+0kmemory used (text + data)  570+105io570 input, 105 output (file system I/O)  0pf+0w0 page faults and 0 swaps

14 14 User, System, Wall-Clock? User Time: time that the code spends executing user code (i.e., non system calls) System Time: time that the code spends executing system calls Wall-Clock Time: time from start to end Wall-Clock ≥ User + System  in our example: 20.56 ≥ 0.52 + 1.57 Why?  because the process can be suspended by the O/S due to contention for the CPU by other processes  because the process can be blocked waiting for I/O

15 15 Using time Wall-clock - system - user ≈ I/O + suspended  If the system is dedicated, suspended ≈ 0  Therefore one can estimate the cost of I/O  If I/O is really high, one may want to look at reducing I/O or doing I/O better Therefore, time can give us insight into bottlenecks and gives us wall-clock time

16 16 Drawbacks of UNIX time The time command has poor resolution  “Only” milliseconds  Sometimes we want a higher precision, especially if our performance improvements are in the 1-2% range time times the whole code  Sometimes we’re only interested in timing some part of the code, for instance the one that we are trying to optimize  Sometimes we want to compare the execution time of different sections of the code

17 17 Dedicated Systems Measuring the performance of a code must be done dedicated system  No other user can start a process  The user measuring the performance only runs the minimum amount of processes Nevertheless, one should always present measurement results as averages over several experiments  Because the (small) load imposed by the O/S is not deterministic In your assignments, always show averages over 10 experiments, or more if asked to do so explicitly


Download ppt "Measuring Performance Based on slides by Henri Casanova."

Similar presentations


Ads by Google