<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<div>Dear All:</div><div><br></div><div>How to do asynchronous communication among nodes by MPI in cluster ?</div><div><br></div><div>I need to set up a kind of asychronous communication protocol such that </div><div>message senders and receivers can communicate asynchronously without losing any</div><div>messages between them. </div><div><br></div><div>I do not want to use blocking MPI routines because the processors can do other</div><div>operations when they wait for new messages coming.</div><div><br></div><div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">This is the main part of my code, which have a deadlock. </div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">The worker can receives message from master but master cannot get message from workers.</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">It is blocked by the <span class="Apple-style-span" style="font-size: 13.3333px; ">mpi::wait_all().</span></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">Master: </div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">for (iRank = 0; iRank < availableRank ; iRank++)</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">{</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">destRank = iRank+1;</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">for (taski = 1; taski <= TaskNumPerRank ; taski++)</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">{</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">resultSourceRank = destRank;</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">recvReqs[taskCounterT2] = world.irecv(resultSourceRank, upStreamTaskTag, resultTaskPackageT2[iRank][taskCounterT3]);</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">reqs = world.isend(destRank, taskTag, myTaskPackage);</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">++taskCounterT2;</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">}</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">// taskTotalNum = availableRank * TaskNumPerRank </div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">// right now, availableRank =1, TaskNumPerRank =2</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">mpi::wait_all(recvReqs, recvReqs+(taskTotalNum));</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">-----------------------------------------------</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">worker: </div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">while (1)</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">{</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">world.recv(managerRank, downStreamTaskTag, resultTaskPackageW);</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">do its local work on received task;</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">destRank = masterRank;</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "><br></div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">reqs = world.isend(destRank, taskTag, myTaskPackage);</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">if (recv end signal)</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); "> <span class="ecxApple-tab-span" style="white-space: pre; "> </span>break;</div><div style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13.3333px; color: rgb(68, 68, 68); ">}</div></div><div><br></div><div>Any help is appreciated. </div><div><br></div><div>thanks</div><div><br></div><div>Jack </div><div><br></div><div>June 27 2010</div> <br /><hr />The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. <a href='http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5' target='_new'>Get busy.</a></body>
</html>