Greetings Jacob; sorry for the slow reply.
This is pretty subtle, but I think that your test is incorrect (I
remember arguing about this a long time ago and eventually having
another OMPI developer prove me wrong! :-) ).
1. You're setting MPI_ERRORS_RETURN, which, if you're using the C++
bindings, means you won't be able to see if an error occurs because
they don't return the int error codes.
2. The MPI_ERROR field in the status is specifically *not* set for
MPI_TEST and MPI_WAIT. It *is* set for the multi-test/wait functions
(e.g., MPI_TESTANY, MPI_WAITALL). MPI-2.1 p52:44-48 says:
"Error codes belonging to the error class MPI_ERR_IN_STATUS should be
returned only by the MPI completion functions that take arrays of
MPI_STATUS. For the functions MPI_TEST, MPI_TESTANY, MPI_WAIT, and
MPI_WAITANY, which return a single MPI_STATUS value, the normal MPI
error return process should be used (not the MPI_ERROR field in the
So I think you need to use MPI::ERRORS_THROW_EXCEPTIONS to catch the
error in this case, or look at the return value from the C binding for
On May 10, 2009, at 5:51 AM, Katz, Jacob wrote:
> While trying error-related functionality of OMPI, I came across a
> situation where when I use MPI_ERRORS_RETURN error handler, the
> errors do not come out correctly from WAIT calls.
> The program below correctly terminates with a fatal message
> truncated error, but when the line setting the error handler to
> MPI_ERRORS_RETURN is uncommented, it silently completes. I expected
> the print out that checks the status after WAIT call to be executed,
> but it wasnt.
> The issue didnt happen when using blocking recv.
> A bug or my incorrect usage?
> // mpic++ -o test test.cpp
> // mpirun -np2 ./test
> #include "mpi.h"
> #include <iostream>
> using namespace std;
> int main (int argc, char *argv)
> int rank;
> char buf = "hmmmm";
> MPI::Status stat;
> MPI::Init(argc, argv);
> rank = MPI::COMM_WORLD.Get_rank();
> // MPI::COMM_WORLD.Set_errhandler(MPI::ERRORS_RETURN);
> if (rank == 0)
> MPI::Request r = MPI::COMM_WORLD.Irecv(buf, 1, MPI_CHAR,
> MPI::ANY_SOURCE, MPI::ANY_TAG);
> if (stat.Get_error() != MPI::SUCCESS)
> cout << "0: Error during recv" << endl;
> MPI::COMM_WORLD.Send(buf, 2, MPI_CHAR, 0, 0);
> return (0);
> Jacob M. Katz | jacob.katz_at_[hidden] | Work: +972-4-865-5726 | iNet:
> Intel Israel (74) Limited
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> users mailing list