Computer Science 313 – Advanced Programming Topics.

Slides:



Advertisements
Similar presentations
CMSC 611: Advanced Computer Architecture Performance Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
Advertisements

This terms course Last term we both worked on learning 2 things –Processing –The concepts of graphics etc. This term will focus more on the basic concepts.
Computer Science 313 – Advanced Programming Topics.
ECE 454 Computer Systems Programming Compiler and Optimization (I) Ding Yuan ECE Dept., University of Toronto
Performance What differences do we see in performance? Almost all computers operate correctly (within reason) Most computers implement useful operations.
Computer Abstractions and Technology
CSC 313 – Advanced Programming Topics. Today’s Goal  Make you forget reading that was assigned  I went back & reviewed others; none like this one 
Reference :Understanding Computers
TU/e Processor Design 5Z032 1 Processor Design 5Z032 The role of Performance Henk Corporaal Eindhoven University of Technology 2009.
Evaluating Performance
Lecture 1: Basics of Math and Economics AGEC 352 Spring 2011 – January 12 R. Keeney.
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Topic 3-The Time Value of Money Larry Schrenk, Instructor
CS503: First Lecture, Fall 2008 Michael Barnathan.
Chapter 4 Assessing and Understanding Performance
Microprocessors Frame Pointers and the use of the –fomit-frame-pointer switch Feb 25th, 2002.
Compiler Construction
1 Chapter 4. 2 Measure, Report, and Summarize Make intelligent choices See through the marketing hype Key to understanding underlying organizational motivation.
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
CMSC 611: Advanced Computer Architecture Performance Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
1 Instant replay  The semester was split into roughly four parts. —The 1st quarter covered instruction set architectures—the connection between software.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
CSC 213 – Large Scale Programming. Today’s Goal  Consider what will be important when searching  Why search in first place? What is its purpose?  What.
Introduction CS 104: Applied C++ What is Programming? For some given problem: __________ a solution for it -- identify, organize & store the problem's.
CSC 313 – Advanced Programming Topics. Lindsay Lohan Economy  Studies investigated economy of celebrities  Direct earnings from movies, music, TV, ads.
Copyright 1995 by Coherence LTD., all rights reserved (Revised: Oct 97 by Rafi Lohev, Oct 99 by Yair Wiseman, Sep 04 Oren Kapah) IBM י ב מ 7-1 Measuring.
Assembly Questions תרגול 12.
CSC 313 – Advanced Programming Topics. Observer Pattern Intent  Efficiently perform 1-to-many communication  Easy to respond dynamically when event(s)
Big Idea 1: The Practice of Science Description A: Scientific inquiry is a multifaceted activity; the processes of science include the formulation of scientifically.
Lecture 1: Performance EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering Spring 2013, Dr. Rozier.
Computer Science 313 – Advanced Programming Topics.
Goals: To gain an understanding of assembly To get your hands dirty in GDB.
1 Measuring and Discussing Computer System Performance or “My computer is faster than your computer” Reading: 2.4, Peer Instruction Lecture Materials.
1 CS/EE 362 Hardware Fundamentals Lecture 9 (Chapter 2: Hennessy and Patterson) Winter Quarter 1998 Chris Myers.
CSE332: Data Abstractions Lecture 8: Memory Hierarchy Tyler Robison Summer
Speed 1.3 pp Mr. Richter. Agenda  Warm-Up  Review Pop Quiz  Any Questions from the Lab?  Introduce Speed  Oil Drop Drawing  Notes:  Speed.
Compiled by Maria Ramila Jimenez
Computer Science 313 – Advanced Programming Topics.
LECTURE 34: MAPS & HASH CSC 212 – Data Structures.
1 CS/COE0447 Computer Organization & Assembly Language CHAPTER 4 Assessing and Understanding Performance.
Lecture 8: 9/19/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Tom Cargill The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the.
Dynamic Gaze-Contingent Rendering Complexity Scaling By Luke Paireepinart.
SNU OOPSLA Lab. 1 Great Ideas of CS with Java Part 1 WWW & Computer programming in the language Java Ch 1: The World Wide Web Ch 2: Watch out: Here comes.
Compilers and Interpreters. HARDWARE Machine LanguageAssembly Language High Level Language C++ Visual Basic JAVA Humans.
1  1998 Morgan Kaufmann Publishers How to measure, report, and summarize performance (suorituskyky, tehokkuus)? What factors determine the performance.
September 10 Performance Read 3.1 through 3.4 for Wednesday Only 3 classes before 1 st Exam!
Performance – Last Lecture Bottom line performance measure is time Performance A = 1/Execution Time A Comparing Performance N = Performance A / Performance.
Amdahl’s Law CPS 5401 Fall 2013 Shirley Moore
Eagleson’s Law: Any code of your own that you haven't looked at for 6+ months might as well have been written by someone else.
Compilers and Interpreters
Concurrency and Performance Based on slides by Henri Casanova.
Intro to Computer Org. Assessing Performance. What Is Performance? What do we mean when we talk about the “performance” of a CPU?
1 Potential for Parallel Computation Chapter 2 – Part 2 Jordan & Alaghband.
Algorithmic Foundations COMP108 COMP108 Algorithmic Foundations Algorithm efficiency Prudence Wong.
September 2 Performance Read 3.1 through 3.4 for Tuesday
Exponential and Scientific Notation
Conditional Branch Example
A Closer Look at Instruction Set Architectures
CS2100 Computer Organisation
CMSC 611: Advanced Computer Architecture
MSIS 655 Advanced Business Applications Programming
Performance Cycle time of a computer CPU speed speed = 1 / cycle time
PERFORMANCE MEASURES. COMPUTATIONAL MODELS Equal Duration Model:  It is assumed that a given task can be divided into n equal subtasks, each of which.
CMSC 611: Advanced Computer Architecture
The University of Adelaide, School of Computer Science
Compiler Construction CS 606 Sohail Aslam Lecture 1.
CS2100 Computer Organisation
Presentation transcript:

