# LaTeX2HTML 0.6.4 (Tues Aug 30 1994) # Associate image original text (scrambled) with physical files. $key = q/{users}funcMPI_CANCELcanbeanexpensiveoperationthatshouldbeusedonlyexceptionally.{users}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+mpiargD[count-1]),ldots,(type_n-1,disp_n-1+mpiargD[count-1]),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-packvsderived1Thefollowingtwoprogramsgenerateidenticalmessages.Deriveddatatypeisused:fileinclude..codesadvpt2pt-packvsderived1.cPackingisused:fileinclude..codesadvpt2pt-packvsderived2.c{example}/; $cached_env_img{$key} =''; $key = q/{displaymath}{(type_0,disp_0),ldots,(type_n-1,disp_n-1)},{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresadvpt2pt-section.ps,width=2.0inlabelfig:advpt2pt-section{figure}/; $cached_env_img{$key} =''; $key = q/{}$mpiargcoords=(4,6)${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescoll-matchings.ps,width=4.00insmalllabelfig-coll-exN{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SCATTERV(sbuf,scounts,displs,stype,recvbuf,recvcount,recvtype,root,comm)funcargINsbufaddressofsbufferfuncargINscountsintegerarrayfuncargINdisplsintegerarrayofdisplacementsfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountnumberofelementsinreceivebufferfuncargINrecvtypedatatypeofreceivebufferelementsfuncargINrootrankofsingprocessfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemEnablinganddisablingprofilingdepingonthestateofthecalculation.itemFlushingtracebuffersatnon-criticalpointsinthecalculationitemAddingusereventstoatracefile.{bulletlist}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0^0,disp_0^0+mpiargD[0]+(mpiargB[0]-1)cdotex_0),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{displaymath}typemap_i={(type_0^i,disp_0^i),ldots,(type_n_i-1^i,disp_n_i-1^i)},{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-lib1bad.eps,width=3.5inlabelfig:context-lib1bad{figure}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-intracomm.eps,width=3.5inlabelfig:context-intracom{figure}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeltopol-exAtabular|l|l|l|hlinettdims;html_special_mark_amp;functioncall;html_special_mark_amp;ttdimsbeforecall;html_special_mark_amp;;html_special_mark_amp;onreturnhline(0,0);html_special_mark_amp;mpifuncMPI_DIMS_CREATE(6,2,dims);html_special_mark_amp;(3,2)(0,0);html_special_mark_amp;mpifuncMPI_DIMS_CREATE(7,2,dims);html_special_mark_amp;(7,1)(0,3,0);html_special_mark_amp;mpifuncMPI_DIMS_CREATE(6,3,dims);html_special_mark_amp;(2,3,1)(0,3,0);html_special_mark_amp;mpifuncMPI_DIMS_CREATE(7,3,dims);html_special_mark_amp;erroneouscallhlinetabularvspace*4.0ex{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-outorder-nonblockOutofordercommunicationwithnonblockingmessages.fileinclude..codespt2pt-outorder-nonblock.fnoindentInthisprogramprocesszerosstwomessagestoprocessone,whileprocessonereceivesthesetwomessagesinthereverseorder.Ifblockingsandreceiveoperationswereused,theprogramwouldbeunsafe:thefirstmessagehastobecopiedandbufferedbeforethesecondscanproceed;thefirstreceivecancompleteonlyafterthesecondsexecutes.However,sinceweusednonblockingreceiveoperations,theprogramissafe.TheMPIimplementationwillstoreasmall,fixedamountofinformationaboutthefirstreceivecallbeforeitproceedstothesecondreceivecall.Oncethesecondpost-receivecalloccurredatprocessoneandthefirst(blocking)soccurredatprocesszerothenthetransferofbufferttsbuf1isenabledandisguaranteedtocomplete.Atthatpoint,thesecondsatprocesszeroisstarted,andisalsoguaranteedtocomplete.{example}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]vboxto2trueinvfilspecialpsfile=..figuresconclusion-lib1.pslabelfig:conc-lib1{figure}/; $cached_env_img{$key} =''; $key = q/{}$circ${}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+sfstride+(sfbl-1)cdotex),ldots.,{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SCATTER(sbuf,scount,stype,recvbuf,recvcount,recvtype,root,comm)funcargINsbufaddressofsbufferfuncargINscountnumberofelementssenttoeachprocessfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountnumberofelementsinreceivebufferfuncargINrecvtypedatatypeofreceivebufferelementsfuncargINrootrankofsingprocessfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_SIZE(comm,size)funcargINcommcommunicatorfuncargOUTsizenumberofprocessesinthegroupofmpiargcomm{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+(mpiargD[count-1]+mpiargB[count-1]-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+mpiargD[count-1]cdotex),ldots,(type_n-1,disp_n-1+mpiargD[count-1]cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{}$sfcirc${}/; $cached_env_img{$key} =''; $key = q/{implementors}WeoutlinebelowanaiveandinefficientimplementationofmpifuncMPI_REDUCE.verbatim9Thereductioncomputationproceeds,sequentially,fromprocesstt0toprocesslinebreakttgroupsize-1.Thisorderischosensoastorespecttheorderofapossiblynon-commutativeoperatordefinedbythefunctionttUser_reduce().Amoreefficientimplementationisachievedbytakingadvantageofassociativityandusingalogarithmictreereduction.Commutativitycanbeusedtoadvantage,forthosecasesinwhichthempiargcommuteargumenttofuncMPI_OP_CREATEistrue.Also,theamountoftemporarybufferrequiredcanbereduced,andcommunicationcanbepipelinedwithcomputation,bytransferringandreducingtheelementsinchunksofsizettlen$;html_special_mark_lt;$ttcount.Thepredefinedreduceoperationscanbeimplementedasalibraryofuser-definedoperations.However,betterperformancemightbeachievedifmpifuncMPI_REDUCEhandlesthesefunctionsasaspecialcase.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ALLREDUCE(sbuf,recvbuf,count,datatype,op,comm)funcargINsbufstartingaddressofsbufferfuncargOUTrecvbufstartingaddressofreceivebufferfuncargINcountnumberofelementsinsbufferfuncargINdatatypedatatypeofelementsofsbufferfuncargINopoperationfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{constlist}constitemNameMeaningconstitemconstitemMPI_MAXmaximumconstitemMPI_MINminimumconstitemMPI_SUMsumconstitemMPI_PRODproductconstitemMPI_LANDlogicalandconstitemMPI_BANDbit-wiseandconstitemMPI_LORlogicalorconstitemMPI_BORbit-wiseorconstitemMPI_LXORlogicalxorconstitemMPI_BXORbit-wisexorconstitemMPI_MAXLOCmaxvalueandlocationconstitemMPI_MINLOCminvalueandlocation{constlist}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SSEND(buf,count,datatype,dest,tag,comm)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriesinsbufferfuncargINdatatypedatatypeofeachsbufferentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{}LaTeX{}/; $cached_env_img{$key} =''; $key = q/{implementors}Acommunicationoperationcannotbecancelledoncethereceivebufferhasbeenpartlyoverwritten.Inthissituation,thecommunicationshouldbeallowedtocomplete.Ingeneral,acommunicationmaybeallowedtocomplete,ifsandreceivehavealreadybeenmatched.Theimplementationshouldtakecareofthepossibleracebetweencancelationandmatching.Thecancelationofasoperationwillinternallyrequirecommunicationwiththeintedreceiver,ifinformationonthesoperationhasalreadybeenforwardedtothedestination.Notethat,whilecommunicationmaybeneededtoimplementmpifuncMPI_CANCEL,thisisstillalocaloperation,sinceitscompletiondoesnotdepontheapplicationcodeexecutedbyotherprocesses.{implementors}/; $cached_env_img{$key} =''; $key = q/{}$sfrecvbuf(1)=rmglobalmax(sfsbuf(1))${}/; $cached_env_img{$key} =''; $key = q/{rationale}Theuseofaformalparametermpiargattribute_valoftypeconstvoid*(ratherthanconstvoid**)inmpifuncMPI_Attr_getavoidsthemessytypecastingthatwouldbeneedediftheattributeisdeclaredwithatypeotherthanconstvoid*.{rationale}/; $cached_env_img{$key} =''; $key = q/{displaymath}mpiargD[j]=jcdotmpiargstride,j=0,ldots,sfcount-1,{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figurestopol-fig4.eps,width=2.5inlabelfig:topol-fig4{figure}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+mpiargD[count-1]+(mpiargB[count-1]-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{}$cup${}/; $cached_env_img{$key} =''; $key = q/{users}Aliasingofcommunicators(e.g.,mpiargcomma=commb)ispossible,butisnotgenerallyadvised.AftercallingmpifuncMPI_COMM_FREEanyaliasedcommunicatorhandlewillbeleftinanundefinedstate.{users}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GRAPH_NEIGHBORS(comm,rank,maxneighbors,neighbors)funcargINcommcommunicatorwithgraphtopologyfuncargINrankrankofprocessingroupofmpiargcommfuncargINmaxneighborssizeofarraympiargneighborsfuncargOUTneighborsarrayofranksofprocessesthatareneighborstospecifiedprocess{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}mpiargB[j]=mpiargblocklength,j=0,ldots,sfcount-1.{displaymath}/; $cached_env_img{$key} =''; $key = q/{}$displaystyleprod_i,dims[i]neq0dims[i]${}/; $cached_env_img{$key} =''; $key = q/{example}rmLetmpiarggroupbeahandletothegroupsf{a,b,c,d,e,f}andletmpiargranks=(3,1,2).Then,ahandletothegroupsf{d,b,c}isreturnedinmpiargnewgroup.{example}/; $cached_env_img{$key} =''; $key = q/{implementors}Structuresoftencontainpaddingspaceusedtoalignentriescorrectly.Assumethatdataismovedfromasbufferthatdescribesastructureintoareceivebufferthatdescribesanidenticalstructureonanotherprocess.Insuchacase,itisprobablyadvantageoustocopythestructure,togetherwiththepadding,asonecontiguousblock.Theusercan``force''thisoptimizationbyexplicitlyincludingpaddingaspartofthemessage.Theimplementationisfreetodothisoptimizationwhenitdoesnotimpacttheoutcomeofthecomputation.However,itmaybehardtodetectwhenthisoptimizationapplies,sincedatasentfromastructuremaybereceivedintoasetofdisjointvariables.Also,paddingwilldifferwhendataiscommunicatedinaheterogeneousenvironment,orevenonthesamearchitecture,whendifferentcompilingoptionsareused.TheMPI-2forumisconsideringoptionstoalleviatethisproblemandsupportmoreefficienttransferofstructures.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GRAPH_GET(comm,maxindex,maxedges,index,edges)funcargINcommcommunicatorwithgraphstructurefuncargINmaxindexlengthofvectormpiargindexinthecallingprogramfuncargINmaxedgeslengthofvectormpiargedgesinthecallingprogramfuncargOUTindexarrayofintegerscontainingthegraphstructurefuncargOUTedgesarrayofintegerscontainingthegraphstructure{funcdef}/; $cached_env_img{$key} =''; $key = q/{tabular}|l|p3.0in|hlinemulticolumn2|c|funcMPI_COMM_*FunctionBehaviormulticolumn2|c|(inInter-CommunicationMode)hlinehlinefuncMPI_COMM_SIZE;html_special_mark_amp;returnsthesizeofthelocalgroup.funcMPI_COMM_GROUP;html_special_mark_amp;returnsthelocalgroup.funcMPI_COMM_RANK;html_special_mark_amp;returnstherankinthelocalgrouphline{tabular}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SCAN(sbuf,recvbuf,count,datatype,op,comm)funcargINsbufstartingaddressofsbufferfuncargOUTrecvbufstartingaddressofreceivebufferfuncargINcountnumberofelementsininputbufferfuncargINdatatypedatatypeofelementsofinputbufferfuncargINopoperationfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GRAPH_NEIGHBORS_COUNT(comm,rank,nneighbors)funcargINcommcommunicatorwithgraphtopologyfuncargINrankrankofprocessingroupofmpiargcommfuncargOUTnneighborsnumberofneighborsofspecifiedprocess{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GRAPH_CREATE(comm_old,nnodes,index,edges,reorder,comm_graph)funcargINcomm_oldinputcommunicatorfuncargINnnodesnumberofnodesingraphfuncargINindexarrayofintegersdescribingnodedegrees(seebelow)funcargINedgesarrayofintegersdescribinggraphedges(seebelow)funcargINreorderrankingmaybereordered(consttrue)ornot(constfalse)funcargOUTcomm_graphcommunicatorwithgraphtopologyadded{funcdef}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescoll-blas22.ps,width=3.50insmalllabelfig:coll-blas22{figure}/; $cached_env_img{$key} =''; $key = q/{}$i${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_WAITALL(count,array_of_requests,array_of_statuses)funcargINcountlistlengthfuncargINOUTarray_of_requestsarrayofrequesthandlesfuncargOUTarray_of_statusesarrayofstatusobjects{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ATTR_GET(comm,keyval,attribute_val,flag)funcargINcommcommunicatortowhichattributeisattachedfuncargINkeyvalkeyvaluefuncargOUTattribute_valattributevalue,unlessmpiargflag=falsefuncargOUTflagtttrueifanattributevaluewasextracted;ttfalseifnoattributeisassociatedwiththekey{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ERRHANDLER_GET(comm,errhandler)funcargINcommcommunicatortogettheerrorhandlerfromfuncargOUTerrhandlerMPIerrorhandlercurrentlyassociatedwithcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdefna}MPI_INIT(){funcdefna}/; $cached_env_img{$key} =''; $key = q/{}$sfcountcdotsfblcdotn${}/; $cached_env_img{$key} =''; $key = q/{example}rmLetmpiarggroupbeahandletothegroupsf{a,b,c,d,e,f}andletmpiargranks=(3,1,2).Then,ahandletothegroupsf{a,e,f}isreturnedinmpiargnewgroup.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CART_SUB(comm,remain_dims,newcomm)funcargINcommcommunicatorwithCartesianstructurefuncargINremain_dimsthettithentryofmpiargremain_dimsspecifieswhetherthettithdimensioniskeptinthesubgrid(tttrue)orisdrop-ped(ttfalse)funcargOUTnewcommcommunicatorcontainingthesubgridthatincludesthecallingprocess{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_DIFFERENCE(group1,group2,newgroup)funcargINgroup1firstgroupfuncargINgroup2secondgroupfuncargOUTnewgroupdifferencegroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}Thedatatypematchingrulesdonotrequiremessagestocarrydatatypeinformation.Bothserandreceiverprovidecompletedatatypeinformation.Inaheterogeneousenvironment,onecaneitheruseamachineindepentencodingsuchasXDR,orhavethereceiverconvertfromtheserrepresentationtoitsown,orevenhavetheserdotheconversion.Additionaltypeinformationmightbeaddedtomessagesinordertoallowthesystemtodetectmismatchesbetweendatatypeatserandreceiver.ThismightbeparticularlyusefulinaslowerbutsaferdebugmodeforMPI.AlthoughMPIdoesnotspecifyinterfacesbetweenCandFortran,vorsareexpectedtoprovidesuchinterfaces,soastoallowFortranprogramstoinvokeparallellibrarieswritteninC,orcommunicatewithserversrunningCcodes(andvice-versa).InitializationforFortranandCshouldbecompatible,mechanismsshouldbeprovidedforpassingMPIobjectsasparametersininterlanguageproceduralinvocations,andinter-languagecommunicationshouldbesupported.Forexample,considerasystemwhereaFortrancallercanpassanftypeINTEGERactualparametertoaCroutinewithanctypeintformalparameter.InsuchasystemaFortranroutineshouldbeabletosamessagewithdatatypeconstMPI_INTEGERtobereceivedbyaCroutinewithdatatypeconstMPI_INT.coindexMPI_INTEGERcoindexMPI_INT{implementors}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemPoint-to-pointcommunicationitemCollectiveoperationsitemProcessgroupsitemCommunicationdomainsitemProcesstopologiesitemEnvironmentalManagementandinquiryitemProfilinginterfaceitemBindingsforFortran77andC{bulletlist}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-structAThisisavariantonthepreviousexample,wheretheclasszeroparticleshavetobereceivedbyprocessoneinarraysfparticleatthesamelocationswheretheyareinthearrayofprocesszero.Processzeropackstheentryindexwitheachentryitss.Processoneusesthisinformationtomoveincomingdatatotherightlocations.Asafurtheroptimization,weavoidthetransferofthettclassfield,whichisknowntobezero.(Wehaveignoredinthisexamplethecomputationofatightboundonthesizeofthepackunpackbuffer.Onecouldberigorousanddefineanadditionalderiveddatatypeforthepurposeofcomputingsuchanestimate.Oronecanuseanapproximateestimate.)fileinclude..codesadvpt2pt-structA.c{example}/; $cached_env_img{$key} =''; $key = q/{}$sfi=0,ldots,count-1${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_SIZE(group,size)funcargINgroupgroupfuncargOUTsizenumberofprocessesingroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CART_COORDS(comm,rank,maxdims,coords)funcargINcommcommunicatorwithCartesianstructurefuncargINrankrankofaprocesswithingroupofmpiargcommfuncargINmaxdimslengthofvectorttcoordinthecallingprogramfuncargOUTcoordsintegerarraycontainingtheCartesiancoordinatesofspecifiedprocess{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TESTSOME(incount,array_of_requests,outcount,array_of_indices,array-_of-_statuses)funcargINincountlengthofarray_of_requestsfuncargINOUTarray_of_requestsarrayofrequesthandlesfuncargOUToutcountnumberofcompletedrequestsfuncargOUTarray_of_indicesarrayofindicesofcompletedoperationsfuncargOUTarray_of_statusesarrayofstatusobjectsforcompletedoperations{funcdef}/; $cached_env_img{$key} =''; $key = q/{users}ThedeletecallbackfunctionmaybeinvokedbyMPIasynchronously,afterthecalltompiargMPI_COMM_FREEreturned,whenMPIactuallydeletesthecommunicatorobject.{users}/; $cached_env_img{$key} =''; $key = q/{funcdef2}MPI_INTERCOMM_CREATE(local_comm,local_leader,bridge_comm,remote_leader,tag,newintercomm)funcargINlocal_commlocalintracommunicatorfuncargINlocal_leaderrankoflocalgroupleaderinmpiarglocal_commfuncargINbridge_comm``bridge''communicator;significantonlyattwolocalleadersfuncargINremote_leaderrankofremotegroupleaderinmpiargbridge_comm;significantonlyattwolocalleadersfuncargINtag``safe''tagfuncargOUTnewintercommnewintercommunicator(handle){funcdef2}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_BUFFER_DETACH(buffer,size)funcargOUTbufferinitialbufferaddressfuncargOUTsizebuffersize,inbytes{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:context-groupinclLetmpiarggroupbeahandletothegroupsf{a,b,c,d,e,f,g,h,i,j}andletmpiargranges=((6,7,1),(1,6,2),(0,9,4)).Thefirsttripletsf(6,7,1)}specifiestheprocessessf{g,h},withrankssf(6,7);thesecondtripletsf(1,6,2)specifiestheprocessessf{b,d,f},withrankssf(1,3,5);andthethirdtripletsf(0,9,4)specifiestheprocessessf{a,e,i},withrankssf(0,4,8).Thecallcreatesthenewgroupsf{g,h,b,d,f,a,e,i}.{example}/; $cached_env_img{$key} =''; $key = q/{}$(u,r)${}/; $cached_env_img{$key} =''; $key = q/{users}CurrentMPIimplementationsimposenorestrictionsontheuseofaddresses.IfFortranftypeINTEGER'shave32bits,thenthetheuseofabsoluteaddressesinFortranprogramsmayberestrictedto4GBmemory.Thismayrequire,inthefuture,tomovefromftypeINTEGERaddressestoftypeINTEGER*8addresses.{users}/; $cached_env_img{$key} =''; $key = q/{users}TheuseoffuncMPI_TESTallowsonetoschedulealternativeactivitieswithinasinglethreadofexecution.{users}/; $cached_env_img{$key} =''; $key = q/{rationale}Therequirementthattheentiregroupofmpiargcommparticipateinthecallstemsfromthefollowingconsiderations:bulletlistitemItallowstheimplementationtolayermpifuncMPI_COMM_CREATEontopofregularcollectivecommunications.itemItprovidesadditionalsafety,inparticularinthecasewherepartiallyoverlappinggroupsareusedtocreatenewcommunicators.itemItpermitsimplementationssometimestoavoidcommunicationrelatedtothecreationofcommunicators.bulletlist{rationale}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeladvcoll-exHProcessissttnumintsfromtheithcolumnofa100$times$150intarray,inC.Thecomplicatingfactoristhatthevariousvaluesofttnumarenotknowntottroot,soaseparategathermustfirstberuntofindtheseout.Thedataisplacedcontiguouslyatthereceiving.fileinclude..codesadvcoll-6.c{example}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinepsfigfigure=..figurespt2pt-Jacobi1.ps,width=3inlabelfig:pt2pt-Jacobi1{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_FREE(group)funcargINOUTgroupgroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$(i,j)${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_UB(datatype,displacement)funcargINdatatypedatatypefuncargOUTdisplacementdisplacementofupperbound{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$mpiargnnodes=4${}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:context-mcastCodeformodifiedbroadcastfunctionmpifuncmcast().Thealgorithmusesabroadcasttreethatisbuiltdynamically.Therootdividesthesequenceofprocessesthatfollowstherootintotwosegments.Itssamessagetothefirstprocessinthesecondsegment,whichbecomestherootforthissegment.Theprocessisrepeated,recursively,withineachsubsegment.Inthisexample,weuseblockingcommunication.Also,weselectthetwosegmentstobeofequalsize;performancecanbeimprovedbyusingabiasedtree,andbyusingnonblockingcommunication.fileinclude..codescontext-mcast.c{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_FREE(comm)funcargINOUTcommcommunicatortobedestroyed{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ALLGATHER(sbuf,scount,stype,recvbuf,recvcount,recvtype,comm)funcargINsbufstartingaddressofsbufferfuncargINscountnumberofelementsinsbufferfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountnumberofelementsreceivedfromanyprocessfuncargINrecvtypedatatypeofreceivebufferelementsfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{constlist}constitemC:constitemNameDescriptionconstitemconstMPI_FLOAT_INTtypefloatandtypeintconstitemconstMPI_DOUBLE_INTtypedoubleandtypeintconstitemconstMPI_LONG_INTtypelongandtypeintconstitemconstMPI_2INTpairoftypeintconstitemconstMPI_SHORT_INTtypeshortandtypeintconstitemconstMPI_LONG_DOUBLE_INTtypelongdoubleandtypeint{constlist}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig7.ps,width=3.50insmalllabelfig-coll-exI{figure}/; $cached_env_img{$key} =''; $key = q/{users}ThesamefunctionalityasmpifuncMPI_CART_SUBcanbeachievedwithmpifuncMPI_COMM_SPLIT.However,sincempifuncMPI_CART_SUBhasadditionalinformation,itcangreatlyreducethecommunicationandworkneededbylogicallyworkingonthetopology.Assuch,mpifuncMPI_CART_SUBcanbeeasilyimplementedinascalablefashion.{users}/; $cached_env_img{$key} =''; $key = q/{}(Typesig={type_0,ldots,type_n-1}){}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresadvpt2pt-indexed.ps,width=4.0inlabelfig:advpt2pt-indexed{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ERROR_CLASS(errorcode,errorclass)funcargINerrorcodeErrorcodereturnedbyanMPIroutinefuncargOUTerrorclassErrorclassassociatedwithconsterrorcode{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+mpiargD[0]+(mpiargB[0]-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig6.ps,width=4.00insmalllabelfig-advcoll-exG{figure}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exZBroadcast100intsfromprocesstt0toeveryprocessinthegroup.fileinclude..codescoll-1.c{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ERRHANDLER_SET(comm,errhandler)funcargINcommcommunicatortosettheerrorhandlerforfuncargINerrhandlernewMPIerrorhandlerforcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]psfigfigure=..figurespt2pt-Order1.ps,height=6cmlabelfig:pt2pt-Order1{figure}/; $cached_env_img{$key} =''; $key = q/{implementors}funcMPI_WAITSOMEandfuncMPI_TESTSOMEshouldcompleteasmanypingcommunicationsaspossible.Itisexpectedthatbothwillcompleteallreceiveoperationsforwhichinformationonmatchingsshasreachedthereceivernode.Thiswillensurethattheysatisfytheirfairnessrequirement.{implementors}/; $cached_env_img{$key} =''; $key = q/{}$ge10${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ALLTOALLV(sbuf,scounts,sdispls,stype,recvbuf,recvcounts,rdispls,recvtype,comm)funcargINsbufstartingaddressofsbufferfuncargINscountsintegerarrayfuncargINsdisplsintegerarrayofsdisplacementsfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountsintegerarrayfuncargINrdisplsintegerarrayofreceivedisplacementsfuncargINrecvtypedatatypeofreceivebufferelementsfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SENDRECV_REPLACE(buf,count,datatype,dest,stag,source,recvtag,comm,status)funcargINOUTbufinitialaddressofsandreceivebufferfuncargINcountnumberofentriesinsandreceivebufferfuncargINdatatypetypeofentriesinsandreceivebufferfuncargINdestrankofdestinationfuncargINstagsmessagetagfuncargINsourcerankofsourcefuncargINrecvtagreceivemessagetagfuncargINcommcommunicatorfuncargOUTstatusstatusobject{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(first_1,last_1,stride_1),ldots,(first_n,last_n,stride_n){displaymath}/; $cached_env_img{$key} =''; $key = q/{}$geq${}/; $cached_env_img{$key} =''; $key = q/{users}ThebehaviorofmpifuncMPI_ABORT(comm,errorcode),formpiargcommotherthenconstMPI_COMM_WORLD,isimplementation-depent.Onetheotherhand,acalltompifuncMPI_ABORT(MPI_COMM_WORLD,errorcode)shouldalwayscauseallprocessesinthegroupofconstMPI_COMM_WORLDtoabort.{users}/; $cached_env_img{$key} =''; $key = q/{tabular}llconstMPI_SUCCESS;html_special_mark_amp;NoerrorconstMPI_ERR_BUFFER;html_special_mark_amp;InvalidbufferpointerconstMPI_ERR_COUNT;html_special_mark_amp;InvalidcountargumentconstMPI_ERR_TYPE;html_special_mark_amp;InvaliddatatypeargumentconstMPI_ERR_TAG;html_special_mark_amp;InvalidtagargumentconstMPI_ERR_COMM;html_special_mark_amp;InvalidcommunicatorconstMPI_ERR_RANK;html_special_mark_amp;InvalidrankconstMPI_ERR_REQUEST;html_special_mark_amp;InvalidrequestconstMPI_ERR_ROOT;html_special_mark_amp;InvalidrootconstMPI_ERR_GROUP;html_special_mark_amp;InvalidgroupconstMPI_ERR_OP;html_special_mark_amp;InvalidoperationconstMPI_ERR_TOPOLOGY;html_special_mark_amp;InvalidtopologyconstMPI_ERR_DIMS;html_special_mark_amp;InvaliddimensionargumentconstMPI_ERR_ARG;html_special_mark_amp;InvalidargumentofsomeotherkindconstMPI_ERR_UNKNOWN;html_special_mark_amp;UnknownerrorconstMPI_ERR_TRUNCATE;html_special_mark_amp;MessagetruncatedonreceiveconstMPI_ERR_OTHER;html_special_mark_amp;KnownerrornotinthislistconstMPI_ERR_INTERN;html_special_mark_amp;InternalMPIerrorconstMPI_ERR_IN_STATUS;html_special_mark_amp;ErrorcodeisinstatusconstMPI_ERR_PENDING;html_special_mark_amp;PingrequestconstMPI_ERR_LASTCODE;html_special_mark_amp;Lasterrorcode{tabular}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_FREE(datatype)funcargINOUTdatatypedatatypetobefreed{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ERRHANDLER_CREATE(function,errhandler)funcargINfunctionuserdefinederrorhandlingprocedurefuncargOUTerrhandlerMPIerrorhandler{funcdef}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemassumingaparticularimplementationlanguage.itemimposingaruntimecostevenwhennoprofilingwastakingplace.{bulletlist}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-intercomm.eps,width=3.5inlabelfig:context-intercomm{figure}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n_0^0,disp_n_0^0+mpiargD[0]+(mpiargB[0]-1)cdotex_0),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{implementors}Onsystemswithaflataddressspace,theimplementationmaypickanarbitraryaddressasthevalueofconstMPI_BOTTOMinC(ortheaddressofthevariableconstMPI_BOTTOMincoindexMPI_BOTTOMFortran).AllthatisneededisthatcallstompifuncMPI_ADDRESS(location,address)returnthedisplacementofmpiarglocation,relativetoconstMPI_BOTTOM.{implementors}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exminlocFSameexample,inFortran.fileinclude..codescoll-10.f{example}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0^sfc-1,disp_0^sfc-1+mpiargD[c-1]+(mpiargB[c-1]-1)cdotex_sfc-1),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{displaymath}Typemap={(type_0,disp_0),ldots,(type_n-1,disp_n-1)},{displaymath}/; $cached_env_img{$key} =''; $key = q/{}$cdots${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescoll-blas2.ps,width=3.50insmalllabelfig:coll-blas2{figure}/; $cached_env_img{$key} =''; $key = q/{rationale}Thecorrespondencebetweeninter-andintracommunicatorscanbebestunderstoodbythinkingofanintra-groupcommunicationdomainasaspecialcaseofaninter-groupcommunicationdomain,wherebothcommunicationgroupshappentobeidentical.Thisinterpretationcanbeusedtoderiveaconsistentsemanticsforcommunicatorinquiryfunctionsandforpoint-to-pointcommunication,oranidenticalimplementationforbothtypesofobjects.Thiscorrespondenceindicateshowcollectivecommunicationfunctionscouldbeextedtointer-groupcommunication:Ratherthanasymmetricdesign,whereprocessesinthegroupbothsandreceive,onewouldhaveanasymmetricdesign,whereonegroupss(eitherfromasinglerootorfromallprocesses)andtheothergroupreceives(eithertoasinglerootortoallprocesses).Additionalsyntaxisneededtodistinguishsergroupfromreceivergroup.SuchextensionsarediscussedforMPI-2.Note,however,thatthetwogroupsofanintercommunicatorarecurrentlyrequiredtobedisjoint,forreasonsexplainedlaterinthissection.cindexintercommunication,andcollective{rationale}/; $cached_env_img{$key} =''; $key = q/{rationale}Thoughphysicalmappingisnotdiscussed,theexistenceofthevirtualtopologyinformationmaybeusedasadvicebytheruntimesystem.Therearewell-knowntechniquesformappinggridtorusstructurestohardwareto-po-logiessuchashypercubesorgrids.Formorecomplicatedgraphstructuresgoodheuristicsoftenyieldnearlyoptimalresultscitesuprenum.Ontheotherhand,ifthereisnowayfortheusertospecifythelogicalprocessarrangementasa``virtualtopology,''arandommappingismostlikelytoresult.Onsomemachines,thiswillleadtounnecessarycontentionintheinterconnectionnetwork.Somedetailsaboutpredictedandmeasuredperformanceimprovementsthatresultfromgoodprocess-to-processormappingonmodernwormhole-routingarchitecturescanbefoundincitewormhole1,wormhole2.Besidespossibleperformancebenefits,thevirtualtopologycanfunctionasaconvenient,process-namingstructure,withtremousbenefitsforprogramreadabilityandnotationalpowerinmessage-passingprogramming.{rationale}/; $cached_env_img{$key} =''; $key = q/{implementors}Additional,intermediatebufferingisneededforthereplacevariant.Onlyafixedamountofbufferspaceshouldbeused,otherwises-receivewillnotbemorerobustthentheequivalentpairofblockingsandreceivecalls.{implementors}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-struct3Anoptimizationforthelastexample:ratherthanhandlingeachclasszeroparticleasaseparateblock,itismoreefficienttocomputelargestconsecutiveblocksofclasszeroparticlesandusetheseblocksinthecalltompifuncMPI_Type_indexed.Themodifiedloopthatcomputesmpiargzblockandmpiargzdispisshownbelow.fileinclude..codesadvpt2pt-struct3.c{example}/; $cached_env_img{$key} =''; $key = q/{}(ub(Typemap)=left{arrayllmax_jdisp_j+sizeof(type_j)+epsilon;html_special_mark_amp;mboxifnoentryhasbasictypesfubmax_j{disp_jmboxsuchthattype_j=sfub};html_special_mark_amp;mboxotherwisearrayright.){}/; $cached_env_img{$key} =''; $key = q/{rationale}Weprohibitreadaccessestoasbufferwhileitisbeingused,eventhoughthesoperationisnotsupposedtoalterthecontentofthisbuffer.Thismayseemmorestringentthannecessary,buttheadditionalrestrictioncauseslittlelossoffunctionalityandallowsbetterperformanceonsomesystems---considerthecasewheredatatransferisdonebyaDMAenginethatisnotcache-coherentwiththemainprocessor.{rationale}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_LB(datatype,displacement)funcargINdatatypedatatypefuncargOUTdisplacementdisplacementoflowerbound{funcdef}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresadvpt2pt-contig.ps,width=2.5inlabelfig:advpt2pt-contig{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ADDRESS(location,address)funcargINlocationvariablerepresentingamemorylocationfuncargOUTaddressaddressoflocation{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$mpiargneighbors=0,2${}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]vboxto2trueinvfilspecialpsfile=..figuresconclusion-lib2.pslabelfig:conc-lib2{figure}/; $cached_env_img{$key} =''; $key = q/{}(extent(Typemap)=ub(Typemap)-lb(Typemap)){}/; $cached_env_img{$key} =''; $key = q/{}$Typesig${}/; $cached_env_img{$key} =''; $key = q/{displaymath}first_1,first_1+stride_1,ldots,first_1+leftlfloorfraclast_1-first_1stride_1rightrfloorcdotstride_1,ldots{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_HINDEXED(count,array_of_blocklengths,array_of_displacements,oldtype,newtype)funcargINcountnumberofblocksfuncargINarray_of_blocklengthsnumberofelementsperblockfuncargINarray_of_displacementsbytedisplacementforeachblockfuncargINoldtypeolddatatypefuncargOUTnewtypenewdatatype{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$~=~0${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_BUFFER_ATTACH(buffer,size)funcargINbufferinitialbufferaddressfuncargINsizebuffersize,inbytes{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+mpiargD[0]+(mpiargB[0]-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:context-badlib2Beforethecollectiveinvocationtompifuncmcast(),process2ssamessagetoprocess1;process1postsamatchingreceivewithadontcaresourceaftertheinvocationtompifuncmcast.fileinclude..codescontext-badlib2.c{example}/; $cached_env_img{$key} =''; $key = q/{}(lb(Typemap)=left{arrayllmin_jdisp_j;html_special_mark_amp;mboxifnoentryhasbasictypesflbmin_j{disp_jmboxsuchthattype_j=sflb};html_special_mark_amp;mboxotherwisearrayright.){}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig8.ps,width=3.50insmalllabelfig-advcoll-exJ{figure}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+(sfbl-1)cdotex),ldots,(type_n-1,disp_n-1+(sfbl-1)cdotex),{displaymath}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-probe-OKUseablockingprobetowaitforanincomingmessage.fileinclude..codespt2pt-probe-OK.fnoindentEachmessageisreceivedwiththerighttype.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_PACK(inbuf,incount,datatype,outbuf,outsize,position,comm)funcargINinbufinputbufferfuncargINincountnumberofinputcomponentsfuncargINdatatypedatatypeofeachinputcomponentfuncargOUToutbufoutputbufferfuncargINoutsizeoutputbuffersize,inbytesfuncargINOUTpositioncurrentpositioninbuffer,inbytesfuncargINcommcommunicatorforpackedmessage{funcdef}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-lib1good.eps,width=3.5inlabelfig:context-lib1good{figure}/; $cached_env_img{$key} =''; $key = q/{}$~=~${}/; $cached_env_img{$key} =''; $key = q/{displaymath}ldots,(type_0,disp_0+excdot(sfcount-1)),ldots,(type_n-1,disp_n-1+excdot(sfcount-1))}.{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurestopol-matrix2.eps,height=6inlabelfig:topol-matrix2{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_DIMS_CREATE(nnodes,ndims,dims)funcargINnnodesnumberofnodesinagridfuncargINndimsnumberofCartesiandimensionsfuncargINOUTdimsintegerarrayofsizettndimsspecifyingthenumberofnodesineachdimension{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-order-nonblockMessageorderingfornonblockingoperations.fileinclude..codespt2pt-order-nonblock.fnoindentThefirstsofprocesszerowillmatchthefirstreceiveofprocessone,evenifbothmessagesaresentbeforeprocessoneexecuteseitherreceive.{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-UMPIcodethatssanuppertriangularmatrix.fileinclude..codesadvpt2pt-U.c{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_RANK(group,rank)funcargINgroupgroupfuncargOUTrankrankofthecallingprocessingroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmAssumethatacollectivecalltompifuncMPI_COMM_SPLITisexecutedina10elementgroup,withtheargumentslistedinthetablebelow.vskip0.1trueintabular|l|cccccccccc|hlinerank;html_special_mark_amp;0;html_special_mark_amp;1;html_special_mark_amp;2;html_special_mark_amp;3;html_special_mark_amp;4;html_special_mark_amp;5;html_special_mark_amp;6;html_special_mark_amp;7;html_special_mark_amp;8;html_special_mark_amp;9hlineprocess;html_special_mark_amp;a;html_special_mark_amp;b;html_special_mark_amp;c;html_special_mark_amp;d;html_special_mark_amp;e;html_special_mark_amp;f;html_special_mark_amp;g;html_special_mark_amp;h;html_special_mark_amp;i;html_special_mark_amp;jhlinecolor;html_special_mark_amp;0;html_special_mark_amp;$bot$;html_special_mark_amp;3;html_special_mark_amp;0;html_special_mark_amp;3;html_special_mark_amp;0;html_special_mark_amp;0;html_special_mark_amp;5;html_special_mark_amp;3;html_special_mark_amp;$bot$hlinekey;html_special_mark_amp;3;html_special_mark_amp;1;html_special_mark_amp;2;html_special_mark_amp;5;html_special_mark_amp;1;html_special_mark_amp;1;html_special_mark_amp;1;html_special_mark_amp;2;html_special_mark_amp;1;html_special_mark_amp;0hlinetabularvskip0.1trueinThecallgeneratesthreenewcommunicationdomains:thefirstwithgroupsf{f,g,a,d},thesecondwithgroupsf{e,i,c},andthethirdwithsingletongroupsf{h}.Theprocessessfbandsfjdonotparticipateinanyofthenewlycreatedcommunicationdomains,andarereturnedanullcommunicatorhandle.{example}/; $cached_env_img{$key} =''; $key = q/{implementors}ThefunctionmpifuncMPI_GRAPH_CREATE(comm,nnodes,index,edges,reorder,comm_graph),withttreorder=truecanbeimplementedbycallingmpifuncMPI_GRAPH_MAP(comm,nnodes,index,edges,newrank),thencallinglinebreakmpifuncMPI_COMM_SPLIT(comm,color,key,comm_graph),withttcolor=0ifttnewrank$neq$linebreakMPI_UNDEFINED,ttcolor=MPI_UNDEFINEDotherwise,andttkey=newrank.{implementors}/; $cached_env_img{$key} =''; $key = q/{constlist}constitemCinteger:typeMPI_INT,MPI_LONG,MPI_SHORT,linebreakMPI_UNSIGNED_SHORT,MPI_UNSIGNED,linebreakMPI_UNSIGNED_LONGconstitemFortraninteger:typeMPI_INTEGERconstitemFloatingpoint:typeMPI_FLOAT,MPI_DOUBLE,MPI_REAL,linebreakMPI_DOUBLE_PRECISION,MPI-_LONG-_DOU-BLEconstitemLogical:typeMPI_LOGICALconstitemComplex:typeMPI_COMPLEXconstitemByte:typeMPI_BYTE{constlist}/; $cached_env_img{$key} =''; $key = q/{implementors}CAttributesarescalarvalues,equalinsizeto,orlargerthanaC-languagepointer.FortranattributesareoftypeftypeINTEGER.AttributescanalwaysholdanMPIhandle.Itisverydesirabletohaveidenticalattributetypes,bothforFortranandC,inordertofacilitatemixedlanguageprogramming.E.g.,onsystemswith64bitCpointersbut32bitFortranftypeINTEGER,onecoulduse64bitattributevalues.FortrancallswillconvertfromftypeINTEGER(4)toftypeINTEGER(8),andviceversa.Cachingandcallbackfunctionsareonlycalledsynchronously,inresponsetoexplicitapplicationrequests.Thisavoidproblemsthatresultfromrepeatedcrossingsbetweenuserandsystemspace.(ThissynchronouscallingruleisageneralpropertyofMPI.){implementors}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinepsfigfigure=..figurespt2pt-Order2.ps,width=2.5inlabelfig:pt2pt-Order2{figure}/; $cached_env_img{$key} =''; $key = q/{displaymath}{(type_0,disp_0+mpiargD[0]cdotex),ldots,(type_n-1,disp_n-1+mpiargD[0]cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-maskbad.eps,width=4.5inlabelfig:context-maskbad{figure}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurestopol-fig1.eps,width=2.5inlabelfig:topol-fig1{figure}/; $cached_env_img{$key} =''; $key = q/{}$-1${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurestopol-matmult3.eps,width=3.5inlabelfig:topol-matmult3{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ISEND(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriesinsbufferfuncargINdatatypedatatypeofeachsbufferentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-Jacobi-par2MainloopofJacobiiteration--safeversionofparallelcodefileinclude..codespt2pt-Jacobi-par2.f{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_DUP(comm,newcomm)funcargINcommcommunicatorfuncargOUTnewcommcopyofmpiargcomm{funcdef}/; $cached_env_img{$key} =''; $key = q/{users}SincedatatypesinMPIareopaquehandles,itisimportanttousethefunctionmpifuncMPI_TYPE_EXTENTtodeterminethe``size''ofthedatatype.Asanexample,itmaybetempting(inC)tousesfsizeof(datatype),e.g.,sfsizeof(constMPI_DOUBLE).However,thiswillreturnthesizeoftheopaquehandle,whichismostlikelythesizeofapointer,andusuallyadifferentvaluethansfsizeof(double).{users}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ERROR_STRING(errorcode,string,resultlen)funcargINerrorcodeErrorcodereturnedbyanMPIroutinefuncargOUTstringTextthatcorrespondstotheconsterrorcodefuncargOUTresultlenLength(inprintablecharacters)oftheresultreturnedinconststring{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelpt2pt-bufferCallstoattachanddetachbuffers.fileinclude..codespt2pt-buffer.c{example}/; $cached_env_img{$key} =''; $key = q/{rationale}Thisdesignstreamlineserrorhandlingintheapplication.Theapplicationcodeneedonlytestthe(single)functionresulttodetermineifanerrorhasoccurred.Itneedstocheckindividualstatusesonlywhenanerroroccurred.{rationale}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_IRSEND(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofelementsinsbufferfuncargINdatatypedatatypeofeachsbufferelementfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdefna}MPI_WTIME(){funcdefna}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-maskgood.eps,width=4.5inlabelfig:context-maskgood{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TESTALL(count,array_of_requests,flag,array_of_statuses)funcargINcountlistlengthfuncargINOUTarray_of_requestsarrayofrequesthandlesfuncargOUTflagconsttrueifallhavecompletedfuncargOUTarray_of_statusesarrayofstatusobjects{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_REMOTE_SIZE(comm,size)funcargINcommintercommunicatorfuncargOUTsizenumberofprocessesintheremotegroupofmpiargcomm{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ALLGATHERV(sbuf,scount,stype,recvbuf,recvcounts,displs,recvtype,comm)funcargINsbufstartingaddressofsbufferfuncargINscountnumberofelementsinsbufferfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountsintegerarrayfuncargINdisplsintegerarrayofdisplacementsfuncargINrecvtypedatatypeofreceivebufferelementsfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$times${}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresadvpt2pt-hindexed.ps,width=4.0inlabelfig:advpt2pt-hindexed{figure}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+ex),ldots,(type_n-1,disp_n-1+ex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_RECV(buf,count,datatype,source,tag,comm,status)funcargOUTbufinitialaddressofreceivebufferfuncargINcountmaxnumberofentriestoreceivefuncargINdatatypedatatypeofeachentryfuncargINsourcerankofsourcefuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTstatusreturnstatus{funcdef}/; $cached_env_img{$key} =''; $key = q/{}(k=left{arraylli;html_special_mark_amp;mboxif$u;html_special_mark_lt;v$min(i,j);html_special_mark_amp;mboxif$u=v$j;html_special_mark_amp;mboxif$u;html_special_mark_gt;v$arrayright.){}/; $cached_env_img{$key} =''; $key = q/{users}Theuseofnonblockingssallowsthesertoproceedaheadofthereceiver,sothatthecomputationismoretolerantoffluctuationsinthespeedsofthetwoprocesses.TheMPImessage-passingmodelfitsa``push''model,wherecommunicationisinitiatedbytheser.Thecommunicationwillgenerallyhaveloweroverheadifareceivebufferisalreadypostedwhentheserinitiatesthecommunication.Theuseofnonblockingreceivesallowsonetopostreceives``early''andsoachievelowercommunicationoverheadswithoutblockingthereceiverwhileitwaitsforthes.{users}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TEST_CANCELLED(status,flag)funcargINstatusstatusobjectfuncargOUTflagconsttrueifcanceled{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}AcalltompifuncMPI_PROBE(source,tag,comm,status)willmatchthemessagethatwouldhavebeenreceivedbyacalltompifuncMPI_RECV(...,source,tag,comm,status)executedatthesamepoint.Supposethatthismessagehassourcesfs,tagsftandcommunicatorsfc.IfthetagargumentintheprobecallhasvalueconstMPI_ANY_TAGcoindexMPI_ANY_TAGthenthemessageprobedwillbetheearliestpingmessagefromsourcesfswithcommunicatorsfcandanytag;inanycase,themessageprobedwillbetheearliestpingmessagefromsourcesfswithtagsftandcommunicatorsfc(thisisthemessagethatwouldhavebeenreceived,soastopreservemessageorder).Thismessagecontinuesastheearliestpingmessagefromsourcesfswithtagsftandcommunicatorsfc,untilitisreceived.Thefirstreceiveoperationsubsequenttotheprobethatusesthesamecommunicatorastheprobeandusesthetagandsourcevaluesreturnedbytheprobe,mustreceivethismessage.{implementors}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-lib2good.eps,width=3.5inlabelfig:context-lib2good{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_WAITANY(count,array_of_requests,index,status)funcargINcountlistlengthfuncargINOUTarray_of_requestsarrayofrequesthandlesfuncargOUTindexindexofrequesthandlethatcompletedfuncargOUTstatusstatusobject{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}{(type_0,disp_0+mpiargD[0]),ldots,(type_n-1,disp_n-1+mpiargD[0]),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig5.ps,width=4.00insmalllabelfig-advcoll-exE{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GATHERV(sbuf,scount,stype,recvbuf,recvcounts,displs,recvtype,root,comm)funcargINsbufstartingaddressofsbufferfuncargINscountnumberofelementsinsbufferfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountsintegerarrayfuncargINdisplsintegerarrayofdisplacementsfuncargINrecvtypedatatypeofrecvbufferelementsfuncargINrootrankofreceivingprocessfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+mpiargD[count-1]+(mpiargB[count-1]-1)cdotex)}.{displaymath}/; $cached_env_img{$key} =''; $key = q/{tabular}|l|l|hlineMPIdatatype;html_special_mark_amp;FortrandatatypehlinetypeMPI_INTEGER;html_special_mark_amp;ftypeINTEGERtypeMPI_REAL;html_special_mark_amp;ftypeREALtypeMPI_DOUBLE_PRECISION;html_special_mark_amp;ftypeDOUBLEPRECISIONtypeMPI_COMPLEX;html_special_mark_amp;ftypeCOMPLEXtypeMPI_LOGICAL;html_special_mark_amp;ftypeLOGICALtypeMPI_CHARACTER;html_special_mark_amp;ftypeCHARACTER(1)typeMPI_BYTE;html_special_mark_amp;typeMPI_PACKED;html_special_mark_amp;hline{tabular}/; $cached_env_img{$key} =''; $key = q/{rationale}Theequal-datarestriction(ontypematching)wasmadesoastoavoidthecomplexityofprovidingafacilityanalogoustothestatusargumentoffuncMPI_RECVfordiscoveringtheamountofdatasent.Someofthecollectiveroutineswouldrequireanarrayofstatusvalues.Thisrestrictionalsosimplifiesimplementation.{rationale}/; $cached_env_img{$key} =''; $key = q/{implementors}mpifuncMPI_CART_CREATEcanbeimplementedbycreatinganewcommunicator,andcachingwiththenewcommunicatoradescriptionoftheCartesiangrid,e.g.,numberlist9item2(numberofdimensions),item3(numbersofprocessespercoordinatedirection),item4(periodicityinformation),item5(ownpositioningrid)numberlist{implementors}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exMThefollowingiserroneous.fileinclude..codessemantics-8.cProcesszeroexecutesabroadcast,followedbyablockingsoperation.Processonefirstexecutesablockingreceivethatmatchesthes,followedbybroadcastcallthatmatchesthebroadcastofprocesszero.Thisprogrammaydeadlock.Thebroadcastcallonprocesszeroemmayblockuntilprocessoneexecutesthematchingbroadcastcall,sothatthesisnotexecuted.Processonewilldefinitelyblockonthereceiveandso,inthiscase,neverexecutesthebroadcast.Therelativeorderofexecutionofcollectiveoperationsandpoint-to-pointoperationsshouldbesuch,sothatevenifthecollectiveoperationsandthepoint-to-pointoperationsaresynchronizing,nodeadlockwilloccur.{example}/; $cached_env_img{$key} =''; $key = q/{implementors}Theall-reduceoperationscanbeimplementedasareduce,followedbyabroadcast.However,adirectimplementationcanleadtobetterperformance.Inthiscasecaremustbetakentomakesurethatallprocessesreceivethesameresult.{implementors}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+sfstridecdot(sfcount-1)),ldots,(type_n-1,disp_n-1+sfstridecdot(sfcount-1)),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{users}MPIdoesnotrequirethatallprocessesprovidelanguage-standardIO,nordoesitspecifyhowthestandardinputoroutputofaprocessislinkedtoaparticularfileordevice.Inparticular,thereisnorequirement,inaninteractiveenvironment,thatkeyboardinputbebroadcasttoallprocesseswhichsupportlanguage-standardIO.{users}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresderived-upper.ps,width=3.0inlabelfig:advpt2pt-U{figure}/; $cached_env_img{$key} =''; $key = q/{users}NotethatintheCbinding,thevaluereturnedbytheseattributesisaempointertoancodeintcontainingtherequestedvalue.{users}/; $cached_env_img{$key} =''; $key = q/{users}Typically,apostedswillconsumestoragebothatthesingandatthereceivingprocess.Thesingprocesshastokeeptrackoftheposteds,andthereceivingprocessneedsthemessageenvelope,soastobeabletomatchittopostedreceives.Thus,storageforpingcommunicationscanbeexhaustednotonlywhenanyonenodeexecutesalargenumberofpost-sorpost-receivecalls,butalsowhenanyonenodeisthedestinationofalargenumberofmessages.Inalargesystem,sucha``hot-spot''mayoccurevenifeachindividualprocesshasonlyasmallnumberofpingpostedssorreceives,ifthecommunicationpatternisveryunbalanced.cindexhotspotcindexcommunicationhotspotcindexbalance,hotspot{users}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-typematch-OKSerandreceiverspecifymatchingtypes.fileinclude..codespt2pt-typematch-OK.fnoindentThiscodeiscorrectifbothsfaandsfbarerealarraysofsize$ge10$.(InFortran,itmightbecorrecttousethiscodeevenifsfaorsfbhavesize$;html_special_mark_lt;10$,e.g.,sfa(1)mightbebeequivalencedtoanarraywithtenreals.){example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-indexedLetmpiargoldtypehavetypemap({(sfdouble,0),(sfchar,8)},)noindentwithextent16.LetsfB=(3,1)andletsfD=(4,0).AcalltompifuncMPI_TYPE_INDEXED(2,B,D,oldtype,newtype)returnsadatatypewithtypemapdisplaymath{(sfdouble,64),(sfchar,72),(sfdouble,80),(sfchar,88),(sfdouble,96),(sfchar,104),displaymathvspace-0.6cmdisplaymath(sfdouble,0),(sfchar,8)}.displaymathThatis,threecopiesoftheoldtypestartingatdisplacement$4times16=64$,andonecopystartingatdisplacement0.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SEND_INIT(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriestosfuncargINdatatypedatatypeofeachentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}Agraphtopologycanbeimplementedbycachingwiththecommunicatorthetwoarraysnumberlist9item7,item8numberlistThenumberofnodesisequaltothenumberofprocessesinthegroup.Anadditionalzeroentryatthestartofarraympiargindexsimplifiesaccesstothetopologyinformation.{implementors}/; $cached_env_img{$key} =''; $key = q/{}$k_i${}/; $cached_env_img{$key} =''; $key = q/{implementors}Thoughcollective,itisanticipatedthatthisoperationwillnormallybeimplementedwithnocommunication,thoughthedebuggingversionofanMPIlibrarymightchoosetosynchronize.{implementors}/; $cached_env_img{$key} =''; $key = q/{}$sfcountcdotn${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_INCL(group,n,ranks,newgroup)funcargINgroupgroupfuncargINnnumberofelementsinarrayranks(andsizeofmpiargnewgroup)funcargINranksranksofprocessesinmpiarggrouptoappearinmpiargnewgroupfuncargOUTnewgroupnewgroupderivedfromabove,intheorderdefinedbympiargranks{funcdef}/; $cached_env_img{$key} =''; $key = q/{users}TheusermustprovideatleastconstMPI_MAX_PROCESSOR_NAMEspacetowritetheprocessorname---processornamescanbethislong.Theusershouldexaminetheoutputargument,mpiargresultlen,todeterminetheactuallengthofthename.{users}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_KEYVAL_FREE(keyval)funcargINOUTkeyvalFreestheintegerkeyvalue{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$;html_special_mark_gt;1${}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinepsfigfigure=..figuresconc-nocycle2.ps,width=3.5inlabelfig:conc-nocycle2{figure}/; $cached_env_img{$key} =''; $key = q/{}$extent(typeMPI_LB)=extent(typeMPI_UB)=0${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig9.ps,width=4.00insmalllabelfig-advcoll-exK{figure}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-reqfreeAnexampleusingmpifuncMPI_REQUEST_FREE.fileinclude..codespt2pt-reqfree.f{example}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+sfstride+(sfbl-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{constlist}constitemOpAllowedTypesconstitemconstitemMPI_MAX,MPI_MINconstCinteger,Fortraninteger,FloatingpointconstitemMPI_SUM,MPI_PRODconstCinteger,Fortraninteger,Floatingpoint,ComplexconstitemMPI_LAND,MPI_LOR,MPI_LXORconstCinteger,LogicalconstitemMPI_BAND,MPI_BOR,MPI_BXORconstCinteger,Fortraninteger,Byte{constlist}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_PCONTROL(level,ldots)funcargINlevelProfilinglevel{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdefna}MPI_FINALIZE(){funcdefna}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_OP_CREATE(function,commute,op)funcargINfunctionuserdefinedfunctionfuncargINcommutetttrueifcommutative;ttfalseotherwise.funcargOUTopoperation{funcdef}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurestopol-matmult2.eps,width=3.5inlabelfig:topol-matmult2{figure}/; $cached_env_img{$key} =''; $key = q/{}$uv${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_COMPARE(group1,group2,result)funcargINgroup1firstgroupfuncargINgroup2secondgroupfuncargOUTresultresult{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ALLTOALL(sbuf,scount,stype,recvbuf,recvcount,recvtype,comm)funcargINsbufstartingaddressofsbufferfuncargINscountnumberofelementssenttoeachprocessfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountnumberofelementsreceivedfromanyprocessfuncargINrecvtypedatatypeofreceivebufferelementsfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:conc-cycleCodeforperiodicshiftinwhichtheprocessesarearrangedwitharingtopology(i.e.aone-dimensional,periodictopology)wherecommunicatesdatatoitsclockwiseneighbor.Adegenerateinstanceofthisiswhenaprocessssamessagetoitself.Thefollowingcodeusesablockingsinstandardmodetosamessagetoitsclockwiseneighbor,andablockingreceivetoreceiveamessagefromitsanti-clockwiseneighbor.verbatim22{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_COMPARE(comm1,comm2,result)funcargINcomm1firstcommunicatorfuncargINcomm2secondcommunicatorfuncargOUTresultresult{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-Jacobi-seqJacobiiteration--sequentialcodefileinclude..codespt2pt-Jacobi-seq.fnoindentThecodefragmentdescribesthemainloopofaniterativesolverwhere,ateachiteration,thevalueatapointisreplacedbytheaverageoftheNorth,South,EastandWestneighbors(afourpointstencilisusedtokeeptheexamplesimple).Boundaryvaluesdonotchange.Wefocusontheinnerloop,wheremostofthecomputationisdone,anduseFortran90syntax,forclarity.{example}/; $cached_env_img{$key} =''; $key = q/{displaymath}first_n,first_n+stride_n,ldots,first_n+leftlfloorfraclast_n-first_nstride_nrightrfloorcdotstride_n.{displaymath}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-Jacobi-srecvMainloopofJacobicode--versionusings-receive.cindexJacobi,usings-receivefileinclude..codespt2pt-Jacobi-srecv.fnoindentThiscodeissafe,notwithstandingthecycliccommunicationpattern.{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-typematch-byteSerandreceiverspecifycommunicationofuntypedvalues.fileinclude..codespt2pt-typematch-byte.fnoindentThiscodeiscorrect,irrespectiveofthetypeandsizeofsfaandsfb(unlessthisresultsinanoutofboundmemoryaccess).{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-vector-negAcalltompifuncMPI_TYPE_VECTOR(3,1,-2,oldtype,newtype)willcreatethedatatypewithtypemapdisplaymath{(sfdouble,0),(sfchar,8),(sfdouble,-32),(sfchar,-24),(sfdouble,-64),(sfchar,-56)}.displaymath{example}/; $cached_env_img{$key} =''; $key = q/{}$r${}/; $cached_env_img{$key} =''; $key = q/{}$mpiargndims=2${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_INTERSECTION(group1,group2,newgroup)funcargINgroup1firstgroupfuncargINgroup2secondgroupfuncargOUTnewgroupintersectiongroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_CONTIGUOUS(count,oldtype,newtype)funcargINcountreplicationcountfuncargINoldtypeolddatatypefuncargOUTnewtypenewdatatype{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+sfstridecdot(sfcount-1)+(sfbl-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{example}rmLetmpiarggroup1beahandletothegroupsf{a,b,c,d,e,f}andletmpiarggroup2beahandletothegroupsf{d,e,a,c}.Letmpiargranks1=(0,5,0,2).Then,acalltompifuncMPI_GROUP_TRANSLATE_RANKSwillreturntheranksoftheprocessessf{a,f,a,c}inmpiarggroup2,namelympiargranks2=(2,$bot$,2,3).($bot$denotesthevalueconstMPI_UNDEFINED.){example}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+sfstridecdot(sfcount-1)+(sfbl-1)cdotex)}.{displaymath}/; $cached_env_img{$key} =''; $key = q/{}$sfbuf+extentcdoti+disp_j${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_BSEND_INIT(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriestosfuncargINdatatypedatatypeofeachentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-ACCcode.Process0ssamessagetoprocess1.fileinclude..codespt2pt-AC.c{example}/; $cached_env_img{$key} =''; $key = q/{}$ex_i${}/; $cached_env_img{$key} =''; $key = q/{}$mpiargcoords=(1,2)${}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresadvpt2pt-vector.ps,width=4.0inlabelfig:advpt2pt-vector{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_IPROBE(source,tag,comm,flag,status)funcargINsourcerankofsourcefuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTflagconsttrueifthereisamessagefuncargOUTstatusstatusobject{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$sfrecvbuf(0)=rmglobalmax(sfsbuf(0))${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ATTR_DELETE(comm,keyval)funcargINcommcommunicatortowhichattributeisattachedfuncargINkeyvalThekeyvalueofthedeletedattribute{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+(sfstridecdot(sfcount-1)+sfbl-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{implementors}Thisrequirementimposesconstraintsonimplementationstrategies.Suppose,forexample,thataprocessexecutestwosuccessiveblockingscalls.Themessagesentbythefirstcallisbuffered,andthesecondcallstarts.Then,ifareceiveispostedthatmatchesthisseconds,thesecondmessageshouldbeabletoovertakethefirstbufferedone.{implementors}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig3.ps,width=3.50insmalllabelfig-advcoll-exC{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CART_MAP(comm,ndims,dims,periods,newrank)funcargINcomminputcommunicatorfuncargINndimsnumberofdimensionsofCartesianstructurefuncargINdimsintegerarrayofsizettndimsspecifyingthenumberofprocessesineachcoordinatedirectionfuncargINperiodslogicalarrayofsizettndimsspecifyingtheperiodicityspecificationineachcoordinatedirectionfuncargOUTnewrankreorderedrankofthecallingprocess;constMPI-_UN-DE-FINEDifcallingprocessdoesnotbelongtogrid{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-typematch-badSerandreceiverdonotspecifymatchingtypes.fileinclude..codespt2pt-typematch-bad.fnoindentThiscodeiserroneous,sinceserandreceiverdonotprovidematchingdatatypearguments.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_INTERCOMM_MERGE(intercomm,high,newintracomm)funcargINintercommInterCommunicatorfuncargINhighseebelowfuncargOUTnewintracommnewintracommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_COMMIT(datatype)funcargINOUTdatatypedatatypethatistobecommitted{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$extent${}/; $cached_env_img{$key} =''; $key = q/{}(left(arraycuiarrayright)circleft(arraycvjarrayright)=left(arraycwkarrayright)){}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_IRECV(buf,count,datatype,source,tag,comm,request)funcargOUTbufinitialaddressofreceivebufferfuncargINcountnumberofentriesinreceivebufferfuncargINdatatypedatatypeofeachreceivebufferentryfuncargINsourcerankofsourcefuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}ldots.,(type_0,disp_0+sfstridecdot(sfcount-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{implementors}Althoughnotrequired,itisstronglysuggestedthatnamedMPIconstants(ftypePARAMETERs)beprovidedinanincludefile,cindexincludefilecindexsfmpif.hcalledsfmpif.h.Onsystemsthatdonotsupportincludefiles,theimplementationshouldspecifythevaluesofnamedconstants.VorsareencouragedtoprovidetypedeclarationsandinterfaceblocksforMPIfunctionsinthettmpif.hfileonFortransystemsthatsupportthose.SuchdeclarationscanbeusedtoavoidsomeofthelimitationsoftheFortran77bindingofMPI.Forexample,theCbindingspecifiesthat``addresses''areoftypetypeMPI_Aint;thistypecanbedefinedtobea64bitinteger,onsystemswith64bitaddresses.ThisfeatureisnotavailableintheFortran77binding,where``addresses''areoftypeftypeINTEGER.Byprovidinganinterfaceblockwhere``address''parametersaredefinedtobeoftypeftypeINTEGER(8),theimplementorcanprovidesupportfor64bitaddresses,whilemaintainingcompatibilitywiththeMPIstandard.{implementors}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+(sfstride+sfbl-1)cdotex),ldots,(type_n-1,disp_n-1+(sfstride+sfbl-1)cdotex),{displaymath}/; $cached_env_img{$key} =''; $key = q/{}$j=0,ldots,n-1${}/; $cached_env_img{$key} =''; $key = q/{}$type_i${}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+sfstride),ldots,(type_n-1,disp_n-1+sfstride),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_BCAST(buffer,count,datatype,root,comm)funcargINOUTbufferstartingaddressofbufferfuncargINcountnumberofentriesinbufferfuncargINdatatypedatatypeofbufferfuncargINrootrankofbroadcastrootfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$u=max_iu_i${}/; $cached_env_img{$key} =''; $key = q/{users}InFortran,thedimensionindicatedbympiargDIRECTION=ihasmpiargDIMS(i+1)processes,wherempiargDIMSisthearraythatwasusedtocreatethegrid.InC,thedimensionindicatedbympiargdirection=iisthedimensionspecifiedbympiargdims[i].{users}/; $cached_env_img{$key} =''; $key = q/{rationale}Aspreviouslystated,themessagepassinginaprogramcanberepresentedasadirectedgraphwheretheverticesareprocessesandtheedgesaremessages.Onmanysystems,optimizingcommunicationspeedsrequiresaminimizationofthecontentionforphysicalwiresbymessagesoccurringsimultaneously.Performingthisoptimizationrequiresknowledgeofwhenmessagesoccurandtheirresourcerequirements.Notonlyisthisinformationdifficulttorepresent,itmaynotbeavailableattopologycreationtimeincomplexprograms.Asimpleralternativeistoprovideinformationabout``spatial''distributionofcommunicationandignore``temporal''distribution.Thoughtheformermethodcanleadtogreateroptimizationsandfasterprograms,thelatermethodisusedinMPItoallowasimplerinterfacethatiswellunderstoodatthecurrenttime.Asaresult,theprogrammertellstheMPIsystemthetypicalconnections,e.g.,topology,oftheirprogram.Thiscanleadtocompromiseswhenaspecifictopologymayover-orunder-specifytheconnectivitythatisusedatanytimeintheprogram.Overall,however,thechosentopologymechanismwasseenasausefulcompromisebetweenfunctionalityandeaseofusage.ExperiencewithsimilartechniquesinPARMACSciteparmacs1,parmacs2showthatthisinformationisusuallysufficientforagoodmapping.{rationale}/; $cached_env_img{$key} =''; $key = q/{users}EventhoughtheCfunctionscfuncMPI_Buffer_attachandcfuncMPI-_Buffer-_detachbothhaveafirstargumentoftypeconstvoid*,theseargumentsareuseddifferently:ApointertothebufferispassedtocfuncMPI_Buffer_attach;theaddressofthepointerispassedtocfuncMPI_Buffer_detach,sothatthiscallcanreturnthepointervalue.{users}/; $cached_env_img{$key} =''; $key = q/{implementors}ThempifuncMPI_REDUCE_SCATTERroutineisfunctionallyequivalentto:AfuncMPI_REDUCEoperationfunctionwithmpiargcountequaltothesumofmpiargrecvcounts[i]followedbyfuncMPI_SCATTERVwithmpiargscountsequaltompiargrecvcounts.However,adirectimplementationmayrunfaster.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ERRHANDLER_FREE(errhandler)funcargINerrhandlerMPIerrorhandler{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}EventhoughnospecificbehaviorismandatedbyMPIforerroneousprograms,therecommedhandlingofoverflowsituationsistoreturn,inmpiargstatus,informationaboutthesource,tagandsizeoftheincomingmessage.Thereceiveoperationwillreturnanerrorcode.Aqualityimplementationwillalsoensurethatmemorythatisoutsidethereceivebufferwillnotbeoverwritten.Inthecaseofamessageshorterthanthereceivebuffer,MPIisquitestrictinthatitallowsnomodificationoftheotherlocationsinthebuffer.Amorelenientstatementwouldallowforsomeoptimizationsbutthisisnotallowed.Theimplementationmustbereadytoacopyintothereceivermemoryexactlyattheofthereceiveddata,evenifitisatanon-word-alignedaddress.{implementors}/; $cached_env_img{$key} =''; $key = q/{users}ThecalltompifuncMPI_Attr_putpassesinmpiargattribute_valtheemvalueoftheattribute;thecalltompifuncMPI_Attr_getpassesinmpiargattribute_valtheemaddressofthethelocationwheretheattributevalueistobereturned.Thus,iftheattributevalueitselfisapointeroftypeconstvoid*,thentheactualmpiargattribute_valparametertompifuncMPI_Attr_putwillbeoftypeconstvoid*andtheactualmpiargattribute_valparametertompifuncMPI_Attr_getwillbeoftypeconstvoid**.{users}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-commitThefollowingcodefragmentgivesexamplesofusingfuncMPI-_TYPE-_COM-MITandfuncMPI_TYPE_FREE.fileinclude..codesadvpt2pt-commit.f{example}/; $cached_env_img{$key} =''; $key = q/{implementors}Therangeoperationsshouldbeimplemented,ifpossible,withoutenumeratingthegroupmembers,inordertoobtainbetterscalability(timeandspace).{implementors}/; $cached_env_img{$key} =''; $key = q/{tabular}|l|l|hlineMPIdatatype;html_special_mark_amp;CdatatypehlinetypeMPI_CHAR;html_special_mark_amp;ctypesignedchartypeMPI_SHORT;html_special_mark_amp;ctypesignedshortinttypeMPI_INT;html_special_mark_amp;ctypesignedinttypeMPI_LONG;html_special_mark_amp;ctypesignedlonginttypeMPI_UNSIGNED_CHAR;html_special_mark_amp;ctypeunsignedchartypeMPI_UNSIGNED_SHORT;html_special_mark_amp;ctypeunsignedshortinttypeMPI_UNSIGNED;html_special_mark_amp;ctypeunsignedinttypeMPI_UNSIGNED_LONG;html_special_mark_amp;ctypeunsignedlonginttypeMPI_FLOAT;html_special_mark_amp;ctypefloattypeMPI_DOUBLE;html_special_mark_amp;ctypedoubletypeMPI_LONG_DOUBLE;html_special_mark_amp;ctypelongdoubletypeMPI_BYTE;html_special_mark_amp;typeMPI_PACKED;html_special_mark_amp;hline{tabular}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-cancelCodeusingmpifuncMPI_CANCELfileinclude..codespt2pt-cancel.c{example}/; $cached_env_img{$key} =''; $key = q/{rationale}Theuseofthempiargextra_stateargumentallowsonetospecializethebehaviorofagenericcopycallbackfunctiontoaparticularattribute.E.g.,onemighthaveagenericcopyfunctionthatallocatessfmbytesofstorage,copysfmbytesfromaddressmpiargattribute_val_inintothenewlyallocatedspace,andreturnstheaddressoftheallocatedspaceinmpiargattribute_val_out;thevalueofsfm,i.e.,thesizeofthedatastructureforaspecificattribute,canbespecifiedviampiargextra_state.{rationale}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_GROUP(comm,group)funcargINcommcommunicatorfuncargOUTgroupgroupcorrespondingtompiargcomm{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$0ldots${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TEST(request,flag,status)funcargINOUTrequestrequesthandlefuncargOUTflagsftrueifoperationcompletedfuncargOUTstatusstatusobject{funcdef}/; $cached_env_img{$key} =''; $key = q/{users}ThecommunicatorconstMPI_COMM_SELFcanbeusedtostorecoindexMPI_COMM_SELFprocess-localattributes,viathisattributecachingmechanism.{users}/; $cached_env_img{$key} =''; $key = q/{users}Supposeonedefinesalibraryofuser-definedreducefunctionsthatareoverloaded:thempiargdatatypeargumentisusedtoselecttherightexecutionpathateachinvocation,accordingtothetypesoftheoperands.Theuser-definedreducefunctioncannot``decode''thempiargdatatypeargumentthatitispassed,andcannotidentify,byitself,thecorrespondencebetweenthedatatypehandlesandthedatatypetheyrepresent.Thiscorrespondencewasestablishedwhenthedatatypeswerecreated.Beforethelibraryisused,alibraryinitializationpreamblemustbeexecuted.Thispreamblecodewilldefinethedatatypesthatareusedbythelibrary,andstorehandlestothesedatatypesinglobal,staticvariablesthataresharedbytheusercodeandthelibrarycode.TheFortranversionofmpifuncMPI_REDUCEwillinvokeauser-definedreducefunctionusingtheFortrancallingconventionsandwillpassaFortran-typedatatypeargument;theCversionwilluseCcallingconventionandtheCrepresentationofadatatypehandle.Userswhoplantomixlanguagesshoulddefinetheirreductionfunctionsaccordingly.{users}/; $cached_env_img{$key} =''; $key = q/{}(copyright){}/; $cached_env_img{$key} =''; $key = q/{}$u${}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itempassinformationbetweencallsbyassociatingitwithanMPIintra-orin-ter--com-mun-i-ca-tor,itemquicklyretrievethatinformation,anditembeguaranteedthatout-of-dateinformationisneverretrieved,evenifthecommunicatorisfreedanditshandlesubsequentlyreusedbyMPI.{bulletlist}/; $cached_env_img{$key} =''; $key = q/{}$first_i;html_special_mark_gt;last_i${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GET_PROCESSOR_NAME(name,resultlen)funcargOUTnameAuniquespecifierforthecurrentphysicalnode.funcargOUTresultlenLength(inprintablecharacters)oftheresultreturnedincodename{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$ex${}/; $cached_env_img{$key} =''; $key = q/{rationale}MPIdoesnotsupportaemmulticastfunction,whereabroadcastexecutedbyarootcanbematchedbyregularreceivesattheremainingprocesses.Suchafunctioniseasytoimplementiftherootdirectlyssdatatoeachreceivingprocess.But,then,thereislittletobegained,ascomparedtoexecutingmultiplesoperations.Animplementationwhereprocessesareusedasintermediatenodesinabroadcasttreeishard,sinceonlytherootexecutesacallthatidentifiestheoperationasabroadcast.Incontrast,inacollectivecalltompifuncMPI_BCASTallprocessesareawarethattheyparticipateinabroadcast.{rationale}/; $cached_env_img{$key} =''; $key = q/{numberlist}9itemDataiscopiedoutofthesbufferandamessageisassembled.itemAmessageistransferredfromsertoreceiver.itemDataiscopiedfromtheincomingmessageanddisassembledintothereceivebuffer.{numberlist}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_REQUEST_FREE(request)funcargINOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{rationale}Thisfunctionisequivalenttoaccessingthecommunicator'sgroupwithmpifuncMPI_COMM_GROUP(seeabove),computingthesizeusingmpifuncMPI_GROUP_SIZE,andthenfreeingthegrouptemporaryviampifuncMPI_GROUP_FREE.However,thisfunctionissocommonlyused,thatthisshortcutwasintroduced.{rationale}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:context-badlib1Beforethecollectiveinvocationtompifuncmcast(),process2ssamessagetoprocess1;process1postsareceivewithadontcaresource.mpifuncmcastisinvoked,withprocess0astheroot.fileinclude..codescontext-badlib1.c{example}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurestopol-fig2.eps,width=5.5inlabelfig:topol-fig2{figure}/; $cached_env_img{$key} =''; $key = q/{implementors}Inamulti-threadedenvironment,acalltofuncMPI_WAITshouldblockonlythecallingthread,allowinganotherthreadtobescheduledforexecution.{implementors}/; $cached_env_img{$key} =''; $key = q/{}$*${}/; $cached_env_img{$key} =''; $key = q/{rationale}Thetwogroupsofaninter-groupcommunicationdomainarerequiredtobedisjointinordertosupportthedefinedintercommunicatorcreationfunction.IfthegroupswerenotdisjointthenaprocessintheintersectionofthetwogroupswouldhavetomaketwocallstompifuncMPI_INTERCOMM_CREATE,oneonbehalfofeachgroupitbelongsto.Thisisnotfeasiblewithablockingcall.Onewouldneedtouseanonblockingcall,implementedusingnonblockingcollectivecommunication,inordertorelaxthedisjointnesscondition.{rationale}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TOPO_TEST(comm,status)funcargINcommcommunicatorfuncargOUTstatustopologytypeofcommunicatorttcomm{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeltopol-exCSupposethatttcommisacommunicatorwithashuffle-exchangetopology.Thegrouphas$2^n$members.Eachprocessislabeledby$a_1,ldots,a_n$with$a_iin{0,1}$,andhasthreeneighbors:exchange($a_1,ldots,a_n)=a_1,ldots,a_n-1,bara_n$($bara=1-a$),unshuffle($a_1,ldots,a_n)=a_2,ldots,a_n,a_1$,andshuffle($a_1,ldots,a_n)=a_n,a_1,ldots,a_n-1$.Thegraphadjacencylistisillustratedbelowfor$n=3$.[3.0ex]centeringtabular|cc|ccc|hlinemulticolumn2|c|bfnode;html_special_mark_amp;bfexchange;html_special_mark_amp;bfunshuffle;html_special_mark_amp;bfshuffle;html_special_mark_amp;;html_special_mark_amp;neighbors(1);html_special_mark_amp;neighbors(2);html_special_mark_amp;neighbors(3)hline0;html_special_mark_amp;(000);html_special_mark_amp;1;html_special_mark_amp;0;html_special_mark_amp;01;html_special_mark_amp;(001);html_special_mark_amp;0;html_special_mark_amp;2;html_special_mark_amp;42;html_special_mark_amp;(010);html_special_mark_amp;3;html_special_mark_amp;4;html_special_mark_amp;13;html_special_mark_amp;(011);html_special_mark_amp;2;html_special_mark_amp;6;html_special_mark_amp;54;html_special_mark_amp;(100);html_special_mark_amp;5;html_special_mark_amp;1;html_special_mark_amp;25;html_special_mark_amp;(101);html_special_mark_amp;4;html_special_mark_amp;3;html_special_mark_amp;66;html_special_mark_amp;(110);html_special_mark_amp;7;html_special_mark_amp;5;html_special_mark_amp;37;html_special_mark_amp;(111);html_special_mark_amp;6;html_special_mark_amp;7;html_special_mark_amp;7hlinetabularcenteringvspace.5cmSupposethatthecommunicatorttcommhasthistopologyassociatedwithit.Thefollowingcodefragmentcyclesthroughthethreetypesofneighborsandperformsanappropriatepermutationforeach.fileinclude..codestopol-1.f{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CARTDIM_GET(comm,ndims)funcargINcommcommunicatorwithCartesianstructurefuncargOUTndimsnumberofdimensionsoftheCartesianstructure{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$stride_i${}/; $cached_env_img{$key} =''; $key = q/{}$2over3${}/; $cached_env_img{$key} =''; $key = q/{implementors}Agoodqualityimplementationwill,tothegreatestpossibleextent,circumscribetheimpactofanerror,sothatnormalprocessingcancontinueafteranerrorhandlerwasinvoked.Theimplementationdocumentationwillprovideinformationonthepossibleeffectofeachclassoferrors.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_BSEND(buf,count,datatype,dest,tag,comm)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriesinsbufferfuncargINdatatypedatatypeofeachsbufferentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_UNPACK(inbuf,insize,position,outbuf,outcount,datatype,comm)funcargINinbufinputbufferfuncargINinsizesizeofinputbuffer,inbytesfuncargINOUTpositioncurrentpositioninbytesfuncargOUToutbufoutputbufferfuncargINoutcountnumberofcomponentstobeunpackedfuncargINdatatypedatatypeofeachoutputcomponentfuncargINcommcommunicatorforpackedmessage{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exBDothesameasthepreviousexample,butuseaderiveddatatype.Notethatthetypecannotbetheentiresetofttgsize*100intssincetypematchingisdefinedpairwisebetweentherootandeachprocessinthegather.fileinclude..codescoll-4.c{example}/; $cached_env_img{$key} =''; $key = q/{implementors}Thechallengefacingimplementorsistobeaslenientaspossibletoapplicationsthatrequirebuffering,withouthamperingperformanceofapplicationsthatdonotrequirebuffering.Applicationsshouldnotdeadlockifmemoryisavailabletoallowprogressinthecommunication.Butcopyingshouldbeavoidedwhenitisnotnecessary.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_VECTOR(count,blocklength,stride,oldtype,newtype)funcargINcountnumberofblocksfuncargINblocklengthnumberofelementsineachblockfuncargINstridespacingbetweenstartofeachblock,measuredasnumberofelementsfuncargINoldtypeolddatatypefuncargOUTnewtypenewdatatype{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$ncdotk${}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+ex),ldots,(type_n-1,disp_n-1+ex),{displaymath}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:context-setopsLet$sfgroup1={a,b,c,d}$and$sfgroup2={d,a,e}$.Thendisplaymathsfgroup1bigcupgroup2={a,b,c,d,e}rm(union);<<5280>displaymathdisplaymathsfgroup1bigcapgroup2={a,d}rm(intersection);<<5281>displaymathanddisplaymathsfgroup1setminusgroup2={b,c}rm(difference).<<5282>displaymath{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GET_COUNT(status,datatype,count)funcargINstatusreturnstatusofreceiveoperationfuncargINdatatypedatatypeofeachreceivebufferentryfuncargOUTcountnumberofreceivedentries{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_INITIALIZED(flag)funcargOUTflagFlagistrueifmpifuncMPI_INIThasbeencalledandfalseotherwise.{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-needbufferAnexchangethatreliesonbuffering.fileinclude..codespt2pt-needbuffer.fnoindentThemessagesentbyeachprocessmustbecopiedsomewherebeforethesoperationreturnsandthereceiveoperationstarts.Fortheprogramtocomplete,itisnecessarythatatleastoneofthetwomessagesbebuffered.Thus,thisprogramwillsucceedonlyifthecommunicationsystemwillbufferatleastmpiargcountwordsofdata.Otherwise,theprogramwilldeadlock.Thesuccessofthisprogramwilldepontheamountofbufferspaceavailableinaparticularimplementation,onthebufferallocationpolicyused,andonotherconcurrentcommunicationoccurringinthesystem.Thisprogramisunsafe.{example}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemExplicitshared-memoryoperationsitemOperationsthatrequiremoreoperatingsystemsupportthanwasstandardduringtheadoptionofMPI;forexample,interrupt-drivenreceives,remoteexecution,oractivemessagesitemProgramconstructiontoolsitemDebuggingfacilitiesitemExplicitsupportforthreadsitemSupportfortaskmanagementitemIOfunctions{bulletlist}/; $cached_env_img{$key} =''; $key = q/{}$ub${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_UNION(group1,group2,newgroup)funcargINgroup1firstgroupfuncargINgroup2secondgroupfuncargOUTnewgroupuniongroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{}(10^-3){}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinepsfigfigure=..figuresconc-nocycle.ps,width=3.5inlabelfig:conc-nocycle{figure}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0^sfc-1,disp_0^sfc-1+mpiargD[c-1]),ldots,(type_n_sfc-1-1^sfc-1,disp_n_sfc-1-1^sfc-1+mpiargD[c-1]),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig4.ps,width=4.00insmalllabelfig-advcoll-exD{figure}/; $cached_env_img{$key} =''; $key = q/{}$mpiargnneighbors=2${}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-Jacobi-nonblockUseofnonblockingcommunicationsinJacobicomputation.fileinclude..codespt2pt-Jacobi-nonblock.fnoindentThecommunicationcallsusetheleftmostandrightmostcolumnsoflocalarrayttBandsettheleftmostandrightmostcolumnsoflocalarrayttA.ThesbuffersaremadeavailableearlybyseparatingtheupdateoftheleftmostandrightmostcolumnsofttBfromtheupdateoftheinteriorofttB.SincethisisalsowheretheleftmostandrightmostcolumnsofttAareused,thecommunicationcanbestartedimmediatelyafterthesecolumnsareupdatedandcanbecompletedjustbeforethenextiteration.{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-prodcon-with-waitMultiple-producer,single-consumercodeusingnonblockingcommunicationfileinclude..codespt2pt-prodcon-with-wait.cnoindentEachproducerrunsaninfiniteloopwhereitrepeatedlyproducesonemessageandssit.Theconsumerserveseachproducerinturn,byreceivingitsmessageandconsumingit.{example}/; $cached_env_img{$key} =''; $key = q/{}$Typemap${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_OP_FREE(op)funcargINopoperation{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_SPLIT(comm,color,key,newcomm)funcargINcommcommunicatorfuncargINcolorcontrolofsubsetassignmentfuncargINkeycontrolofrankassignmentfuncargOUTnewcommnewcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{constlist}constitemMPI_GRAPHgraphtopologyconstitemMPI_CARTCartesiantopologyconstitemMPI_UNDEFINEDnotopology{constlist}/; $cached_env_img{$key} =''; $key = q/{}$max_ik_i${}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-excorr1Thefollowingiserroneous.fileinclude..codessemantics-6.cWeassumethatthegroupofsfcommis{0,1}.Twoprocessesexecutetwobroadcastoperationsinreverseorder.MPImaymatchthefirstbroadcastcallofeachprocess,resultinginanerror,sincethecallsdonotspecifythesameroot.Alternatively,ifMPImatchesthecallscorrectly,thenadeadlockwilloccurifthetheoperationissynchronizing.Collectiveoperationsmustbeexecutedinthesameorderatallmembersofthecommunicationgroup.{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-structLetmpiargtype1havetypemap({(sfdouble,0),(sfchar,8)},)noindentwithextent16.LetsfB=(2,1,3),sfD=(0,16,26),andsfT=(MPI_FLOAT,type1,MPI_CHAR).ThenacalltompifuncMPI_TYPE_STRUCT(3,B,D,T,newtype)returnsadatatypewithtypemapdisplaymath{(sffloat,0),(sffloat,4),(sfdouble,16),(sfchar,24),(sfchar,26),(sfchar,27),(sfchar,28)}.displaymathThatis,twocopiesoftypeMPI_FLOATstartingat0,followedbyonecopyofmpiargtype1startingat16,followedbythreecopiesoftypeMPI_CHAR,startingat26.(Weassumethatafloatoccupiesfourbytes.){example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GATHER(sbuf,scount,stype,recvbuf,recvcount,recvtype,root,comm)funcargINsbufstartingaddressofsbufferfuncargINscountnumberofelementsinsbufferfuncargINstypedatatypeofsbufferelementsfuncargOUTrecvbufaddressofreceivebufferfuncargINrecvcountnumberofelementsforanysinglereceivefuncargINrecvtypedatatypeofrecvbufferelementsfuncargINrootrankofreceivingprocessfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}ThefunctionmpifuncMPI_CART_CREATE(comm,ndims,dims,periods,reorder,comm_cart),withttreorder=truecanbeimplementedbycallingmpifuncMPI_CART_MAP(comm,ndims,dims,periods,newrank),thencallinglinebreakmpifuncMPI_COMM_SPLIT(comm,color,key,comm_cart),withttcolor=0ifttnewrank$neq$linebreakMPI_UNDEFINED,ttcolor=MPI_UNDEFINEDotherwise,andttkey=newrank.{implementors}/; $cached_env_img{$key} =''; $key = q/{implementors}Thesystemmay``compile''atcommittimeaninternalrepresentationforthedatatypethatfacilitatescommunication.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_RANGE_INCL(group,n,ranges,newgroup)funcargINgroupgroupfuncargINnnumberoftripletsinarraympiargrangesfuncargINrangesanarrayofintegertriplets,oftheform(firstrank,lastrank,stride)indicatingranksinmpiarggroupofprocessestobeincludedinmpiargnewgroupfuncargOUTnewgroupnewgroupderivedfromabove,intheorderdefinedbympiargranges{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$sfcount=sum_irecvcounts[i]${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-fig6.eps,width=4.0inlabelfig:context-intercommerge{figure}/; $cached_env_img{$key} =''; $key = q/{}$addr_i,j${}/; $cached_env_img{$key} =''; $key = q/{rationale}ThePackandUnpackcallshaveacommunicatorargumentinordertofacilitatedataconversionatthesourceinaheterogeneousenvironment.E.g.,thiswillallowforanimplementationthatusestheXDRformatforpackeddatainaheterogeneouscommunicationdomain,andperformsnodataconversionifthecommunicationdomainishomogeneous.Ifnocommunicatorwasprovided,theimplementationwouldalwaysuseXDR.Ifthedestinationwasprovided,inadditiontothecommunicator,thenonewouldbeabletoformatthepackbufferspecificallyforthatdestination.But,then,onelosestheabilitytopackabufferonceandsittomultipledestinations.{rationale}/; $cached_env_img{$key} =''; $key = q/{}$(u_0,0),(u_1,1),ldots,(u_n-1,n-1)${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurestopol-matrix3.eps,width=4.5inlabelfig:topol-matrix3{figure}/; $cached_env_img{$key} =''; $key = q/{users}Manyprogramswillbewrittenwiththemaster-slavemodel,whereoneprocess(suchastherank-zeroprocess)willplayasupervisoryrole,andtheotherprocesseswillserveascomputenodes.Inthisframework,thetwoprecedingcallsareusefulfordeterminingtherolesofthevariousprocessesofacommunicator.{users}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+(sfstridecdot(sfcount-1)+sfbl-1)cdotex)}.{displaymath}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+(mpiargD[0]+mpiargB[0]-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_STRUCT(count,array_of_blocklengths,array_of_displacements,array_of_types,newtype)funcargINcountnumberofblocksfuncargINarray_of_blocklengthsnumberofelementsperblockfuncargINarray_of_displacementsbytedisplacementforeachblockfuncargINarray_of_typestypeofelementsineachblockfuncargOUTnewtypenewdatatype{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdefna}MPI_WTICK(){funcdefna}/; $cached_env_img{$key} =''; $key = q/{rationale}Sincebidirectionalcommunicationisassumed,theedgesarrayissymmetric.Toallowinputcheckingandtomakethegraphconstructioneasierfortheuser,thefullgraphisgivenandnotjusthalfofthesymmetricgraph.{rationale}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-threepipe.eps,width=4.0inlabelfig:context-threepipe{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_RECV_INIT(buf,count,datatype,source,tag,comm,request)funcargOUTbufinitialaddressofreceivebufferfuncargINcountmaxnumberofentriestoreceivefuncargINdatatypedatatypeofeachentryfuncargINsourcerankofsourcefuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:context-cachecomm1Codeinpreviousexampleismodified,topreventbackmasking:successiveinvocationsofmpifuncmcastwiththesamecommunicatorusedistincttags.fileinclude..codescontext-cachecomm1.c{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_REDUCE_SCATTER(sbuf,recvbuf,recvcounts,datatype,op,comm)funcargINsbufstartingaddressofsbufferfuncargOUTrecvbufstartingaddressofreceivebufferfuncargINrecvcountsintegerarrayfuncargINdatatypedatatypeofelementsofinputbufferfuncargINopoperationfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{rationale}Thoughnotessential,thelastrestrictionisimposedsoastoachievesymmetrywithfuncMPI_GATHER,wherethecorrespondingrestriction(amultiple-writerestriction)isnecessary.{rationale}/; $cached_env_img{$key} =''; $key = q/{}$i^rmth${}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeltopol-exBAssumetherearefourprocesses0,1,2,3withthefollowingadjacencymatrix:[2.0ex]hspace*parindenttabular|c|l|hlineprocess;html_special_mark_amp;neighborshline0;html_special_mark_amp;1,31;html_special_mark_amp;02;html_special_mark_amp;33;html_special_mark_amp;0,2hlinetabularvspace*2.0exThen,theinputargumentsare:[2.0ex]hspace*parindenttabularllttnnodes=;html_special_mark_amp;4ttindex=;html_special_mark_amp;(2,3,4,6)ttedges=;html_special_mark_amp;(1,3,0,3,0,2)tabularvspace*2.0exThus,inC,ttindex[0]isthedegreeofnodezero,andttindex[i]-index[i-1]isthedegreeofnodetti,i=1,ldots,nnodes-1;thelistofneighborsofnodezeroisstoredinttedges[j],for$tt0leqjleqindex[0]-1$andthelistofneighborsofnodetti,$tti;html_special_mark_gt;0$,isstoredinttedges[j],$ttindex[i-1]leqjleqindex[i]-1$.InFortran,ttindex(1)isthedegreeofnodezero,andttindex(i+1)-index(i)isthedegreeofnodetti,i=1,ldots,nnodes-1;thelistofneighborsofnodezeroisstoredinttedges(j),for$tt1leqjleqindex(1)$andthelistofneighborsofnodetti,$tti;html_special_mark_gt;0$,isstoredinttedges(j),$ttindex(i)+1leqjleqindex(i+1)$.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_KEYVAL_CREATE(copy_fn,delete_fn,keyval,extra_state)funcargINcopy_fnCopycallbackfunctionformpiargkeyvalfuncargINdelete_fnDeletecallbackfunctionformpiargkeyvalfuncargOUTkeyvalkeyvalueforfutureaccessfuncargINextra_stateExtrastateforcallbackfunctions{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$extent(Typemap)${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_WAIT(request,status)funcargINOUTrequestrequesthandlefuncargOUTstatusstatusobject{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-deadlockAnattempttoexchangemessages.fileinclude..codespt2pt-deadlock.fnoindentThereceiveoperationofthefirstprocessmustcompletebeforeitss,andcancompleteonlyifthematchingsofthesecondprocessorisexecuted.Thereceiveoperationofthesecondprocessmustcompletebeforeitssandcancompleteonlyifthematchingsofthefirstprocessisexecuted.Thisprogramwillalwaysdeadlock.{example}/; $cached_env_img{$key} =''; $key = q/{rationale}ThedefinitionofconstMPI_MINLOCandconstMPI_MAXLOCgivencoindexMPI_MINLOCcoindexMPI_MAXLOCherehastheadvantagethatitdoesnotrequireanyspecial-casehandlingofthesetwooperations:theyarehandledlikeanyotherreduceoperation.AprogrammercanprovidehisorherowndefinitionofconstMPI_MAXLOCandconstMPI_MINLOC,ifsodesired.Thedisadvantageisthatvaluesandindiceshavetobefirstinterleaved,andthatindicesandvalueshavetobecoercedtothesametype,inFortran.{rationale}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemttlevel=0:Profilingisdisabled.itemttlevel=1:Profilingisenabledatanormaldefaultlevelofdetail.itemttlevel=2:Profilebuffersareflushed.(Thismaybeano-opinsomeprofilers).itemAllothervaluesofttlevelhaveprofilelibrarydefinedeffectsandadditionalarguments.{bulletlist}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_EXCL(group,n,ranks,newgroup)funcargINgroupgroupfuncargINnnumberofelementsinarrayranksfuncargINranksarrayofintegerranksinmpiarggroupnottoappearinmpiargnewgroupfuncargOUTnewgroupnewgroupderivedfromabove,preservingtheorderdefinedbympiarggroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{}${(sfint,0)}${}/; $cached_env_img{$key} =''; $key = q/{}({(type_0,disp_0),ldots,(type_n-1,disp_n-1)},){}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinepsfigfigure=..figuresconc-nocycle3.ps,width=3.5inlabelfig:conc-nocycle3{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GRAPH_MAP(comm,nnodes,index,edges,newrank)funcargINcomminputcommunicatorfuncargINnnodesnumberofgraphnodesfuncargINindexintegerarrayspecifyingthegraphstructure,seempifuncMPI_GRAPH_CREATEfuncargINedgesintegerarrayspecifyingthegraphstructurefuncargOUTnewrankreorderedrankofthecallingprocess;constMPI-_UN-DE-FINEDifthecallingprocessdoesnotbelongtograph{funcdef}/; $cached_env_img{$key} =''; $key = q/{users}Thisisanextremelypowerfulmechanismfordividingasinglecommunicatinggroupofprocessesinto$k$subgroups,with$k$chosenimplicitlybytheuser(bythenumberofcolorsassertedoveralltheprocesses).Eachresultingcommunicationdomainwillbeuniqueandtheirassociatedgroupsarenon-overlapping.Suchadivisioncouldbeusefulfordefiningahierarchyofcomputations,suchasformultigrid,orlinearalgebra.MultiplecallstofuncMPI_COMM_SPLITcanbeusedtoovercometherequirementthatanycallhavenooverlapoftheresultingcommunicators(eachprocessisofonlyonecolorpercall).Inthisway,multipleoverlappingcommunicationstructurescanbecreated.Notethat,forafixedcolor,thekeysneednotbeunique.ItisfuncMPI_COMM_SPLIT'sresponsibilitytosortprocessesinascingorderaccordingtothiskey,andtobreaktiesaccordingtooldrank.Ifallthekeysarespecifiedwiththesamevalue,thenalltheprocessesinagivencolorwillhavethesamerelativerankorderastheydidintheirparentgroup.{users}/; $cached_env_img{$key} =''; $key = q/{}$sfinvec[i]circinoutvec[i]${}/; $cached_env_img{$key} =''; $key = q/{}$ncdotsum_i=0^sfcount-1mpiargB[i]${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GRAPHDIMS_GET(comm,nnodes,nedges)funcargINcommcommunicatorforgroupwithgraphstructurefuncargOUTnnodesnumberofnodesingraphfuncargOUTnedgesnumberofedgesingraph{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$i=0,ldots,sfcount-1${}/; $cached_env_img{$key} =''; $key = q/{rationale}ThevariableargumentlistisprovidedbecauseitprovidesanANSI-standardhookforprovidingadditionalinformationtotheerrorhandler;withoutthishook,ANSICprohibitsadditionalarguments.{rationale}/; $cached_env_img{$key} =''; $key = q/{}$0leklesfcount${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_PACK_SIZE(incount,datatype,comm,size)funcargINincountcountargumenttopackingcallfuncargINdatatypedatatypeargumenttopackingcallfuncargINcommcommunicatorargumenttopackingcallfuncargOUTsizeupperboundonsizeofpackedmessage,inbytes{funcdef}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresadvpt2pt-struct.ps,width=4.0inlabelfig:advpt2pt-struct{figure}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinepsfigfigure=..figuresprof-resolve-noweak.ps,width=hsizelabelfig:prof-resolve-noweak{figure}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+(mpiargD[0]+mpiargB[0]-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-AFortranFortrancode.fileinclude..codespt2pt-AFortran.f{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SENDRECV(sbuf,scount,stype,dest,stag,recvbuf,recvcount,recvtype,source,recvtag,comm,status)funcargINsbufinitialaddressofsbufferfuncargINscountnumberofentriestosfuncargINstypetypeofentriesinsbufferfuncargINdestrankofdestinationfuncargINstagstagfuncargOUTrecvbufinitialaddressofreceivebufferfuncargINrecvcountmaxnumberofentriestoreceivefuncargINrecvtypetypeofentriesinreceivebufferfuncargINsourcerankofsourcefuncargINrecvtagreceivetagfuncargINcommcommunicatorfuncargOUTstatusreturnstatus{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}ItisstronglyrecommedthatmpifuncMPI_REDUCEbeimplementedsothatthesameresultbeobtainedwheneverthefunctionisappliedonthesamearguments,appearinginthesameorder.Notethatthismaypreventoptimizationsthattakeadvantageofthephysicallocationofprocessors.{implementors}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescontext-lib2bad.eps,width=3.5inlabelfig:context-lib2bad{figure}/; $cached_env_img{$key} =''; $key = q/{}$epsilon${}/; $cached_env_img{$key} =''; $key = q/{}$ttnewranks[i]=i,i=0,ldots,n-1${}/; $cached_env_img{$key} =''; $key = q/{rationale}ThedefinitionofthisfunctiondoesnotprecludeMPIimplementationsthatdoprocessmigration.Insuchacase,successivecallstompifuncMPI-_GET-_PROCESSOR-_NAMEbythesameprocessmayreturndifferentvalues.NotethatnothinginMPIrequiresordefinesprocessmigration;thisdefinitionofmpifuncMPI-_GET-_PROCESSOR-_NAMEsimplyallowssuchanimplementation.{rationale}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeltopol-exDThecommunicator,mpiargcomm,hasa$3times4$periodic,Cartesiantopologyassociatedwithit.Atwo-dimensionalarrayofttREALsisstoredoneelementperprocess,invariabletta.Onewishestoskewthisarray,byshiftingcolumntti(vertically,i.e.,alongthecolumn)byttisteps.fileinclude..codestopol-2.flabeltopol-code2{example}/; $cached_env_img{$key} =''; $key = q/{implementors}Assumethatbroadcastisimplementedusingpoint-to-pointMPIcommunication.Supposethefollowingtworulesarefollowed.numberlist9itemAllreceivesspecifytheirsourceexplicitly(nowildcards).itemEachprocessssallmessagesthatpertaintoonecollectivecallbeforesinganymessagethatpertaintoasubsequentcollectivecall.numberlistThen,messagesbelongingtosuccessivebroadcastscannotbeconfused,astheorderofpoint-to-pointmessagesispreserved.Itistheimplementor'sresponsibilitytoensurethatpoint-to-pointmessagesarenotconfusedwithcollectivemessages.Onewaytoaccomplishthisis,wheneveracommunicatoriscreated,toalsocreatea``hiddencommunicator''forcollectivecommunication.Onecouldachieveasimilareffectmorecheaply,forexample,byusingahiddentagorcontextbittoindicatewhetherthecommunicatorisusedforpoint-to-pointorcollectivecommunication.cindexhiddencommunicator{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ABORT(comm,errorcode)funcargINcommcommunicatoroftaskstoabortfuncargINerrorcodeerrorcodetoreturntoinvokingenvironment{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$mpiargdims=(3,4)${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_CREATE(comm,group,newcomm)funcargINcommcommunicatorfuncargINgroupGroup,whichisasubsetofthegroupofmpiargcommfuncargOUTnewcommnewcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-getelementUsageoffuncMPI_GET_COUNTandfuncMPI_GET_ELEMENT.fileinclude..codesadvpt2pt-getelement.f{example}/; $cached_env_img{$key} =''; $key = q/{}(w=min(u,v)){}/; $cached_env_img{$key} =''; $key = q/{}$sfcount;html_special_mark_gt;1${}/; $cached_env_img{$key} =''; $key = q/{}$disp_i${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CART_GET(comm,maxdims,dims,periods,coords)funcargINcommcommunicatorwithCartesianstructurefuncargINmaxdimslengthofvectorsttdims,periods,andttcoordsinthecallingprogramfuncargOUTdimsnumberofprocessesforeachCartesiandimensionfuncargOUTperiodsperiodicity(consttrueconstfalse)foreachCartesiandimensionfuncargOUTcoordscoordinatesofcallingprocessinCartesianstructure{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ATTR_PUT(comm,keyval,attribute_val)funcargINcommcommunicatortowhichattributewillbeattachedfuncargINkeyvalkeyvalue,asreturnedbyfuncMPI_KEYVAL_CREATEfuncargINattribute_valattributevalue{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_RSEND_INIT(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriestosfuncargINdatatypedatatypeofeachentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$vu${}/; $cached_env_img{$key} =''; $key = q/{}(bfCreate(StartComplete)^*Free,){}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-extentAssumethat$Type={(sfdouble,0),(sfchar,8)}$(asfdoubleatdisplacementzero,followedbyasfcharatdisplacementeight).Assume,furthermore,thatdoubleshavetobestrictlyalignedataddressesthataremultiplesofeight.Then,theextentofthisdatatypeis16(9roundedtothenextmultipleof8).Adatatypethatconsistsofacharacterimmediatelyfollowedbyadoublewillalsohaveanextentof16.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_STARTALL(count,array_of_requests)funcargINcountlistlengthfuncargINOUTarray_of_requestsarrayofrequesthandles{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SEND(buf,count,datatype,dest,tag,comm)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriestosfuncargINdatatypedatatypeofeachentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$0${}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemThesyntaxofpoint-to-pointcommunicationisthesameforbothinter-andint-ra-com-mun-i-cat-ion.Thesamecommunicatorcanbeusedbothforsandforreceiveoperations.itemAtargetprocessisaddressedbyitsrankintheremotegroup,bothforssandforreceives.itemCommunicationsusinganintercommunicatorareguaranteednottoconflictwithanycommunicationsthatuseadifferentcommunicator.itemAnintercommunicatorcannotbeusedforcollectivecommunication.itemAcommunicatorwillprovideeitherintra-orint-er-com-mun-i-cat-ion,neverboth.{bulletlist}/; $cached_env_img{$key} =''; $key = q/{displaymath}{(type_0,disp_0),ldots,(type_n-1,disp_n-1),{displaymath}/; $cached_env_img{$key} =''; $key = q/{}$leq${}/; $cached_env_img{$key} =''; $key = q/{}$cdot${}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinehboxpsfigfigure=..figuresadvpt2pt-hvector.ps,width=4.0inlabelfig:advpt2pt-hvector{figure}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-characterTransferofFortranftypeCHARACTERs.fileinclude..codespt2pt-character.fnoindentThelastfivecharactersofstringconstbatprocess1arereplacedbythefirstfivecharactersofstringconstaatprocess0.{example}/; $cached_env_img{$key} =''; $key = q/{}$1over3${}/; $cached_env_img{$key} =''; $key = q/{}$k${}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelderived-exXLetsfD=(-3,0,6);sfT=(MPI_LB,MPI_INT,MPI_UB),andsfB=(1,1,1).ThenacalltompifuncMPI_TYPE_STRUCT(3,B,D,T,type1)createsanewdatatypethathasanextentof9(from-3to5,5included),andcontainsanintegeratdisplacement0.Thisdatatypehastypemap:sf{(lb,-3),(int,0),(ub,6)}.IfthistypeisreplicatedtwicebyacalltompifuncMPI_TYPE_CONTIGUOUS(2,type1,type2)thensftype2hastypemap:sf{(lb,-3),(int,0),(int,9),(ub,15)}.(Anentryoftypesflbcanbedeletedifthereisanotherentryoftypesflbataloweraddress;andanentryoftypesfubcanbedeletedifthereisanotherentryoftypesfubatahigheraddress.){example}/; $cached_env_img{$key} =''; $key = q/{users}NotethedifferencebetweenmpifuncMPI_RECVandmpifuncMPI_UNPACK:inmpifuncMPI_RECV,thempiargcountargumentspecifiesthemaximumnumberofcomponentsthatcanbereceived.InmpiargMPI_UNPACK,thempiargcountargumentspecifiestheactualnumberofcomponentsthatareunpacked;Thereasonforthatchangeisthat,foraregularreceive,theincomingmessagesizedeterminesthenumberofcomponentsthatwillbereceived.WithmpifuncMPI_UNPACK,itisuptotheusertospecifyhowmanycomponentsheorshewantstounpack,sinceonemaywanttounpackonlypartofthemessage.{users}/; $cached_env_img{$key} =''; $key = q/{rationale}ThedefinitionoffuncMPI_ALLTOALLVgivesasmuchflexibilityasonewouldachievebyspecifyingateachprocessttnindepent,point-to-pointcommunications,withtheexceptionthatallmessagesusethesamedatatype.{rationale}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeladvcoll-exWThisexampleusesauser-definedoperationtoproduceaemsegmentedscan.Asegmentedscantakes,asinput,asetofvaluesandasetoflogicals,cindexscan,segmentedandthelogicalsdelineatethevarioussegmentsofthescan.Forexample:(arraylccccccccvalues;html_special_mark_amp;v_1;html_special_mark_amp;v_2;html_special_mark_amp;v_3;html_special_mark_amp;v_4;html_special_mark_amp;v_5;html_special_mark_amp;v_6;html_special_mark_amp;v_7;html_special_mark_amp;v_8logicals;html_special_mark_amp;0;html_special_mark_amp;0;html_special_mark_amp;1;html_special_mark_amp;1;html_special_mark_amp;1;html_special_mark_amp;0;html_special_mark_amp;0;html_special_mark_amp;1result;html_special_mark_amp;v_1;html_special_mark_amp;v_1+v_2;html_special_mark_amp;v_3;html_special_mark_amp;v_3+v_4;html_special_mark_amp;v_3+v_4+v_5;html_special_mark_amp;v_6;html_special_mark_amp;v_6+v_7;html_special_mark_amp;v_8array)noindentTheoperatorthatproducesthiseffectis,(left(arraycuiarrayright)circleft(arraycvjarrayright)=left(arraycwjarrayright),)noindentwhere,(w=left{arrayllu+v;html_special_mark_amp;mboxif$i=j$v;html_special_mark_amp;mboxif$ineqj$arrayright..)noindentNotethatthisisanon-commutativeoperator.Ccodethatimplementsitisgivenbelow.fileinclude..codesadvcoll-10.c{example}/; $cached_env_img{$key} =''; $key = q/{rationale}Bothargumentsaredefinedtobeoftypeconstvoid*(ratherthanconstvoid*andconstvoid**,respectively),soastoavoidcomplextypecasts.E.g.,inthelastexample,mpiarg&buff,whichisoftypeconstchar**,canbepassedasanargumenttompifuncMPI_Buffer_detachwithouttypecasting.Iftheformalparameterhadtypeconstvoid**thenonewouldneedatypecastbeforeandafterthecall.{rationale}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemthecallusesbutdoesnotupdateanargumentmarkedtypeIN,itemthecallmayupdateanargumentmarkedtypeOUT,itemthecallbothusesandupdatesanargumentmarkedtypeINOUT.{bulletlist}/; $cached_env_img{$key} =''; $key = q/{}$lb${}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exAaPreviousexamplemodified--onlytherootallocatesmemoryforthereceivebuffer.fileinclude..codescoll-3.c{example}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_0,disp_0+sfstridecdotex),ldots,(type_n-1,disp_n-1+sfstridecdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_ISSEND(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofelementsinsbufferfuncargINdatatypedatatypeofeachsbufferelementfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-xposeTransposeamatrix.Todoso,wecreateadatatypethatdescribesthematrixlayoutinrow-majororder;westhematrixwiththisdatatypeandreceivethematrixinnatural,column-majororder.fileinclude..codesadvpt2pt-xpose.f{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-progress-nonblock.fAnillustrationofprogresssemantics.fileinclude..codespt2pt-progress-nonblock.fnoindentThisprogramissafeandshouldnotdeadlock.Thefirstsofprocesszeromustcompleteafterprocessonepoststhematching(nonblocking)receiveevenifprocessonehasnotyetreachedthecalltofuncMPI_WAIT.Thus,processzerowillcontinueandexecutetheseconds,allowingprocessonetocompleteexecution.{example}/; $cached_env_img{$key} =''; $key = q/{figure}verbatim3labelfig:nomatch{figure}/; $cached_env_img{$key} =''; $key = q/{implementors}AnMPIimplementationmayuseerrorclassesastheerrorcodesreturnedbysomeorallMPIfunctions.Anotherchoiceistouseerrorclassesas``majorerrorcodes'',extedwithadditionalbitsthatprovide``minor''errorcodes.Then,thempifuncMPI_ERROR_CLASSfunctionmerelyneedstotruncatethefullerrorcode.ImplementationsmaygobeyondthisdocumentinsupportingMPIcallsthataredefinedheretobeerroneous.Forexample,MPIspecifiesstricttypematchingrulesbetweenmatchingsandreceiveoperations:itiserroneoustosafloatingpointvariableandreceiveaninteger.Implementationsmaygobeyondthesetypematchingrules,andprovideautomatictypeconversioninsuchsituations.Itwillbehelpfultogeneratewarningsforsuchnonconformingbehavior.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_REDUCE(sbuf,recvbuf,count,datatype,op,root,comm)funcargINsbufaddressofsbufferfuncargOUTrecvbufaddressofreceivebufferfuncargINcountnumberofelementsinsbufferfuncargINdatatypedatatypeofelementsofsbufferfuncargINopreduceoperationfuncargINrootrankofrootprocessfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}ThefunctionfuncMPI_CART_SUB(comm,remain_dims,comm-_new)canbeimplementedbyacalltofuncMPI_COMM_SPLIT(comm,color,key,comm-_new),usingasinglenumberencodingofthelostdimensionsasttcolorandasinglenumberencodingofthepreserveddimensionsasttkey.Inaddition,thenewtopologyinformationhastobecached.{implementors}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_RANGE_EXCL(group,n,ranges,newgroup)funcargINgroupgroupfuncargINnnumberofelementsinarrayranksfuncargINrangesanarrayofintegertripletsoftheform(firstrank,lastrank,stride),indicatingtheranksinmpiarggroupofprocessestobeexcludedfromtheoutputgroupmpiargnewgroup.funcargOUTnewgroupnewgroupderivedfromabove,preservingtheorderinmpiarggroup{funcdef}/; $cached_env_img{$key} =''; $key = q/{figure}vboxto7trueinvfilspecialpsfile=..figurescoll-fig1.pslabelfig:collcom{figure}/; $cached_env_img{$key} =''; $key = q/{users}IfabufferoftypetypeMPI_BYTEispassedasanargumenttocindextypeMPI_BYTEcoindexMPI_BYTEmpifuncMPI_SEND,thenMPIwillsthedatastoredatcontiguouslocations,startingfromtheaddressindicatedbythempiargbufargument.Thismayhaveunexpectedresultswhenthedatalayoutisnotasacasualuserwouldexpectittobe.Forexample,someFortrancompilersimplementvariablesoftypeftypeCHARACTERasastructurethatcontainsthecharacterlengthandapointertotheactualstring.Insuchanenvironment,singandreceivingaFortranftypeCHARACTERvariableusingtheconstMPI_BYTEtypewillnotcoindexMPI_BYTEhavetheanticipatedresultoftransferringthecharacterstring.Forthisreason,theuserisadvisedtousetypedcommunicationswheneverpossible.{users}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GROUP_TRANSLATE_RANKS(group1,n,ranks1,group2,ranks2)funcargINgroup1group1funcargINnnumberofranksinmpiargranks1andmpiargranks2arraysfuncargINranks1arrayofzeroormorevalidranksingroup1funcargINgroup2group2funcargOUTranks2arrayofcorrespondingranksingroup2{funcdef}/; $cached_env_img{$key} =''; $key = q/{tabular}|p2.0in|l|l|hlineFunctionality;html_special_mark_amp;Intracommunicator;html_special_mark_amp;Intercommunicatorhline#ofgroups;html_special_mark_amp;1;html_special_mark_amp;2CommunicationSafety;html_special_mark_amp;Yes;html_special_mark_amp;YesCollectiveOperations;html_special_mark_amp;Yes;html_special_mark_amp;NoTopologies;html_special_mark_amp;Yes;html_special_mark_amp;NoCaching;html_special_mark_amp;Yes;html_special_mark_amp;Yeshline{tabular}/; $cached_env_img{$key} =''; $key = q/{users}funcMPI_COMM_CREATEprovidesameanstosubsetagroupofprocessesforthepurposeofseparateMIMDcomputation,withaseparatecommunicationspace.mpiargnewcomm,whichemergesfromfuncMPI_COMM_CREATEcanbeusedinsubsequentcallstofuncMPI_COMM_CREATE(orothercommunicatorconstructors)furthertosubdivideacomputationintoparallelsub-computations.AmoregeneralserviceisprovidedbyfuncMPI_COMM_SPLIT,below.{users}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-contigLetmpiargoldtypehavetypemap({(sfdouble,0),(sfchar,8)},)withextent16,andlet$mpiargcount=3$.Thetypemapofthedatatypereturnedbympiargnewtypeisdisplaymath{(sfdouble,0),(sfchar,8),(sfdouble,16),(sfchar,24),(sfdouble,32),(sfchar,40)},displaymaththatis,alternatingsfdoubleandsfcharelements,withdisplacements$0,8,16,24,32,40$.{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exminlocCEachprocesshasanarrayof30ttdoubles,inC.Foreachofthe30locations,computethevalueandrankoftheprocesscontainingthelargestvalue.fileinclude..codescoll-9.c{example}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinepsfigfigure=..figuresconc-cycle.ps,width=3.5inlabelfig:conc-cycle{figure}/; $cached_env_img{$key} =''; $key = q/{}$ttnewranks(i+1)=i,i=0,ldots,n-1${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurescoll-reduce.ps,height=6.50insmalllabelfig:coll-reduce{figure}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CART_RANK(comm,coords,rank)funcargINcommcommunicatorwithCartesianstructurefuncargINcoordsintegerarrayspecifyingtheCartesiancoordinatesofaprocessfuncargOUTrankrankofspecifiedprocess{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$buf+disp_i${}/; $cached_env_img{$key} =''; $key = q/{}$ncdotsfcount${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_SSEND_INIT(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriestosfuncargINdatatypedatatypeofeachentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{implementors}Implementorsshouldprovideinformationonthe``default''alignmentoptionusedbytheMPIlibrarytodefineupperboundandextent.Thisshouldmatch,wheneverpossible,the``default''alignmentoptionofthecompiler.{implementors}/; $cached_env_img{$key} =''; $key = q/{}$addr_i,j=sfbuf+extentcdoti+disp_j${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_REMOTE_GROUP(comm,group)funcargINcommintercommunicatorfuncargOUTgroupremotegroupcorrespondingtompiargcomm{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$1+8times6+7=56${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_PROBE(source,tag,comm,status)funcargINsourcerankofsourcefuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTstatusstatusobject{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_START(request)funcargINOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$mpiargrank=6${}/; $cached_env_img{$key} =''; $key = q/{implementors}ACinterfaceshouldbeassumedforcopyanddeletefunctionsassociatedwithkeyvaluescreatedinC;aFortrancallinginterfaceshouldbeassumedforkeyvaluescreatedinFortran.{implementors}/; $cached_env_img{$key} =''; $key = q/{implementors}InordertoimplementfuncMPI_INTERCOMM_MERGE,funcMPI_COMM_FREEandfuncMPI_COMM_DUP,itisnecessarytosupportcollectivecommunicationwithinthetwogroupsaswellascommunicationbetweenthetwogroups.OnepossiblemechanismistocreateadatastructurethatwillallowonetoruncodesimilartothatusedforfuncMPI_INTERCOMM_CREATE:Aprivatecommunicationdomainforeachgroup,aleaderforeachgroup,andaprivatebridgecommunicationdomainforthetwoleaders.{implementors}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-vectorAsbefore,assumethatmpiargoldtypehastypemap({(sfdouble,0),(sfchar,8)},)withextent16.AcalltompifuncMPI_TYPE_VECTOR(2,3,4,oldtype,newtype)willcreatethedatatypewithtypemapdisplaymath{(sfdouble,0),(sfchar,8),(sfdouble,16),(sfchar,24),(sfdouble,32),(sfchar,40),displaymathvspace-0.6cmdisplaymath(sfdouble,64),(sfchar,72),(sfdouble,80),(sfchar,88),(sfdouble,96),(sfchar,104)}.displaymathThatis,twoblockswiththreecopieseachoftheoldtype,withastrideof4elements($4times16$bytes)betweentheblocks.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TESTANY(count,array_of_requests,index,flag,status)funcargINcountlistlengthfuncargINOUTarray_of_requestsarrayofrequesthandlesfuncargOUTindexindexofrequesthandlethatcompletedfuncargOUTflagconsttrueifonehascompletedfuncargOUTstatusstatusobject{funcdef}/; $cached_env_img{$key} =''; $key = q/{}(2^30-1){}/; $cached_env_img{$key} =''; $key = q/{}(Typemap={(type_0,disp_0),ldots,(type_n-1,disp_n-1)},){}/; $cached_env_img{$key} =''; $key = q/{}$type_j${}/; $cached_env_img{$key} =''; $key = q/{constlist}constitemFortran:constitemNameDescriptionconstitemconstMPI_2REALpairofftypeREALsconstitemconstMPI_2DOUBLE_PRECISIONpairofftypeDOUBLEPRECISIONvariablesconstitemconstMPI_2INTEGERpairofftypeINTEGERs{constlist}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeltopol-exEAssumethatfuncMPI_CART_CREATE6hasdefineda$(2times3times4)$grid.Letttremain_dims=(true,false,true).Thenacallto,verbatim12willcreatethreecommunicatorseachwitheightprocessesina$2times4$Cartesiantopology.Ifttremain_dims=(false,false,true)thenthecalltofuncMPI_CART-_SUB(comm,remain-_dims,comm-_new)willcreatesixnon-overlappingcommunicators,eachwithfourprocesses,inaone-dimensionalCartesiantopology.{example}/; $cached_env_img{$key} =''; $key = q/{}$mpiargrank=3${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_SIZE(datatype,size)funcargINdatatypedatatypefuncargOUTsizedatatypesize{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$A_0${}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figuresmycoll-fig2.ps,width=3.50insmalllabelfig-coll-exA{figure}/; $cached_env_img{$key} =''; $key = q/{rationale}Aswithcollectivecommunications,thevirtualtopologyfeaturescanbelayeredontopofpoint-to-pointandcommunicatorfunctionality.Bydoingthis,alayeredimplementationispossible,thoughnotrequired.Aconsequenceofthisdesignisthattopologyinformationisnotgivendirectlytopoint-to-pointnorcollectiveroutines.Instead,thetopologyinterfaceprovidesfunctionstotranslatebetweenthevirtualtopologyandtheranksusedinMPIcommunicationroutines.{rationale}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+sfstridecdot(sfcount-1)cdotex),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{displaymath}{(type_0^0,disp_0^0+mpiargD[0]),ldots,(type_n_0^0,disp_n_0^0+mpiargD[0]),ldots,{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_WAITSOME(incount,array_of_requests,outcount,array_of_indices,array-_of-_statuses)funcargINincountlengthofarray_of_requestsfuncargINOUTarray_of_requestsarrayofrequesthandlesfuncargOUToutcountnumberofcompletedrequestsfuncargOUTarray_of_indicesarrayofindicesofcompletedoperationsfuncargOUTarray_of_statusesarrayofstatusobjectsforcompletedoperations{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_EXTENT(datatype,extent)funcargINdatatypedatatypefuncargOUTextentdatatypeextent{funcdef}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-excorr2Thefollowingiserroneous.fileinclude..codessemantics-7.cAssumethatthegroupofsfcomm0is{0,1},ofsfcomm1is{1,2}andofsfcomm2is{2,0}.Ifthebroadcastisasynchronizingoperation,thenthereisacyclicdepency:thebroadcastinsfcomm2completesonlyafterthebroadcastinsfcomm0;thebroadcastinsfcomm0completesonlyafterthebroadcastinsfcomm1;andthebroadcastinsfcomm1completesonlyafterthebroadcastinsfcomm2.Thus,thecodewilldeadlock.Collectiveoperationsmustbeexecutedinanordersothatnocyclicdepenciesoccur.{example}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-addressUsingfuncMPI_ADDRESSforanarray.ThevalueofttDIFFissettott909*sizeofreal,whilethevaluesofttI1andttI2areimplementationdepent.fileinclude..codesadvpt2pt-address.f{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_RANK(comm,rank)funcargINcommcommunicatorfuncargOUTrankrankofthecallingprocessingroupofmpiargcomm{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$v${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_BARRIER(comm)funcargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$3times4${}/; $cached_env_img{$key} =''; $key = q/{displaymath}0=constMPI_SUCCESS;html_special_mark_lt;constMPI_ERR_...leqconstMPI_ERR_LASTCODE.{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}[htb]centerlinepsfigfigure=..figurespt2pt-Jacobi2.ps,width=5inlabelfig:pt2pt-Jacobi2{figure}/; $cached_env_img{$key} =''; $key = q/{bulletlist}itemAsequenceofprimitivedatatypesand,itemAsequenceofinteger(byte)displacements.{bulletlist}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:advpt2pt-typematchThisexampleshowsthattypematchingisdefinedonlyintermsoftheprimitivetypesthatconstituteaderivedtype.fileinclude..codesadvpt2pt-typematch.fEachofthessmatchesemanyofthereceives.{example}/; $cached_env_img{$key} =''; $key = q/{}$mpiargnedges=6${}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exminlocC2Eachprocesshasanon-emptyarrayofvalues.Findtheminimumglobalvalue,therankoftheprocessthatholdsitanditsindexonthisprocess.fileinclude..codescoll-11.c{example}/; $cached_env_img{$key} =''; $key = q/{rationale}ThedefinitionoffuncMPI_ALLTOALLgivesasmuchflexibilityasonewouldachievebyspecifyingateachprocessttnindepent,point-to-pointcommunications,withtwoexceptions:allmessagesusethesamedatatype,andmessagesarescatteredfrom(orgatheredto)sequentialstorage.{rationale}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-Jacobi-nullprocJacobicode--versionofparallelcodeusingsrecvandnullprocesses.fileinclude..codespt2pt-Jacobi-nullproc.fnoindentTheboundarytestthatwaspreviouslyexecutedinsidetheloophasbeeneffectivelymovedoutsidetheloop.Althoughthisisnotexpectedtochangeperformancesignificantly,thecodeissimplified.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_RSEND(buf,count,datatype,dest,tag,comm)funcargINbufinitialaddressofsbufferfuncargINcountnumberofentriesinsbufferfuncargINdatatypedatatypeofeachsbufferentryfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$n${}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CART_CREATE(comm_old,ndims,dims,periods,reorder,comm_cart)funcargINcomm_oldinputcommunicatorfuncargINndimsnumberofdimensionsofCartesiangridfuncargINdimsintegerarrayofsizempiargndimsspecifyingthenumberofprocessesineachdimensionfuncargINperiodslogicalarrayofsizempiargndimsspecifyingwhetherthegridisperiodic(consttrue)ornot(constfalse)ineachdimensionfuncargINreorderranksmaybereordered(consttrue)ornot(constfalse)funcargOUTcomm_cartcommunicatorwithnewCartesiantopology{funcdef}/; $cached_env_img{$key} =''; $key = q/{}(k=left{arraylli;html_special_mark_amp;mboxif$u;html_special_mark_gt;v$min(i,j);html_special_mark_amp;mboxif$u=v$j;html_special_mark_amp;mboxif$u;html_special_mark_lt;v$arrayright.){}/; $cached_env_img{$key} =''; $key = q/{example}rmlabeladvcoll-exXComputetheproductofanarrayofcomplexnumbers,inC.fileinclude..codesadvcoll-9.c{example}/; $cached_env_img{$key} =''; $key = q/{rationale}Thisfunctionisequivalenttoaccessingthecommunicator'sgroupwithmpifuncMPI_COMM_GROUP(seeabove),computingtherankusingmpifuncMPI_GROUP_RANK,andthenfreeingthegrouptemporaryviampifuncMPI_GROUP_FREE.However,thisfunctionissocommonlyused,thatthisshortcutwasintroduced.{rationale}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CART_SHIFT(comm,direction,disp,rank_source,rank_dest)funcargINcommcommunicatorwithCartesianstructurefuncargINdirectioncoordinatedimensionofshiftfuncargINdispdisplacement($;html_special_mark_gt;0$:upwardsshift,$;html_special_mark_lt;0$:downwardsshift)funcargOUTrank_sourcerankofsourceprocessfuncargOUTrank_destrankofdestinationprocess{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_COMM_TEST_INTER(comm,flag)funcargINcommcommunicatorfuncargOUTflagtrueifcommisintercommunicator{funcdef}/; $cached_env_img{$key} =''; $key = q/{}$sum_i=0^sfc-1mpiargB[i]cdotn_i${}/; $cached_env_img{$key} =''; $key = q/{rationale}ThedefinitionoffuncMPI_GET_COUNTisconsistentwiththeuseofthempiargcountargumentinthereceivecall:thefunctionreturnsthevalueofthempiargcountargument,whenthereceivebufferisfilled.Sometimesmpiargdatatyperepresentsabasicunitofdataonewantstotransfer.Oneshouldbeabletofindouthowmanycomponentswerereceivedwithoutbotheringtodividebythenumberofelementsineachcomponent.ThefuncMPI_GET_COUNTisusedinsuchcases.However,onotheroccasions,mpiargdatatypeisusedtodefineacomplexlayoutofdatainthereceivermemory,anddoesnotrepresentabasicunitofdatafortransfers.Insuchcases,onemustusefuncMPI_GET_ELEMENTS.{rationale}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinepsfigfigure=..figuresprof-resolve-weak.ps,width=hsizelabelfig:prof-resolve-weak{figure}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelex:pt2pt-safeAnexchangeofmessages.fileinclude..codespt2pt-safe.fnoindentThisprogramsucceedsevenifnobufferspacefordataisavailable.Theprogramissafeandwillalwayscompletecorrectly.{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_CANCEL(request)funcargINrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n_sfc-1-1^sfc-1,disp_n_sfc-1-1^sfc-1+mpiargD[c-1]+(mpiargB[c-1]-1)cdotex_sfc-1)}.{displaymath}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_INDEXED(count,array_of_blocklengths,array_of_displacements,oldtype,newtype)funcargINcountnumberofblocksfuncargINarray_of_blocklengthsnumberofelementsperblockfuncargINarray_of_displacementsdisplacementforeachblock,measuredasnumberofelementsfuncargINoldtypeolddatatypefuncargOUTnewtypenewdatatype{funcdef}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_GET_ELEMENTS(status,datatype,count)funcargINstatusstatusofreceivefuncargINdatatypedatatypeusedbyreceiveoperationfuncargOUTcountnumberofprimitiveelementsreceived{funcdef}/; $cached_env_img{$key} =''; $key = q/{}(w=max(u,v)){}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_IBSEND(buf,count,datatype,dest,tag,comm,request)funcargINbufinitialaddressofsbufferfuncargINcountnumberofelementsinsbufferfuncargINdatatypedatatypeofeachsbufferelementfuncargINdestrankofdestinationfuncargINtagmessagetagfuncargINcommcommunicatorfuncargOUTrequestrequesthandle{funcdef}/; $cached_env_img{$key} =''; $key = q/{displaymath}(type_n-1,disp_n-1+(mpiargD[count-1]+mpiargB[count-1]-1)cdotex)}.{displaymath}/; $cached_env_img{$key} =''; $key = q/{figure}centerlinehboxpsfigfigure=..figurestopol-fig3.eps,width=5.5incoindexMPI_PROC_NULLlabelfig:topol-fig3{figure}/; $cached_env_img{$key} =''; $key = q/{rationale}ThedifferencebetweenconstMPI_ERR_UNKNOWNandconstMPI_ERR_OTHERiscoindexMPI_ERR_UNKNOWNcoindexMPI_ERR_OTHERthatfuncMPI_ERROR_STRINGcanreturnusefulinformationaboutconstMPI_ERR_OTHER.NotethatconstMPI_SUCCESSdisplaymath$=0displaymathisnecessarytobecoindexMPI_SUCCESSconsistentwithCpractice.ThevalueofconstMPI_ERR_LASTCODEcanbeusedforerror-checking,orforselectingerrorcodesforlibrariesthatdonotconflictwithMPIerrorcodes.{rationale}/; $cached_env_img{$key} =''; $key = q/{example}rmlabelcoll-exblas1Aroutinethatcomputesthedotproductoftwovectorsthataredistributedacrossagroupofprocessesandreturnstheansweratnodezero.fileinclude..codescoll-7.f{example}/; $cached_env_img{$key} =''; $key = q/{funcdef}MPI_TYPE_HVECTOR(count,blocklength,stride,oldtype,newtype)funcargINcountnumberofblocksfuncargINblocklengthnumberofelementsineachblockfuncargINstridespacingbetweenstartofeachblock,measuredasbytesfuncargINoldtypeolddatatypefuncargOUTnewtypenewdatatype{funcdef}/; $cached_env_img{$key} =''; 1;