Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPI] request::test() crashes or returns garbage
From: Riccardo Murri (riccardo.murri_at_[hidden])
Date: 2011-11-18 08:59:15


Hi Patrik,

On Thu, Nov 17, 2011 at 00:09, Patrik Jonsson
<patrik-web_at_[hidden]> wrote:
> I'm having some problem with nonblocking p2p communications. This is
> with boost 1.47 and openmpi-1.5.3 compiled with icpc 12.0.3.

I tried to run your example on my Ubuntu 11.04 box (GCC 4.5.2, OpenMPI
1.4.3, both coming from the main Ubuntu packages) and get no error:

    $ mpirun -np 3 --gmca btl tcp,self ./a.out
    Task 2 posting recv from 0
    Task 2 sending to 0
    Task 0 posting recv from 1
    Task 1 posting recv from 0
    Task 0 sending to 1
    Task 1 sending to 0
    Task 2 posting recv from 1
    Task 2 sending to 1
    Task 0 posting recv from 2
    Task 0 sending to 2
    Task 1 posting recv from 2
    Task 1 sending to 2
    Task 1 received message tag 13 from task 0
    Task 2 received message tag 13 from task 1
    Task 1 received message tag 13 from task 2

I have tried up to "-np 8" without any problem.

Note that the final loop does not receive all pending messages, but
that's because the final "for" loop only does one pass over
"handshake_reqs_". If I substitute it with the following, all
messages are received correctly:

    // receive all messages in final loop
    while (not handshake_reqs_.empty()) {
      int i = 0;
      while(i<handshake_reqs_.size()) {
        boost::optional<status> s=handshake_reqs_[i].test();
        if(s.is_initialized()) {
          const int source_task = s.get().source();
          const int tag = s.get().tag();
          printf("Task %d received message tag %d from task %d\n",
                 me, tag, source_task);
          cout.flush();
          handshake_reqs_.erase(handshake_reqs_.begin()+i);
          ++i;
        };
      };
    };

    # sample output
    $ mpirun -np 3 --gmca btl tcp,self ./a.out
    Task 0 posting recv from 1
    Task 0 sending to 1
    Task 1 posting recv from 0
    Task 2 posting recv from 0
    Task 2 sending to 0
    Task 0 posting recv from 2
    Task 0 sending to 2
    Task 1 sending to 0
    Task 2 posting recv from 1
    Task 2 sending to 1
    Task 1 posting recv from 2
    Task 1 sending to 2
    Task 2 received message tag 13 from task 0
    Task 2 received message tag 13 from task 1
    Task 0 received message tag 13 from task 1
    Task 0 received message tag 13 from task 2
    Task 1 received message tag 13 from task 0
    Task 1 received message tag 13 from task 2

Best regards,
Riccardo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net