Optimizing existing large codebase Measure Mem threads Defining our performance Key question is:what is performance o simply going faster not at all costs(money,physics results) o making better use of the hardware most of the time hardware is cheaper than people o you need to define your "Key Performance Indicators" e.g.nb Evts/s/S with constant man power for a trigger o and get a clear idea of your different costs flops/S of your machines including network,cabling,cooling,buildings,... ◆human costs ●cost of transition perf tools bottlenecks 7/62 S.Ponce-CERN
Optimizing existing large codebase 7 / 62 S. Ponce - CERN Measure Modernize Mem threads low level c/c perf tools bottlenecks Defining our performance Key question is : what is performance simply going faster ? not at all costs (money, physics results) making better use of the hardware most of the time hardware is cheaper than people ! you need to define your “Key Performance Indicators” e.g. nb Evts / s / ✩ with constant man power for a trigger and get a clear idea of your different costs flops/✩ of your machines including network, cabling, cooling, buildings, ... human costs cost of transition
Optimizing existing large codebase Measuring our software Many parameters can be measured o overall timing o memory usage and cache efficiency CPU efficiency (Cycles per instructions,vectorization level) level of parallelism,usage of the different cores I/O limitations if any For each of them,you need both overall data and detailed split per code unit o per item,per core and full machine measurement perf tools bottlenecks 8/62 S.Ponce-CERN
Optimizing existing large codebase 8 / 62 S. Ponce - CERN Measure Modernize Mem threads low level c/c perf tools bottlenecks Measuring our software Many parameters can be measured overall timing memory usage and cache efficiency CPU efficiency (Cycles per instructions, vectorization level) level of parallelism, usage of the different cores I/O limitations if any For each of them, you need both overall data and detailed split per code unit per item, per core and full machine measurement
Optimizing existing large codebase How to measure The counters approach o use CPU counters to find out what happened during actual execution o do not slow down execution,so only do sampling The software instrumentation o run your code in a "virtual"environment o measure everything precisely o at the cost of speed perf tools bottlenecks 9/62 S.Ponce-CERN
Optimizing existing large codebase 9 / 62 S. Ponce - CERN Measure Modernize Mem threads low level c/c perf tools bottlenecks How to measure The counters approach use CPU counters to find out what happened during actual execution do not slow down execution, so only do sampling The software instrumentation run your code in a “virtual” environment measure everything precisely at the cost of speed
Optimizing existing large codebase Measuire Modemiss Mem threads low Counters approach in practice o give precise timing of a realistic execution on your CPU ousing real cache prediction,actual vectorization,... using real CPU behavior(e.g.downclocking when overheating...) o allows to measure CPI (Cycles Per Instruction)and low level behavior in general (caching,pipelining) but data is only statistical so you need sufficient statistics o also not always reproducible,so hard to compare e.g.first test on cold processor,second on warm one Main tools available:perf and variants,Intel VTune ef tools bottlenecks 10/62 S.Ponce-CERN
Optimizing existing large codebase 10 / 62 S. Ponce - CERN Measure Modernize Mem threads low level c/c perf tools bottlenecks Counters approach in practice give precise timing of a realistic execution on your CPU using real cache prediction, actual vectorization, ... using real CPU behavior (e.g. downclocking when overheating...) allows to measure CPI (Cycles Per Instruction) and low level behavior in general (caching, pipelining) but data is only statistical so you need sufficient statistics also not always reproducible, so hard to compare e.g. first test on cold processor, second on warm one Main tools available : perf and variants, Intel VTune
Optimizing existing large codebase Measure Mem threads low Software instrumentation in practice o give precise measurements of where you spend instructions including many details oreproducible,so your can compare stuff but not always realistic no real timing,only instructions count memory caching is only simulated,often far from real case no clue on low level efficiency (CPI in particular) and gives no clue on hardware /OS behavior o Main tool available:valgrind family ef tools bottlenecks 11/62 S.Ponce-CERN
Optimizing existing large codebase 11 / 62 S. Ponce - CERN Measure Modernize Mem threads low level c/c perf tools bottlenecks Software instrumentation in practice give precise measurements of where you spend instructions including many details reproducible, so your can compare stuff but not always realistic no real timing, only instructions count memory caching is only simulated, often far from real case no clue on low level efficiency (CPI in particular) and gives no clue on hardware / OS behavior Main tool available : valgrind family