《Telemetry enhanced green coding – how detailed telemetry can contribute to sustainability goals.pdf》由会员分享,可在线阅读,更多相关《Telemetry enhanced green coding – how detailed telemetry can contribute to sustainability goals.pdf(29页珍藏版)》请在三个皮匠报告上搜索。
1、How detailed telemetry can contribute to sustainability goals?Telemetry Enhanced Green CodingMaciej Lawniczak,Cloud Software Architect,IntelMateusz Duchalski,Cloud Software Development Engineer,IntelTelemetry enhanced green coding how detailed telemetry can contribute to sustainability goalsDC SUSTA
2、INABILITYSUSTAINABILITY1.What is green coding?2.Green coding best practices.3.Telemetry and green coding.4.How to code green.5.Predicting future of green coding.6.Call to action.AgendaWhat is green coding?Green ComputingHardware Power ManagementMaterials RecyclingSoftware and DeploymentAlgorithmic E
3、fficiencySoftware Power ManagementData CompressionResource AllocationVirtualizationData Center DesignProduct LongevityGreen coding best practicesInfrastructureCachingNetwork data size and distance reductionStorage data size reductionGreen databaseProcessingProgramming language choiceComputing hardwa
4、re choiceGreen algorithmsGreen librariesComputational accuracy reductionPower managementDevelopment processMonitor energy consumptionCloud deploymentsVirtualizationDatacenter locationLean development processesTelemetry and green codingLayersData centerRackPlatformCPU&MemoryGPU&AcceleratorMetrics Ene
5、rgy usage Resource utilization Environmental factors Low power state residenciesUsagesSoftware developmentMonitoringOrchiestrationTelemetry is key for enabling energy-efficient data center operations across diverse set of infrastructure layers&usagesTelemetry and green codingThis sessions focusTelem
6、etry and green codingCategoryUse case exampleSupporting telemetry exampleIntel Xeon CPU.Software developmentEnergy use profiling&testing.Energy profile guided optimizationMonitoringIdle system&inefficiency identificationCooling performance monitoringOrchestration Energy-aware workload placementEnerg
7、y-based billingRAPLPackage energyDRAM energyPMTV/F/T histogramsC-state residenciesPerfMonCore perf countersRAPL Running Average Power LimitPMT Intel Platform Monitoring Technology(Intel PMT)Telemetry and green codingThis sessions focusEvaluated examples:1.Programming practices(Python)2.Algorithm sel
8、ection(Python)3.Library selection(Python/C/C+)4.Compiler optimization(C/C+)How to code greenCPU telemetry collectorsIntel-PMT toolLinux perf toolTest harnessAggregate resultsExecutable under testN-timesminmaxavg.CPU5th Generation Intel Xeon ScalableRAM32GB DDR5.SoftwareHardware4321Best practiceFollo
9、w language specific programming recommendationsProgramming languagePythonCompilersLibrariesScenario/code snippetFor loop list creation List comprehensionsInput dataHow to code green programming practicesdata=for i in range(100000000):data.append(i)data=x for x in range(100000000)1234Highlights:Lists
10、 created using“for”loop vs list comprehensions are:66%slower68%less energy efficientPower consumption during workload is 2.3W(1.7%)higher for list comprehensions higher core utilization.How to code green programming practices02003004005006007008009001000w/comprehensionw/o comprehensionTim
11、e sEnergy JPower WList comprehensionsTotal EnergyPowerTime ElapsedEnergy saved to Light a LED bulb for 34 seconds1234Best practiceUse most energy efficient algorithmsProgramming languagePythonCompilersLibraries/Algorithmsshell,merge,gnome,heap,insertion,selection,pigeon hole,brick,pancake,bubble,rad
12、ixScenario/code snippetInput dataRandom list with 1000,10000 and 100000 samples from range 0 to 1MHow to code green programming practicesfrom sorting_techniques import pysortpysort.Sorting().algorithm(data)1234Highlights:In general,execution time is strongly correlated with energy consumption.Bubble
13、 algorithm for this sample set size is an exception to above rule.How to code green algorithm selection0.010.11110100TIME sEnergy JSorting algorithms-1000 samplesTotal EnergyTime Elapsed1234Highlights:Bubble algorithm underutilizes CPU core which is also reflected in CPU temperature difference vs av
14、erage of all the rest of the algorithms.How to code green algorithm selection00708090100 35 C 2.8 GHzTemperatureFrequencyResidency%Temperature/frequency bucket residencyAverage algorithmBubble algorithm1234Highlights:Execution time is linearly correlated with energy consumption.Radix algo
15、rithm uses 89x more energy than shell algorithm to perform the same task.How to code green algorithm selection0.010.000TIME sEnergy JSorting algorithms-10000 samplesTotal EnergyTime ElapsedEnergy saved to Boil 1 gram of water1234Highlights:Execution time is linearly correlated with energy
16、 consumption.Radix algorithm uses 6434x more energy than shell algorithm to perform the same task.How to code green algorithm selection0.010.0000100000TIME sEnergy JSorting algorithms-100000 samplesTotal EnergyTime Elapsed Energy saved to Charge a phone1234How to code green lib
17、rary selection(case 1)Best practiceUse most energy efficient libraries in the codeProgramming languagePythonCompilersLibrariesbuilt-in json,simplejson,ujson,rapidjson,orjson,nujsonScenario/code snippetInput data300MB JSON file with 1M user data entriesjson.loads(json.dumps(data)1234Highlights:Simila
18、rly to algorithms most performant libraries are also most energy efficient.Signficant energy consumption differences even between similarly featured librariesHow to code green library selection(case 1)0200300400500600700800900TIME sEnergy JPython JSON librariesTotal EnergyTime ElapsedEner
19、gy saved to Watch TV for 6 seconds1234Highlights:Distribution between CPU and memory energy usage slightly vary between libraries apart from built-in json which is more processing orientedBuilt-in json library has the lowest power usage which relates to lower core frequency and core temperature duri
20、ng executionHow to code green library selection(case 1)4.44.64.855.25.45.648139%Power WPython JSON librariesPowerEnergy Memory/Energy CPU1234How to code green library selection(case 2)Best practiceUse most energy efficient libraries in the codeProgramming languageC/C+Compilersi
21、cx(-O3 xsapphirerapids)Librariespugixml,RapidXML,Xerces-C(SAX&DOM),TinyXML2,libxml2Scenario/code snippetFor DOM parsers build DOM tree for input XMLFor SAX parsers process whole file(w/dummy handlers)Input data500MB XML file containing partial Wikimedia backup1234Highlights:Continue to see significa
22、nt differences even between similarly featured librariesThis is similar to Python JSON parsing librariesHow to code green library selection(case 2)0550002500300035004000pugixmlRapidXMLXerces-C(SAX)TinyXML2libxml2Xerces-C(DOM)Time sEnergy JC/C+XML parsing librariesPackage Energy
23、DRAM EnergyTime Elapsed1234Energy saved to Power a hard drive for 7 minsHow to code green compiler optimizationBest practiceTune complier optimization options for lowest energy usageProgramming languageC/C+Compilersgcc,clang,icxLibrariespugixml,RapidXML,Xerces-C(SAX&DOM),TinyXML2,libxml2Scenario/cod
24、e snippetBuild DOM tree for input XMLInput data500MB XML file containing partial Wikimedia backup1234Conclusions:Enabling native optimizations(-march=sapphirerapids)yielded significant energy use reductionContinuing to see strong correlation between energy and timeBut,there are outliers e.g.GCC size
25、 optimization.How to code green compiler optimization1234-6%-4%-2%0%2%4%6%8%10%12%14%16%Deviation from library mean(%)Lower is betterTotal EnergyTime ElapsedConclusions:For GCC size optimization,time to energy correlation is significantly weakerEnergy use is consistenly lower then execution time wou
26、ld implyHow to code green compiler optimization1234-1.5%-1.0%-0.5%0.0%0.5%1.0%pugixmlTinyXML2Xerces-C(SAX)libxml2Xerces-C(DOM)RapidXMLDeviation from library mean(%)Lower is betterEffects of GCC size optimization(gcc-Os-march=x86-64)Total EnergyTime ElapsedOptimizing for speed is a good starting poin
27、tBut even in trivial single-core cases,faster isnt necesserly the most energy efficientDedicated sustainability telemetry needed to guide green software developmentSmall design and implementation decisions may significatly affect energy useFollowing performance best practicesUse of energy efficient
28、algorithms,libraries and compiler optionsHow to code green summary1234Energy-targeted optimization integrated into compilers and interpretersCompile-time energy profile guided optimizationsSustainability telemetry integrated into CI/CD flowsSustainability ranking of applications and librariesEnergy
29、efficiency focused static code analyzersCode energy efficiency calculations integrated into IDEPredicting future of green codingCall to ActionFocus your development process on sustainabilityUse sustainability telemetry to guide design and implementation decisionsAdd sustainability aspect to code review processAdd sustainability telemetry to CI/CDEncourage and support green coding initiativesExpose sustainability telemetry in new productsSupport sustainability researches related with tech industryShare your green coding practices and tools with communityThank you!