OpenMP introductionWord下载.docx

上传人:b****6 文档编号:19643242 上传时间:2023-01-08 格式:DOCX 页数:77 大小:107.24KB
下载 相关 举报
OpenMP introductionWord下载.docx_第1页
第1页 / 共77页
OpenMP introductionWord下载.docx_第2页
第2页 / 共77页
OpenMP introductionWord下载.docx_第3页
第3页 / 共77页
OpenMP introductionWord下载.docx_第4页
第4页 / 共77页
OpenMP introductionWord下载.docx_第5页
第5页 / 共77页
点击查看更多>>
下载资源
资源描述

OpenMP introductionWord下载.docx

《OpenMP introductionWord下载.docx》由会员分享,可在线阅读,更多相关《OpenMP introductionWord下载.docx(77页珍藏版)》请在冰豆网上搜索。

OpenMP introductionWord下载.docx

3.WORKSHAREDirective

4.SINGLEDirective

6.CombinedParallelWork-SharingConstructs

1.PARALLELDO/parallelforDirective

2.PARALLELSECTIONSDirective

3.PARALLELWORKSHAREDirective

7.TASKConstruct

8.SynchronizationConstructs

1.MASTERDirective

2.CRITICALDirective

3.BARRIERDirective

4.TASKWAITDirective

5.ATOMICDirective

6.FLUSHDirective

7.ORDEREDDirective

9.THREADPRIVATEDirective

10.DataScopeAttributeClauses

1.PRIVATEClause

2.SHAREDClause

3.DEFAULTClause

4.FIRSTPRIVATEClause

5.LASTPRIVATEClause

6.COPYINClause

7.COPYPRIVATEClause

8.REDUCTIONClause

11.Clauses/DirectivesSummary

12.DirectiveBindingandNestingRules

5.Run-TimeLibraryRoutines

1.OMP_SET_NUM_THREADS

2.OMP_GET_NUM_THREADS

3.OMP_GET_MAX_THREADS

4.OMP_GET_THREAD_NUM

5.OMP_GET_THREAD_LIMIT

6.OMP_GET_NUM_PROCS

7.OMP_IN_PARALLEL

8.OMP_SET_DYNAMIC

9.OMP_GET_DYNAMIC

10.OMP_SET_NESTED

11.OMP_GET_NESTED

12.OMP_SET_SCHEDULE

13.OMP_GET_SCHEDULE

14.OMP_SET_MAX_ACTIVE_LEVELS

15.OMP_GET_MAX_ACTIVE_LEVELS

16.OMP_GET_LEVEL

17.OMP_GET_ANCESTOR_THREAD_NUM

18.OMP_GET_TEAM_SIZE

19.OMP_GET_ACTIVE_LEVEL

20.OMP_INIT_LOCK

21.OMP_DESTROY_LOCK

22.OMP_SET_LOCK

23.OMP_UNSET_LOCK

24.OMP_TEST_LOCK

25.OMP_INIT_NEST_LOCK

26.OMP_DESTROY_NEST_LOCK

27.OMP_SET_NEST_LOCK

28.OMP_UNSET_NEST_LOCK

29.OMP_TEST_NEST_LOCK

30.OMP_GET_WTIME

31.OMP_GET_WTICK

6.EnvironmentVariables

7.MemoryandPerformanceIssues

8.LLNLSpecificInformationandRecommendations

9.ReferencesandMoreInformation

10.Exercise

Abstract

OpenMPisanApplicationProgramInterface(API),jointlydefinedbyagroupofmajorcomputerhardwareandsoftwarevendors.OpenMPprovidesaportable,scalablemodelfordevelopersofsharedmemoryparallelapplications.TheAPIsupportsC/C++andFortranonawidevarietyofarchitectures.ThistutorialcoversmostofthemajorfeaturesofOpenMP,includingitsvariousconstructsanddirectivesforspecifyingparallelregions,worksharing,synchronizationanddataenvironment.Runtimelibraryfunctionsandenvironmentvariablesarealsocovered.ThistutorialincludesbothCandFortranexamplecodesandalabexercise.

Level/Prerequisites:

GearedtothosewhoarenewtoparallelprogrammingwithOpenMP.BasicunderstandingofparallelprogramminginCorFortranassumed.ForthosewhoareunfamiliarwithParallelProgrammingingeneral,thematerialcoveredinEC3500:

IntroductiontoParallelComputingwouldbehelpful.

Introduction

WhatisOpenMP?

OpenMPIs:

∙AnApplicationProgramInterface(API)thatmaybeusedtoexplicitlydirectmulti-threaded,sharedmemoryparallelism

∙ComprisedofthreeprimaryAPIcomponents:

oCompilerDirectives

oRuntimeLibraryRoutines

oEnvironmentVariables

∙Portable:

oTheAPIisspecifiedforC/C++andFortran

oMostmajorplatformshavebeenimplementedincludingUnix/LinuxplatformsandWindowsNT

∙Standardized:

oJointlydefinedandendorsedbyagroupofmajorcomputerhardwareandsoftwarevendors

∙WhatdoesOpenMPstandfor?

oShortversion:

OpenMulti-Processing

oLongversion:

OpenspecificationsforMulti-Processingviacollaborativeworkbetweeninterestedpartiesfromthehardwareandsoftwareindustry,governmentandacademia.

OpenMPIsNot:

∙Meantfordistributedmemoryparallelsystems(byitself)

∙Necessarilyimplementedidenticallybyallvendors

∙Guaranteedtomakethemostefficientuseofsharedmemory

∙Requiredtocheckfordatadependencies,dataconflicts,raceconditions,ordeadlocks

∙Requiredtocheckforcodesequencesthatcauseaprogramtobeclassifiedasnon-conforming

∙Meanttocovercompiler-generatedautomaticparallelizationanddirectivestothecompilertoassistsuchparallelization

∙Designedtoguaranteethatinputoroutputtothesamefileissynchronouswhenexecutedinparallel.Theprogrammerisresponsibleforsynchronizinginputandoutput.

References:

∙OpenMPwebsite:

openmp.org

APIspecifications,FAQ,presentations,discussions,mediareleases,calendar,membershipapplicationandmore...

∙Wikipedia:

en.wikipedia.org/wiki/OpenMP

History

AncientHistory:

∙Intheearly90'

s,vendorsofshared-memorymachinessuppliedsimilar,directive-based,Fortranprogrammingextensions:

oTheuserwouldaugmentaserialFortranprogramwithdirectivesspecifyingwhichloopsweretobeparallelized

oThecompilerwouldberesponsibleforautomaticallyparallelizingsuchloopsacrosstheSMPprocessors

∙Implementationswereallfunctionallysimilar,butwerediverging(asusual)

∙FirstattemptatastandardwasthedraftforANSIX3H5in1994.Itwasneveradopted,largelyduetowaninginterestasdistributedmemorymachinesbecamepopular.

WhichLedTo...

∙TheOpenMPstandardspecificationstartedinthespringof1997,takingoverwhereANSIX3H5hadleftoff,asnewersharedmemorymachinearchitecturesstartedtobecomeprevalent.

∙LedbytheOpenMPArchitectureReviewBoard(ARB).OriginalARBmembersincluded:

(Disclaimer:

allpartnernamesderivedfromtheOpenMPwebsite)

oCompaq/Digital

oHewlett-PackardCompany

oIntelCorporation

oInternationalBusinessMachines(IBM)

oKuck&

Associates,Inc.(KAI)

oSiliconGraphics,Inc.

oSunMicrosystems,Inc.

oU.S.DepartmentofEnergyASCIprogram

∙Othercontributorsincluded:

Endorsingapplicationdevelopers:

oADINAR&

D,Inc.

oANSYS,Inc.

oDashAssociates

oFluent,Inc.

oILOGCPLEXDivision

oLivermoreSoftwareTechnologyCorporation(LSTC)

oMECALOGSARL

oOxfordMolecularGroupPLC

oTheNumericalAlgorithmsGroupLtd.(NAG)

 

Endorsingsoftwarevendors:

oAbsoftCorporation

oEdinburghPortableCompilers

oGENIASSoftwareGmBH

oMyriasComputerTechnologies,Inc.

oThePortlandGroup,Inc.(PGI)

∙FormorenewsandmembershipinformationabouttheOpenMPARB,visit:

openmp.org/wp/about-openmp.

ReleaseHistory

GoalsofOpenMP

Standardization:

∙Provideastandardamongavarietyofsharedmemoryarchitectures/platforms

LeanandMean:

∙Establishasimpleandlimitedsetofdirectivesforprogrammingsharedmemorymachines.Significantparallelismcanbeimplementedbyusingjust3or4directives.

EaseofUse:

∙Providecapabilitytoincrementallyparallelizeaserialprogram,unlikemessage-passinglibrarieswhichtypicallyrequireanallornothingapproach

∙Providethecapabilitytoimplementbothcoarse-grainandfine-grainparallelism

Portability:

∙SupportsFortran(77,90,and95),C,andC++

∙PublicforumforAPIandmembership

OpenMPProgrammingModel

SharedMemory,ThreadBasedParallelism:

∙OpenMPisbasedupontheexistenceofmultiplethreadsinthesharedmemoryprogrammingparadigm.Asharedmemoryprocessconsistsofmultiplethreads.

ExplicitParallelism:

∙OpenMPisanexplicit(notautomatic)programmingmodel,offeringtheprogrammerfullcontroloverparallelization.

Fork-JoinModel:

∙OpenMPusesthefork-joinmodelofparallelexecution:

∙AllOpenMPprogramsbeginasasingleprocess:

themasterthread.Themasterthreadexecutessequentiallyuntilthefirstparallelregionconstructisencountered.

∙FORK:

themasterthreadthencreatesateamofparallelthreads

∙Thestatementsintheprogramthatareenclosedbytheparallelregionconstructarethenexecutedinparallelamongthevariousteamthreads

∙JOIN:

Whentheteamthreadscompletethestatementsintheparallelregionconstruct,theysynchronizeandterminate,leavingonlythemasterthread

CompilerDirectiveBased:

∙MostOpenMPparallelismisspecifiedthroughtheuseofcompilerdirectiveswhichareimbeddedinC/C++orFortransourcecode.

NestedParallelismSupport:

∙TheAPIprovidesfortheplacementofparallelregionsinsideotherparallelregions.

∙Implementationsmayormaynotsupportthisfeature.

DynamicThreads:

∙TheAPIprovidesfortheruntimeenvironmenttodynamicallyalterthenumberofthreadsusedtoexecuteparallelregions.Intendedtopromotemoreefficientuseofresources,ifpossible.

I/O:

∙OpenMPspecifiesnothingaboutparallelI/O.Thisisparticularlyimportantifmultiplethreadsattempttowrite/readfromthesamefile.

∙IfeverythreadconductsI/Otoadifferentfile,theissuesarenotassignificant.

∙ItisentirelyuptotheprogrammertoinsurethatI/Oisconductedcorrectlywithinthecontextofamulti-threadedprogram.

MemoryModel:

FLUSHOften?

∙OpenMPprovidesa"

relaxed-consistency"

and"

temporary"

viewofthreadmemory(intheirwords).Inotherwords,threadscan"

cache"

theirdataandarenotrequiredtomaintainexactconsistencywithrealmemoryallofthetime.

∙Whenitiscriticalthatallthreadsviewasharedvariableidentically,theprogrammerisresponsibleforinsuringthatthevariableisFLUSHedbyallthreadsasneeded.

∙Moreonthislater...

ExampleOpenMPCodeStructure

Fortran-GeneralCodeStructure

PROGRAMHELLO

INTEGERVAR1,VAR2,VAR3

Serialcode

.

Beginningofparallelsection.Forkateamofthreads.

Speci

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 职业教育 > 其它

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1