1 / 21

Performance

Performance. The need for speed. http://www.flickr.com/photos/storem/129963685/sizes/z/in/photostream/. Computer 'Speed'. Have you ever wanted a 'faster' computer? What kinds of applications often need powerful (i.e. faster) computers? Graphics Video Processing Real time applications

talia
Download Presentation

Performance

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Performance The need for speed http://www.flickr.com/photos/storem/129963685/sizes/z/in/photostream/

  2. Computer 'Speed' • Have you ever wanted a 'faster' computer? • What kinds of applications often need powerful (i.e. faster) computers? • Graphics • Video Processing • Real time applications • Computational Sciences • Genome Sequencing

  3. How to do things 'faster'? • Computer can get faster in one of two primary ways: • Make faster hardware. • Everything that the computer "does" takes some small amount of time. • These electric machines can be made to work 'faster'. • Make faster algorithms. • Some algorithms (i.e. computational recipes) require fewer operations than others.

  4. Faster Hardware • The speed of hardware is usually measured in • Hertz: The number of changes in one second. • In computing, CPU clock speed is given in hertz to mean the number of clock ticks per second. • One clock tick roughly corresponds to one CPU operation. • Most modern CPU's have a master clock rate of 2-4 GigaHertz. (i.e. 4*109 Hertz) • FLOPS: Floating Point Operations per Second • Refers to the number of mathematical operations that a CPU can perform in one second. • The fastest computer in the world operates at about 100 GigaFLOPSfor a single CPU. • An average home computer operates at around 5-10 GigaFLOPS.

  5. Faster Hardware • Recall Moore's Law? Can we make faster hardware? For how long? • Speed is limited by size and speed-of-light. • No information can travel faster than speed of light. • Smaller circuits mean less distance to travel. • Miniaturization: Current circuits use etchings of about 32nm. (one nano = one billionth = 1/3000 human hair diameter). • Multiple Cores: Use many CPU's connected together. • Alternate Technologies: Quantum computing or biological computing?

  6. Faster Algorithms Empirical Technique Analytic Technique • Consider two programs: A and B. Each program sorts your CD collection by artist name. How would you know which program was 'faster'? • Benchmarks. • A benchmark runs a program on a computer and records the time it takes to finish. • Algorithm speed can be estimated by counting • Specifically, count the number of things the computer does.

  7. Analysis • Example: Find your exam. • You are in a course with 1000 other students. • You take an exam and would like to see the score. • You go to the teachers office and are handed a stack of exams. • How to find your exam?

  8. Linear Search • Linear Search Solution: • Take the top exam from the stack • See if it has your name on it • If so • you are done • If not • place the exam on a discard stack • repeat step 1 until your transcript is found or the stack is empty.

  9. Binary Search • Binary search algorithm : Assume the stack is sorted • Examine the middle transcript in the stack. • If this exam is yours, you've found it. • Else If your name alphabetically precedes the middle name from Step 1, then discard the middle and all exams after the middle. • Otherwise, if your name alphabetically follows the middle, then discard the middle and all exams before the middle. • Repeat Step 1 using the remaining stack. If there are no more exams remaining then your exam is not present. • How many exams would you expect to look at if there are 1000 exams in the stack? • If your exam is not in the stack? • If your exam is in the stack?

  10. Binary Search Payoff How many ‘looks’ for 500 exams?

  11. Counting the Cost What if you had 1000 processors. How long would it take to search through 1000 data items? How many probes would it take to find one item among a stack of items?

  12. comparisons Algorithm to find the maximum Consider 8 numbers. a b c d e f g h max of a & b max of c & d max of e & f max of g & h max of a - d max of e - h max of a - h Total number of comparisons?

  13. a b c d e f g max of a & b max of c & d max of e & f max of a - d max of e - g max of a - g Algorithm to find the maximum What about 7 numbers. Total number of comparisons?

  14. a b c d e f max of a & b max of c & d max of e & f max of a - d max of a - f Algorithm to find the maximum What about 6 numbers. Total number of comparisons?

  15. Algorithm to Find the Maximum • The performance of this algorithm is similar to the linear search. • What if we had 100 processors. Could we make this go faster?

  16. Algorithm to Sort • Sorting algorithms rearrange items from smallest to largest (or largest to smallest). • One sorting algorithm: repeatedly find the maximum value and move it immediately ahead of all prior maximums. • Step 1: Find the max of 100 numbers. Put it at the end. • Step 2: Find the max of 99 numbers. Put it 2nd to the end. • Step 3: Find the max of 98 numbers. Put it 3rd from the end.… • Step 100: Find the max of 1 number. Put it at the beginning. • How many operations will it take to sort the data? • 99 + 98 + 97 + … + 1 + 0 = 99 * 100 / 2 = 4450 operations. • How many operations will it take to sort N items? • (N-1) + (N-2) + (N-3) + … + 1 + 0 = (N-1)*N/2

  17. sorting algorithm linear search binary search Comparing Algorithm Performance

  18. Are there slower algorithms? 94 94 * 94 = 8836 94 * 94 * 94 = 830584 948 = 6 * 1015 94N Consider an algorithm to crack your password. One such algorithm attempts every possible keystroke. Consider 94 keys on a keyboard.

  19. password cracker other algorithms Comparing Algorithm Performance

  20. Functional Growth binary search password cracker linear search sort n log2n n2 94n not practical for any large number of items note 1 - roughly five years of computation for a 1 petaflop supercomputer note 2 - about 5 times the age of the universe

  21. Important Results There are algorithms that take too long to be practically executed on a computer. These slow algorithms tend of be of the type that attempt a brute force approach of attempting all possible combinations. Moore’s Law cannot fix the problem. There are some problems that will never be computable.

More Related