Computer Science 313 – Advanced Programming Topics

Tom Cargill The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

Let’s Get Coding  Who will write next lab in assembly?  Can only use assembly code for entire lab pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax movl %eax, -4(%ebp) cmpl $0, -4(%ebp)

Let’s Get Coding  Who will write next lab in assembly?  Can only use assembly code for entire lab  During the first pass, apply standard optimizations pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax movl %eax, -4(%ebp) cmpl $0, -4(%ebp)

Let’s Get Coding  Who will write next lab in assembly?  Can only use assembly code for entire lab  During the first pass, apply standard optimizations  Every method should be tuned to maximize branches pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax movl %eax, -4(%ebp) cmpl $0, -4(%ebp)

Let’s Get Coding  Who will write next lab in assembly?  Can only use assembly code for entire lab  During the first pass, apply standard optimizations  Every method should be tuned to maximize branches  Necessary to achieve top performance pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax movl %eax, -4(%ebp) cmpl $0, -4(%ebp)

Promise of Perfect Debugging  Programs just λ-calculus equations  Use Java, but instead prove program correct  Translate program into λ-calculus  Specify theorem & prove program correctness

Fewest Lectures Ever

Why Isn’t This Done?  Almost never use these techniques  Low-level device drivers use some C (or similar)  Rare for partial proof of correctness to be used  Simple result from easy cost-benefit analysis  Techniques requires massive amounts of time  Time is money; these are very, very expensive  The provided benefits just not worth it

What’s The Secret? How do I know when to optimize? I need to know. Please, please, please?

Problem is Universal  Frequent need to make optimal decision  Using reagents during chemical synthesis  Take power plant offline & perform maintenance  Fastest torrent from which to download  Cannot optimize everything  Instead we only focus efforts where it matters

Problem is Universal  Frequent need to make optimal decision  Using reagents during chemical synthesis  Take power plant offline & perform maintenance  Fastest torrent from which to download  Cannot optimize everything  Instead we only focus efforts where it matters But how can I know what is important?

Are Graphics Important?  Rewrite Swing to improve its performance?

Are Graphics Important?  Rewrite Swing to improve its performance? Hells, yes. We need 60 fps for new games.

Are Graphics Important?  Rewrite Swing to improve its performance? Hells, yes. We need 60 fps for new games. %#$ no. What does it do for search speed?

Critical Paths  All that is important is code along critical path  Determines time needed and not just the fluff  Graphics are not critical for Google  Major graphics improvements are nice…  …but have zero affect on search times  Bungie’s critical path is graphics package  Games performance limited by graphic times  Would hate GPU for search – slows them down

Guess the Critical Path $ java -Xprof edu.canisius.ann.Network Flat profile of 16.4 secs (956 total ticks): main Compiled + native Method 35.6% Neuron.getWeightedError 21.1% Neuron.updateWeights 13.0% Network.trainNetwork 9.5% java.lang.StrictMath.exp 9.5% Neuron.compute 4.5% Network.setNetworkInput 3.6% Network.runOneInput 2.0% java.util.ArrayList. 0.8% Network.main 99.6% Total compiled

Still a Cost-Benefit Trade Great. More useless geekery. When will it make a difference? When is it worth my time?

Amdahl’s Law  Determines how much faster program can go  Use this to answer question that matters  Speedup calculated by this equation  Speedup of 2 means program twice as fast  Need 1 / 10 the time, 10 is speedup factor of approach  When speedup is 1, time taken unchanged  Speedup of ½ == twice as long as past approach

Amdahl’s Law  Determines how much faster program can go  Use this to answer question that matters  Speedup calculated by this equation  Speedup of 2 means program twice as fast  Need 1 / 10 the time, 10 is speedup factor of approach  When speedup is 1, time taken unchanged  Speedup of ½ == twice as long as past approach (But usually say slowdown factor of 2)

Amdahl’s Law  Determines how much faster program can go  Use this to answer question that matters  Speedup calculated by this equation  Speedup of 2 means program twice as fast  Need 1 / 10 the time, 10 is speedup factor of approach  When speedup is 1, time taken unchanged  Speedup of ½ == twice as long as past approach (But usually say slowdown factor of 2) (Or hide report that shows this sucks)

Amdahl’s Law Equation  %changed of time in methods to be optimized  Expressed as decimal between  All other time from run is %unchanged  Another decimal from 0 – 1 you FAIL  If %changed + %unchanged ≠ 1, you FAIL

Applying Amdahl’s Law  Made getWeightedError twice as fast  Speedup changed = 2, since now twice as fast  Took 16.4 seconds before, what will it take now?  Get execution times using java –Xprof 35.6% Neuron.getWeightedError %changed = %unchanged = = 0.644

Amdahl’s Law Speedup = 1.21

Applying Amdahl’s Law  Move Neuron.compute off critical path?  Removes it from program execution time  Speedup changed = ∞  Get execution times from java –Xprof 9.5% Neuron.compute %changed = %unchanged = = 0.905

Amdahl’s Law Speedup = 1.10

What Amdahl’s Law Means

For Next Class  Lab #2 on web/Angel in 1 hour  I will be in lab from – feel free to stop by  Read pages 37 – 55 in book  Get back into code & design patterns  How could we handle 1-to-many communication?  Why not have cycles in UML class diagram?  What is secret to Lindsay Lohan's success?