[Boost-bugs] [Boost C++ Libraries] #10065: wait_any return with -1

Subject: [Boost-bugs] [Boost C++ Libraries] #10065: wait_any return with -1
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-21 13:20:42


#10065: wait_any return with -1
--------------------------------------------+---------------------
 Reporter: florian <boost_error_wait88@…> | Owner: troyer
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: mpi
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
--------------------------------------------+---------------------
 I have a small example, where every process send his rank to rank 0. The
 process with rank 0, should receive with ''irecv'' every message and wait
 for it with ''wait_any''. But the ''wait_any'' function returns with -1. I
 have seen two other tickets, which are marked as fixed/ solved. I think
 they are not solved. If they are solve the documentation should be
 changed, because if I make the same example with MPI_Waitany, the result
 is completely different.

 {{{
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <boost/mpi.hpp>
 #include <iostream>
 #include <string>
 #include <boost/serialization/string.hpp>
 #define MAXPROC 16 /* Max number of procsses */

 int main(int argc, char* argv[]) {
   int i, np, me, index;
   const int tag = 42; /* Tag value for communication */
   const int root = 0; /* Root process in broadcast */

   boost::mpi::status status; /* Status object for non-blocing
 receive */
   boost::mpi::request recv_req[MAXPROC]; /* Request objects for non-
 blocking receive */

   int myname[5]; /* Local host name string */
   int hostname[5]; /* Received host names */
   int namelen;

   boost::mpi::environment env; /* Initialize MPI */
   boost::mpi::communicator world; /* Initialize MPI */
   np = world.size(); /* Get nr of processes */
   me = world.rank(); /* Get own identifier */


   if (me == 0) { /* Process 0 does this */

             std::cout <<"Process " << me << " broadcasting to all
 processes\n";
                 boost::mpi::broadcast(world, me, 0);

             std::cout <<"Process " << me<< " receiving from all other
 processes\n";
             for (i=1; i<np; i++) {
                 recv_req[i] = world.irecv(i,i,hostname[i]);
             }

             for (i=1; i<np; i++) {

                 status = wait_any(recv_req,recv_req +5 ).first;
               std::cout<<"Received a message from process "<<
 status.source() << " tag " << status.tag() << std::endl;
             }
             std::cout <<"Ready\n";

   }
         else {
     int y;

         boost::mpi::broadcast(world, y, 0);
         sleep(me%3+1);

         MPI_Send (myname, namelen, MPI_CHAR, 0, tag, world);

   }
         world.barrier();

         ~world;
         return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10065>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC