




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
Copyright?2010,ElsevierInc.AllrightsReservedChapter1WhyParallelComputing?AnIntroductiontoParallelProgrammingPeterPachecoCopyright?2010,ElsevierIncCopyright?2010,ElsevierInc.AllrightsReservedRoadmapWhyweneedever-increasingperformance.Whywe’rebuildingparallelsystems.Whyweneedtowriteparallelprograms.Howdowewriteparallelprograms?Whatwe’llbedoing.Concurrent,parallel,distributed!#ChapterSubtitleCopyright?2010,ElsevierIncChangingtimesCopyright?2010,ElsevierInc.AllrightsReservedFrom1986–2002,microprocessorswerespeedinglikearocket,increasinginperformanceanaverageof50%peryear.
Sincethen,it’sdroppedtoabout20%increaseperyear.ChangingtimesCopyright?2010AnintelligentsolutionCopyright?2010,ElsevierInc.AllrightsReservedInsteadofdesigningandbuildingfastermicroprocessors,putmultipleprocessorsonasingleintegratedcircuit.
AnintelligentsolutionCopyrigNowit’suptotheprogrammersAddingmoreprocessorsdoesn’thelpmuchifprogrammersaren’tawareofthem……ordon’tknowhowtousethem.
Serialprogramsdon’tbenefitfromthisapproach(inmostcases).Copyright?2010,ElsevierInc.AllrightsReservedNowit’suptotheprogrammersWhyweneedever-increasingperformanceComputationalpowerisincreasing,butsoareourcomputationproblemsandneeds.Problemsweneverdreamedofhavebeensolvedbecauseofpastincreases,suchasdecodingthehumangenome.Morecomplexproblemsarestillwaitingtobesolved.Copyright?2010,ElsevierInc.AllrightsReservedWhyweneedever-increasingpeClimatemodelingCopyright?2010,ElsevierInc.AllrightsReservedClimatemodelingCopyright?20ProteinfoldingCopyright?2010,ElsevierInc.AllrightsReservedProteinfoldingCopyright?201DrugdiscoveryCopyright?2010,ElsevierInc.AllrightsReservedDrugdiscoveryCopyright?2010EnergyresearchCopyright?2010,ElsevierInc.AllrightsReservedEnergyresearchCopyright?201DataanalysisCopyright?2010,ElsevierInc.AllrightsReservedDataanalysisCopyright?2010,Whywe’rebuildingparallelsystemsUptonow,performanceincreaseshavebeenattributabletoincreasingdensityoftransistors.
Butthereare
inherent
problems.Copyright?2010,ElsevierInc.AllrightsReservedWhywe’rebuildingparallelsyAlittlephysicslessonSmallertransistors=fasterprocessors.Fasterprocessors=increasedpowerconsumption.Increasedpowerconsumption=increasedheat.Increasedheat=unreliableprocessors.Copyright?2010,ElsevierInc.AllrightsReservedAlittlephysicslessonSmallerSolutionMoveawayfromsingle-coresystemstomulticoreprocessors.“core”=centralprocessingunit(CPU)
Copyright?2010,ElsevierInc.AllrightsReservedIntroducingparallelism!!!SolutionMoveawayfromsingleWhyweneedtowriteparallelprogramsRunningmultipleinstancesofaserialprogramoftenisn’tveryuseful.Thinkofrunningmultipleinstancesofyourfavoritegame.Whatyoureallywantisfor
ittorunfaster.Copyright?2010,ElsevierInc.AllrightsReservedWhyweneedtowriteparallelApproachestotheserialproblemRewriteserialprogramssothatthey’reparallel.
Writetranslationprogramsthatautomaticallyconvertserialprogramsintoparallelprograms.Thisisverydifficulttodo.Successhasbeenlimited.Copyright?2010,ElsevierInc.AllrightsReservedApproachestotheserialproblMoreproblemsSomecodingconstructscanberecognizedbyanautomaticprogramgenerator,andconvertedtoaparallelconstruct.However,it’slikelythattheresultwillbeaveryinefficientprogram.Sometimesthebestparallelsolutionistostepbackanddeviseanentirelynewalgorithm.Copyright?2010,ElsevierInc.AllrightsReservedMoreproblemsSomecodingconstExampleComputenvaluesandaddthemtogether.Serialsolution:Copyright?2010,ElsevierInc.AllrightsReservedExampleComputenvaluesandadExample(cont.)Wehavepcores,pmuchsmallerthann.Eachcoreperformsapartialsumofapproximatelyn/pvalues.Copyright?2010,ElsevierInc.AllrightsReservedEachcoreusesit’sownprivatevariablesandexecutesthisblockofcode
independentlyoftheothercores.Example(cont.)WehavepcoresExample(cont.)Aftereachcorecompletesexecutionofthecode,isaprivatevariablemy_sumcontainsthesumofthevaluescomputedbyitscallstoCompute_next_value.Ex.,8cores,n=24,thenthecallstoCompute_next_valuereturn:Copyright?2010,ElsevierInc.AllrightsReserved1,4,3,9,2,8,5,1,1,5,2,7,2,5,0,4,1,8,6,5,1,2,3,9Example(cont.)AftereachcoreExample(cont.)Onceallthecoresaredonecomputingtheirprivatemy_sum,theyformaglobalsumbysendingresultstoadesignated“master”corewhichaddsthefinalresult.Copyright?2010,ElsevierInc.AllrightsReservedExample(cont.)OnceallthecoExample(cont.)Copyright?2010,ElsevierInc.AllrightsReservedExample(cont.)Copyright?201Example(cont.)Copyright?2010,ElsevierInc.AllrightsReservedCore01234567my_sum8197157131214Globalsum8+19+7+15+7+13+12+14=95Core01234567my_sum95197157131214Example(cont.)Copyright?201Copyright?2010,ElsevierInc.AllrightsReservedButwait!There’samuchbetterway
tocomputetheglobalsum.Copyright?2010,ElsevierIncBetterparallelalgorithmDon’tmakethemastercoredoallthework.Shareitamongtheothercores.Pairthecoressothatcore0addsitsresultwithcore1’sresult.Core2addsitsresultwithcore3’sresult,etc.Workwithoddandevennumberedpairsofcores.Copyright?2010,ElsevierInc.AllrightsReservedBetterparallelalgorithmDon’tBetterparallelalgorithm(cont.)Repeattheprocessnowwithonlytheevenlyrankedcores.Core0addsresultfromcore2.Core4addstheresultfromcore6,etc.Nowcoresdivisibleby4repeattheprocess,andsoforth,untilcore0hasthefinalresult.Copyright?2010,ElsevierInc.AllrightsReservedBetterparallelalgorithm(conMultiplecoresformingaglobalsumCopyright?2010,ElsevierInc.AllrightsReservedMultiplecoresformingaglobaAnalysisInthefirstexample,themastercoreperforms7receivesand7additions.Inthesecondexample,themastercoreperforms3receivesand3additions.Theimprovementismorethanafactorof2!Copyright?2010,ElsevierInc.AllrightsReservedAnalysisInthefirstexample,Analysis(cont.)Thedifferenceismoredramaticwithalargernumberofcores.Ifwehave1000cores:Thefirstexamplewouldrequirethemastertoperform999receivesand999additions.Thesecondexamplewouldonlyrequire10receivesand10additions.
That’sanimprovementofalmostafactorof100!Copyright?2010,ElsevierInc.AllrightsReservedAnalysis(cont.)ThedifferenceHowdowewriteparallelprograms?TaskparallelismPartitionvarioustaskscarriedoutsolvingtheproblemamongthecores.
DataparallelismPartitionthedatausedinsolvingtheproblemamongthecores.Eachcorecarriesoutsimilaroperationsonit’spartofthedata.Copyright?2010,ElsevierInc.AllrightsReservedHowdowewriteparallelprogrProfessorPCopyright?2010,ElsevierInc.AllrightsReserved15questions300examsProfessorPCopyright?2010,EProfessorP’sgradingassistantsCopyright?2010,ElsevierInc.AllrightsReservedTA#1TA#2TA#3ProfessorP’sgradingassistanDivisionofwork–
dataparallelismCopyright?2010,ElsevierInc.AllrightsReservedTA#1TA#2TA#3100exams100exams100examsDivisionofwork–
dataparalDivisionofwork–
taskparallelismCopyright?2010,ElsevierInc.AllrightsReservedTA#1TA#2TA#3Questions1-5Questions6-10Questions11-15Divisionofwork–
taskparalDivisionofwork–
dataparallelismCopyright?2010,ElsevierInc.AllrightsReservedDivisionofwork–
dataparalDivisionofwork–
taskparallelismCopyright?2010,ElsevierInc.AllrightsReservedTasksReceivingAdditionDivisionofwork–
taskparalCoordinationCoresusuallyneedtocoordinatetheirwork.Communication–oneormorecoressendtheircurrentpartialsumstoanothercore.Loadbalancing–sharetheworkevenlyamongthecoressothatoneisnotheavilyloaded.Synchronization–becauseeachcoreworksatitsownpace,makesurecoresdonotgettoofaraheadoftherest.Copyright?2010,ElsevierInc.AllrightsReservedCoordinationCoresusuallyneedWhatwe’llbedoingLearningtowriteprogramsthatareexplicitlyparallel.UsingtheClanguage.UsingthreedifferentextensionstoC.Message-PassingInterface(MPI)PosixThreads(Pthreads)OpenMPCopyright?2010,ElsevierInc.AllrightsReservedWhatwe’llbedoingLearningtoTypeofparallelsystemsShared-memoryThecorescanshareaccesstothecomputer’smemory.Coordinatethecoresbyhavingthemexamineandupdatesharedmemorylocations.Distributed-memoryEachcorehasitsown,privatememory.Thecoresmustcommunicateexplicitlybysendingmessagesacrossanetwork.Copyright?2010,ElsevierInc.AllrightsReservedTypeofparallelsystemsSharedTypeofparallelsystemsCopyright?2010,ElsevierInc.AllrightsReservedShared-memoryDistributed-memoryTypeofparallelsystemsCopyriTerminologyConcurrentcomputin
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 行政管理特別關(guān)注的法學(xué)試題及答案
- 法學(xué)概論考試中的法律變化適應(yīng)及試題及答案
- 江蘇省昆山、太倉(cāng)市2025屆七下數(shù)學(xué)期末學(xué)業(yè)水平測(cè)試模擬試題含解析
- 法學(xué)概論的課程設(shè)置試題及答案
- 2025至2030年中國(guó)掛鉤毛巾架行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025至2030年中國(guó)微型雙面密封圈深溝球軸承行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025至2030年中國(guó)左右搖擺踏步機(jī)行業(yè)投資前景及策略咨詢研究報(bào)告
- 風(fēng)險(xiǎn)評(píng)估體系的建立與實(shí)施試題及答案
- 財(cái)務(wù)風(fēng)險(xiǎn)預(yù)測(cè)與管理策略試題及答案
- 2025至2030年中國(guó)低損耗三相油浸式電力變壓器行業(yè)投資前景及策略咨詢研究報(bào)告
- 《一元二次方程》復(fù)習(xí)2省公開課獲獎(jiǎng)?wù)n件說(shuō)課比賽一等獎(jiǎng)?wù)n件
- 選拔卷-:2024年小升初數(shù)學(xué)模擬卷三(北師大版)A3版
- 康復(fù)醫(yī)學(xué)康復(fù)治療技術(shù)含內(nèi)容模板
- 無(wú)人機(jī)技術(shù)在農(nóng)業(yè)的應(yīng)用
- 快遞云倉(cāng)合同范本
- NB-T 47037-2021 電站閥門型號(hào)編制方法
- 2024春期國(guó)開電大??啤兑簤号c氣壓傳動(dòng)》在線形考(形考任務(wù)+實(shí)驗(yàn)報(bào)告)試題及答案
- 2024年輔警考試公基常識(shí)300題(附解析)
- 前額葉皮質(zhì)在記憶中的作用與機(jī)制
- 小學(xué)少先隊(duì)活動(dòng)課說(shuō)課稿
- 妊娠期常見(jiàn)的皮膚病
評(píng)論
0/150
提交評(píng)論