软件调优基础_第1页
软件调优基础_第2页
软件调优基础_第3页
软件调优基础_第4页
软件调优基础_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、软件调优基础,陈健 2003/3,为什么需要调优?相同的代码 不同的性能,for(i=0;iNUM;i+) for(j=0;jNUM;j+) for(k=0;kNUM;k+) cij =cij + aik * bkj; ,for(i=0;iNUM;i+) for(k=0;kNUM;k+) for(j=0;jNUM;j+) cij =cij + aik * bkj; ,目标,明确性能调优的主要任务 定义一些重要的性能调优术语 利用Intel工具提供帮助,Agenda,Performance Cycle Overview The Performance Cycle When to Start Pe

2、rformance Gains When to Stop Putting it into Perspective Performance Cycle Details Summary,调优循环,When (why) to Start,User Requirement? Software Vendor Requirement? Put Performance Requirement into the Requirements Document Performance should be considered at every stage of the product life cycle (Req

3、uirements Gathering, Design, and Testing) Exception: Do “code tuning” after the simple/readable non-optimized version of the application exists.,工作 vs. 效果,When to Stop,Architecture is at Maximum Efficiency? Be sure you know what this is: Calculate Theoretical Maximum Performance Requirement is satis

4、fied Incrementally do Wide Mesh Optimizations2 until done,调优原则,We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Donald Knuth,Quality Code is: Portable Readable Maintainable Reliable Intelligently Sacrifice Quality for Performance,A

5、genda,Performance Cycle Overview Performance Cycle Details Gather Performance Data Analyze Data and Identify Issues Generate Alternatives to Resolve Issues Implement Enhancements Summary,收集性能数据,Timer Use to get wall clock time Accuracy, Low Overhead Use Intel VTune Performance Analyzer Profiler: Gat

6、her Information about Code Usage Performance Monitor: Gather Information about System Resource Usage,工作量,A good workload should have these characteristics: measurable reproducible static representative,分析数据得出结论,Baseline Current Performance Examine Hot Spots Identify Bottlenecks Calculate Potential M

7、aximum Performance,Examine Hot Spots,The Pareto Principle, a.k.a. the 80/20 Rule Concentrate on the vital few vs. the trivial many Hot Spot: 应用或系统中占主要运算量的部分 Generally consists of a Loop For Applications that dont have hot spots, examine: Memory Layout Exceptions Effective Compiler Usage,额外内容,Big O U

8、tilization, Efficiency, Throughput, Latency Bottlenecks I/O, Memory, CPU MIPS/FLOPS/CPI Concurrency, Parallelism Scalability Loads/Stores per Calculation,Agenda,Performance Cycle Overview Performance Cycle Details Gather Performance Data Analyze Data and Identify Issues Generate Alternatives to Reso

9、lve Issues Implement Enhancements Summary,优化设计层次,问题定义 系统结构 算法和数据结构 代码调优 系统软件 系统硬件,代码调优,汇编指令级 内部函数 C+ 向量类库 多线程 循环转化 编译器及参数 性能库,Hardest to develop and maintain Easiest to develop, port and maintain,Code Tuning,If Parallel Processing Break Algorithm up across Clusters (Distributed Memory) Single Node O

10、ptimization Break Algorithm up across Processors (SMP),修改代码实现优化,Use Intel Libraries Use Various Compiler Switches Find out if the compiler or hardware does the enhancements automatically - before implementing yourself Modify Source(i.e. Loop Transformations, SWP,SIMD, OpenMP, Intrinsics,Assembly),Test!,Make sure Applications still runs correctly (Regression Testing) Make sure enhancement actually increases performance Calculate Speed-up Decide if youre done optimizing,Speed-Up,The Two Basic Formulas,Summary,Optimization Tasks Gather Performance Data An

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论