Boost C++ Libraries: Ticket #4348: [Boost.MPI] wait_any and wait_some don't wait at all https://svn.boost.org/trac10/ticket/4348 <p> Hello, The functions wait_any and wait_some don't work properly. If they were really waiting for a request to be completed (like wait_all is doing) the program below would hang indefinitely. Currently, the function wait_any tests the requests, and since none is completed, returns -1. So it simply implements a test_all function. </p> <p> int main() { </p> <blockquote> <p> boost::mpi::environment environment; </p> </blockquote> <blockquote> <p> boost::mpi::communicator world; </p> </blockquote> <blockquote> <p> int processNumber = world.size(); </p> </blockquote> <blockquote> <p> if (world.rank() == 0) { </p> <blockquote> <p> boost::mpi::request requests[processNumber]; </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> for (int source = 1; source &lt; processNumber; ++source) </p> <blockquote> <p> requests[source] = world.irecv(source, 0); </p> </blockquote> <p> std::cout &lt;&lt; boost::mpi::wait_any(requests, requests + processNumber).first.source(); </p> </blockquote> <p> } return 0; </p> </blockquote> <p> } </p> <p> Didier Devaurs </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4348 Trac 1.4.3 Didier Devaurs <ddevaurs@…> Fri, 18 Jun 2010 06:56:51 GMT owner, status changed https://svn.boost.org/trac10/ticket/4348#comment:1 https://svn.boost.org/trac10/ticket/4348#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Douglas Gregor</span> to <span class="trac-author-anonymous">anonymous</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Didier Devaurs <ddevaurs@…> Fri, 18 Jun 2010 06:57:48 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4348#comment:2 https://svn.boost.org/trac10/ticket/4348#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket christopher.bignamini@… Wed, 23 Oct 2013 15:03:38 GMT <link>https://svn.boost.org/trac10/ticket/4348#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4348#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4348#comment:2" title="Comment 2">Didier Devaurs &lt;ddevaurs@…&gt;</a>: </p> <p> Hello, I am observing in the current boost release (1.54) in Boost MPI the same problem you described in the ticket (I have tried to your example). A similar problem is also observable by running the code below (sorry for bad indent), I guess due to the same bug(?) in the wait_any function (I hope that the rest of my code is bug free..). It is not clear to me if the ticket you have opened has been solved, did the developers fix the bug? </p> <p> Christopher Bignamini </p> <pre class="wiki"> mpi::communicator mpiCommunicator; const int taskId(mpiCommunicator.rank()); const int numberOfTasks(mpiCommunicator.size()); if(taskId==0){ double* slaveData = new double[numberOfTasks-1]; mpi::request* receiveRequest = new mpi::request[numberOfTasks-1]; for(int taskId=1;taskId&lt;numberOfTasks;++taskId) { receiveRequest[taskId-1] = mpiCommunicator.irecv(taskId, taskId, &amp;slaveData[taskId-1], 1); } unsigned int numberOfReceivedContributions(0); do { const mpi::status&amp; communicationStatus(mpi::wait_any(receiveRequest, receiveRequest + numberOfTasks - 1).first); if(communicationStatus.error()==0) { const int subDomainIndex(communicationStatus.source()); ++numberOfReceivedContributions; ...DO..SOMETHING WITH AVAILABLE DATA... } }while(numberOfReceivedContributions&lt;numberOfTasks-1); delete [] slaveData; delete [] receiveRequest; } else{ double dataTmp(...); mpiCommunicator.send(0,mpiCommunicator.rank(),dataTmp); } </pre> </description> <category>Ticket</category> </item> </channel> </rss>