Post on 21-Jun-2020
Dongwoo Kim
Comp2100Performance Analysis & Intellectual Property
1
Administrative – Quiz 3 & Lab test 2
• Quiz 3 due is today• Lab test 2 starts tomorrow
– Must attend the enrolled lab– Same as the LT1 and final exam environment– Practice how to use CSIT lab computers
• IDE settings
2
Administrative – GP Demo
• Add me as a reporter by this Friday• Each group needs to sign up for the demo
presentation– One of the tutorial sessions– Each team has ~10 minutes– Go to StReaMS and register for demo session
• One member per group• Don’t sign up more than on session
• Don’t need to prepare power point3
Administrative – Final Exam
• November 15th
• 9:00am~12:15pm (3h15m)• No materials allowed• Previous exams
– https://cs.anu.edu.au/courses/comp2100/exams/campus_only/
4
Administrative – Final Exam
• No programming questions with– Android Studio / PHP / JML
• Multiple choice questions– Check the previous exams– Practice how to run in Terminal
• Programming questions– Learn how to configure your IDE– Prepare how to run JAVA/JAVAC in terminal– No help during exam
5
Performance analysisAmdahl’s law
6
7
• Question: • You have a program X with two component parts A and
B, each of which takes 10 minutes. What is the latency of X?
• Suppose that you can speedup part B by a factor of 5. What is the latency now? What is the overall speedup?
Motivating Question
8
• Question: • You have a program X with two component parts A and
B, each of which takes 10 minutes. What is the latency of X?
• Suppose that you can speedup part B by a factor of 5. What is the latency now? What is the overall speedup?
• Answer:• If A and B are sequential, then Amdahl’s Law provides
an answer
Motivating Question
9
• How much extra performance can you get if you speed up part of your program?
• Notations:• S is the overall performance gain• k is the speed-up factor• α is the portion of speed-up
• 𝑇"#$ = 1 − 𝛼 𝑇)*+ + 𝛼-./01= 𝑇)*+( 1 − 𝛼 + 3
1)
• 𝑆 = -./0-678
= 99:3 ;<=
Amdahl’s Law
Amdahl’s Law - Example• Your program has one very slow procedure that
consumes 70% of the time. Next, you improve it by a factor of 2. What is the performance gain in the overall latency?
• 𝑆 = -./0-678
= 99:3 ;<=
= 99:>.@ ;A.BC
= 1.538
10
Amdahl’s Law - Example• Your program has one very slow procedure that
consumes 70% of the time. Next, you improve it by a factor of 2. What is the performance gain in the overall latency?
• 𝑆 = -./0-678
= 99:3 ;<=
= 99:>.@ ;A.BC
= 1.538
• Floating point instructions could be improved by 2X. Only 15% of instructions are floating point
• 𝑆 = -./0-678
= 99:3 ;<=
= 99:>.9D ;A.EFC
= 1.081
11
Application to Parallel Processing
• Now, let’s divide the program into sequential part, 1-P, and parallel part, P.
• Assume there are N processors then the improvement of the parallelizable part is N.
• Based on Amdahl’s law, the performance gain from N processors is
𝑆 =1
1 − 𝑃 + 𝑃𝑁
12
Limit as 𝑁 → ∞
limN→O
1
1 − 𝑃 + 𝑃𝑁=
11 − 𝑃
• Fundamental limitation of performance gain from parallelization
• Neglects other potential bottlenecks such as memory bandwidth and I/O bandwidth
13
14
Diminishing Returns
15
• Does your software perform as what you expect?• Does it complete fast?• Does it work well with more inputs• Does it break?
• Metrics of performance:• Latency• Throughput• Memory size• Network bandwidth• Concurrency
• Performance analysis• Best case• Average case• Worst case
Various aspects of performance analysis
Performance Profiling• Tools that provide a visual interface for detailed information
about the runtime operations of a program• Understand how your program utilizes different computing
resources (e.g. memory, CPU, GPU, harddisk, network)• Identify the bottleneck of your program• Optimize program implementation• Locate potential bugs in your program• Examples:
• JConsole• VisualVM• Eclipse Trace Compass
16
Trace Compass
17
Intellectual PropertyIn the context of software development
Slides adopted from Felix Crux’s PyCon2016 presentation
18
Caveat
• I’m not a lawyer!
19
Overview
• What is intellectual property?• Why do we need licenses?• Permissive licenses• Copyleft licenses• No license?
20
What is Intellectual Property?
• Intangible “creations of the mind” that the law lets you monopolize– Books, paintings, songs, movies, and
computer programs• The categories we will look at today:
– Copyrights– Patents– Trademarks
21
Copyright
• Rights to copy, distribute, modify the work• Protects creative, expressive work
– expressions of ideas• Meant to encourage people to make more• Given automatically to the creator
24
Patents
• For protecting functional inventions• The idea: tell us how it works, and you get
exclusivity for a while– processes, machines, manufactures,
compositions of matter• Beware of sneaky trolls and ambushes!
– Some licenses protect you
25
Trademarks
• Protect consumers from fakes and imitators
• Sort of automatic, but registration has power
• Covers names, logos and identifiers like that
• Still relevant to software projects– i.e. Project “Firefox”
26
27
Copyright Patent Trademark
MeaningProtection of original ideas and works
IP right granted by government
Sign, logo that distinguishes a product, service
Rights of Owner
Exclusive rights of reproduction and distribution
Legal rights to exclude unauthorized uses
Legal rights to exclude unauthorized uses
How to obtain No need to register Apply to specific
country (20yrs)Apply to specific country (10yrs)
Common Example
Books, music, movies
Jet engine design, medicine
Pepsi, McDonald’s logo
Tech Example Java API MPEG, 5G, Wifi Facebook, Facebook
like logo
Copyright, Patent, and Trademark
Licenses
• Grant rights people wouldn’t usually have:– To use– To modify– To share
• Create obligations:– Attribution– Share-alike (copyleft)– Whatever shows up in a proprietary license
28
Permissive Licenses
• Let developers do a lot– Including making things proprietary
• Usually just require attribution– and a warranty disclaimer
• Developer friendly / Related to open source– Not free software– Working more efficiently
29
Examples
• MIT/Expat/X11, ISC/n-clause BSD• Apache 2.0
30
• 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
31
Grant of Patent License
• … each Contributor grants You a perpetual, no-charge, irrevocable patent license to use the Work
• … applies only to those patent claims that are infringed by their Contribution
• … if You institute patent litigation alleging that the Work constitutes patent infringement, then patent licenses granted to You shall terminate
32
Copyleft Licenses
• Guarantee user freedom• Prevent developers from restricting or
locking-in users• Require sharing derivatives the same way• Prevent building proprietary software• GPL (GNU general public license)• GPLv3
33
Examples
• GPL– does not allow you to add any additional
restriction– cannot combine the code that has more
restrictions (not compatible w. Apache 2.0)• GPLv3
– Add patent grant clause• LGPL (Lesser)
– allows you to use and integrate a software component released under the LGPL into their own software
34
I don’t care: No License!
• When you make a creative work, the work is under exclusive copyright by default.
• Nobody else can copy, distribute, or modify your work without any risk
• Visible software != Free/Open Source• Once the work has other contributors
(each a copyright holder), “nobody” starts including you.
36
https://choosealicense.com/
37Creative Commons Attribution 3.0 Unported License.
• https://en.wikipedia.org/wiki/Comparison_of_free_and_open-source_software_licenses
38
39
• A popular type of public copyright licenses that an author wants to give other people the right to share, use, and build upon a work that the author has created
• All CC licenses require that others who use your work in any way must give you credit the way you request, but not in a way that suggests you endorse them or their use
• If they want to use your work without giving you credit or for endorsement purposes, they must get your permission first
What is Creative Commons license
40
What is Creative Commons license
Wrap-upWhat we have learned so far…
41
• Design– Algorithm: better complexity
• Data structure: Trees– OOP: Design patterns / UML– Data: json, xml
• Testing– Verification: Unit testing– Performance: Amdahl’s law
• Internals– Tokenizer / Parser
• Tools– Git, SSH, Makefile
42
Android App Dev.
Software construction
• Design– Algorithm: better complexity
• Data structure: Trees– OOP: Design patterns / UML– Data: json, xml
• Testing– Verification: Unit testing– Performance: Amdahl’s law
• Internals– Tokenizer / Parser
• Tools– Git, SSH, Makefile
43
Android App Dev.
Wanna more?
Comp3600
Comp2120
Comp2400
Comp3600
Comp2300 Comp3320
Comp2120