复旦大学:《计算机原理 Computer System》课程PPT课件_12b Code Optimization(• Machine-Independent Optimization – Code motion – Memory optimization • Suggested reading)

Code Optimization
1 Code Optimization

Outline Machine-Independent Optimization Code motion Memory optimization Suggested reading -5.2~56
2 Outline • Machine-Independent Optimization – Code motion – Memory optimization • Suggested reading – 5.2 ~ 5.6

Motivation Constant factors matter too easily see 10: 1 performance range depending on how code is written must optimize at multiple levels algorithm, data representations, procedures, and loops
3 Motivation • Constant factors matter too! – easily see 10:1 performance range depending on how code is written – must optimize at multiple levels • algorithm, data representations, procedures, and loops

Motivation Must understand system to optimize performance how programs are compiled and executed how to measure program performance and identify bottlenecks how to improve performance without destroying code modularity and generality
4 Motivation • Must understand system to optimize performance – how programs are compiled and executed – how to measure program performance and identify bottlenecks – how to improve performance without destroying code modularity and generality

5. 2 Expressing Program Performance
5 5.2 Expressing Program Performance

Time Scales P382 Absolute Time Typically use nanoseconds 10-9 seconds Time scale of computer instructions
6 Time Scales P382 • Absolute Time – Typically use nanoseconds • 10–9 seconds – Time scale of computer instructions

Time Scales Clock Cycles Most computers controlled by high frequency clock signal Typical Range 100 MHZ 108 cycles per second Clock period = 10ns ·26Hz 2 X 109 cycles per second Clock period =0.5ns
7 Time Scales • Clock Cycles – Most computers controlled by high frequency clock signal – Typical Range • 100 MHz – 108 cycles per second – Clock period = 10ns • 2 GHz – 2 X 109 cycles per second – Clock period = 0.5ns

CPE P383 1 void vsuml (int n) 2{ in七i 345678 for(i=0;主<n;i++) c[i]=a[i]+b[i];
8 CPE P383 1 void vsum1(int n) 2 { 3 int i; 4 5 for (i = 0; i < n; i++) 6 c[i] = a[i] + b[i]; 7 } 8

CPE P383 9/* Sum vector of n elements (n must be even)*/ 10 void vsum2 (int n) 11{ 12 int i 13 14 for(主=0;i<n;i+=2){ 15 /* Compute two elements per iteration * 16 cli= ali] bli] 17 c[i+1]=a[i+1]+b[i+1]; 18 19}
9 CPE P383 9 /* Sum vector of n elements (n must be even) */ 10 void vsum2(int n) 11 { 12 int i; 13 14 for (i = 0; i < n; i+=2) { 15 /* Compute two elements per iteration */ 16 c[i] = a[i] + b[i]; 17 c[i+1] = a[i+1] + b[i+1]; 18 } 19 }

Cycles per element Convenient way to express performance of program that operators on vectors or lists Length = n T= CPE 大n+ Overhea
10 Cycles Per Element • Convenient way to express performance of program that operators on vectors or lists • Length = n • T = CPE*n + Overhead
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part II.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_09、10 Sequential CPU Implementation.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Processor Architecture.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Heterogeneous Data Structures & Alignment; Putting it Together; Floating Point.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Procedure Call and Array.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs Ⅱ.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Operations; Floating Points.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Representations.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Introduction to Computer Systems; Information is Bits+Context; Information Storage.ppt
- 复旦大学:《计算机原理 Computer System》课程资源_2006年期中考试题目.doc
- 复旦大学:《计算机原理 Computer System》课程资源_2006年期中考试答案.doc
- 复旦大学:《计算机原理 Computer System》课程资源_教学大纲.pdf
- 复旦大学:《计算机图形学》课后习题答案_7.docx
- 复旦大学:《计算机图形学》课后习题答案_6.docx
- 复旦大学:《计算机图形学》课后习题答案_5.docx
- 复旦大学:《计算机图形学》课后习题答案_4.docx
- 复旦大学:《计算机图形学》课后习题答案_3.docx
- 复旦大学:《计算机图形学》课后习题答案_2.docx
- 复旦大学:《计算机原理 Computer System》课程PPT课件_13 Code Optimization(• Optimizing Blockers • Understanding Modern Processor • More Code Optimization techniques • Performance Tuning).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Hardware Organization.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Memory Hierarchy(• Random-Access Memory(RAM)• Nonvolatile Memory • Disk Storage • Locality • Memory hierarchy).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• General concepts • 3 ways to organize cache memory • Issues with writes • Write cache friendly codes • Cache mountain).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• Cache mountain • Matrix multiplication).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Virtual Space• Address translation • Accelerating translation• Different points of view).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Multilevel page tables • Different points of view • Pentium/Linux Memory System • Memory Mapping).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Dynamic Memory Allocation(• Implementation of a simple allocator • Explicit Free List • Segregated Free List).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Linking II(• Static linking • Symbols & Symbol Table • Relocation • Executable Object Files • Loading).ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter2.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level(2)Representation of Programs.ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter4 Processor Architecture.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter5 Optimizing Program Performance.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter6 The Memory Hierarchy.ppt
- 复旦大学:《计算机网络与网页制作》课程教学大纲 Computer Network and Webpage Design.pdf
- 《当代教育理论与实践》论文:大学计算机基础教学实践与思考(复旦大学:肖川、张向东).pdf
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)01 计算机网络基础.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)02 两类基本网络(局域网、无线局域网).pptx