Opened 12 years ago

Closed 12 years ago

Last modified 9 years ago

#4348 closed Bugs (invalid)

[Boost.MPI] wait_any and wait_some don't wait at all

Reported by: Didier Devaurs <ddevaurs@…> Owned by: anonymous
Milestone: Boost 1.43.0 Component: mpi
Version: Boost 1.43.0 Severity: Problem
Keywords: Cc:

Description

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.

int main() {

boost::mpi::environment environment;

boost::mpi::communicator world;

int processNumber = world.size();

if (world.rank() == 0) {

boost::mpi::request requests[processNumber];

for (int source = 1; source < processNumber; ++source)

requests[source] = world.irecv(source, 0);

std::cout << boost::mpi::wait_any(requests, requests + processNumber).first.source();

} return 0;

}

Didier Devaurs

Change History (3)

comment:1 by Didier Devaurs <ddevaurs@…>, 12 years ago

Owner: changed from Douglas Gregor to anonymous
Status: newassigned

comment:2 by Didier Devaurs <ddevaurs@…>, 12 years ago

Resolution: invalid
Status: assignedclosed

in reply to:  2 comment:3 by christopher.bignamini@…, 9 years ago

Replying to Didier Devaurs <ddevaurs@…>:

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?

Christopher Bignamini

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<numberOfTasks;++taskId) {

  receiveRequest[taskId-1] = mpiCommunicator.irecv(taskId,
                                                  taskId,
                                                  &slaveData[taskId-1],
                                                  1);
 }

 unsigned int numberOfReceivedContributions(0);
 
 do {

  const mpi::status& 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<numberOfTasks-1);

 delete [] slaveData;
 delete [] receiveRequest;

}
else{

 double dataTmp(...);
 mpiCommunicator.send(0,mpiCommunicator.rank(),dataTmp);

}

Note: See TracTickets for help on using tickets.