文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > An Event-driven Architecture for MPI Libraries
侵权投诉

An Event-driven Architecture for MPI Libraries

Existing MPI libraries couple the progress of message transmission or reception with library invocations by the user application. Such coupling allows for simplicity of implementation, but may increase communication latency and waste CPU resources. This pa

Remaining fragmentsof message A arrive

RTS

MPI_Recv(A)

Application postsa blocking

rendezvous receive

First fragment of Aarrives from peer

CTS for Asent back topeer

Receive requestfor A complete

Figure1.TherendezvousmessagetransferprotocolataLA-MPIreceivernode

ForcommunicationintheTCPpath,thelibraryusesatleastonebidirectionalTCPconnectionbetweeneachpairofcommunicatingnodes.Theseconnectionsarenotes-tablishedduringinitialization.Rather,theyareestablishedonlywhenthereisanactualsendrequesttoanodethatdoesnotalreadyhaveanopenconnectiontothesendingnode.Onceaconnectionisestablished,itremainsopenforfuturecommunication,unlessanerroronthesocketcausestheoperatingsystemtodestroyit.Inthatcase,anewcon-nectionwouldbeestablishedforfuturemessagesbetweenthosenodes.

operation.Onthereceivernode,thereceptionofthesefrag-mentscompletesthereceiveoperation.

WhentheTCPprogressroutineprocessesthewriteevent(becausethereisspaceavailableinthesocketbufferforwriting),the rstfragmentissentfromthesendqueueandthewriteeventisremovedfromtheeventlist.This rstfragmentservesasaRTSmessagetothereceiver.ThesenderthenaddsareadeventforthisconnectiontowaitfortheCTSmessage,whichthereceiversendswhenitisreadytoreceivetherestofthemessage.NotethattheuseofRTS/CTSisnotstrictlynecessaryinTCPfor owcontrol,asthesocketbufferprovidesimplicit owcontrol.Ifthereceiverisnotreadytoreceivethemessage,thereceiver’ssocketbufferwill llup,andTCP owcontrolwillstopthesenderfromsendingfurtherdata.However,TCPdoesnotallowthereceivertoreordermessageswithinthesameconnection,sothelibraryreliesonRTS/CTSmessagestoachievethis.NotethatTCPdoesallowthereceivertore-ordermessagesfromdifferentsenderstriviallysincetheyareusingdifferentconnections.Oncetheclear-to-sendhasbeenreceived,thewriteeventisplacedbackonthewriteeventlistuntilallfragmentsinthesendqueuehavebeensent.Dependingonthesizeofthemessageandthesizeofthesocketbuffer,thiscouldrequirenumerousinvocationsoftheappropriatecallbackroutine.

TheTCPpathmarksasendrequestascompletewhenallthefragmentsofthatsendmessagehavebeenenqueuedonthesocketbuffer.SinceTCPguaranteesdeliveryofthemessagetothereceiver,theTCPpathofLA-MPIitselfdoesnotprovideanyadditionalreliabilityfeatures,insteadrely-ingpurelyonthereliabilitymechanismsprovidedbytheTCPprotocol.Completionofasendrequestsignalstheli-brarytoreleasealloftheresourcesheldforthismessageandtonotifytheapplicationappropriately.

2.2SendingMessages

TheTCPpathstartsthesendprocessonamessageby rstfragmentingit—the rstfragmentis16KBinsize,andallsubsequentfragmentsare64KB.Eachmessagefragmentincludesaheadertoallowthereceivingnodetoidentifythefragment.Thefragments,alongwiththeirheaders,areplacedonasendqueuewithinthelibrarypriortobeingsentoverthenetwork.Awriteeventfortheappropriatecon-nectionisthenaddedtothewriteeventlisttoindicatethatthereisdatainthesendqueuewaitingtobesent.TheMPIspeci cationdoesnotstrictlyrequirefragmentation,butithelpstolimitthenecessarybufferingonthereceivingnode.Ifthemessageissmallenough(<16KB),itissentasasinglefragmentdirectlytothedestination.Thisistheea-gerprotocol,asthesenderdoesnotrequestpermissionfromthereceivertosendthemessage.Largermessagesaresentusingtherendezvousprotocolwhichinvolvesarequest-to-send(RTS)andclear-to-send(CTS)messageexchangebe-tweenthepeersbeforethesendercansendthewholemes-sagetothereceiver.Figure1showsthestepsofthisren-dezvousprotocolatthereceivernode.Thesenderiniti-atesthisprotocolbysendingthe rstfragmentofamulti-fragmentmessage,whichalsoservesastheRTSmessage,tothereceiver.Asdepictedinthe gure,thereceiverre-ceivesthismessageandifthecorrespondingMPIreceivehasalreadybeenposted,sendsaCTSmessagebacktothesender.Thesender,onreceivingtheCTSmessage,sendstheremainingfragmentstothereceivertocompletethesend

3

2.3ReceivingMessages

Messagereceivesalsousenetworkevents,asinthesendcase.However,thereisanadditionalcomplicationinthatreceivedmessagescaneitherbeexpectedorunexpected,sincetheapplicationmayormaynothavenoti edtheli-brarythatitiswaitingforaparticularmessage(posteda

上一页第3页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email