Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Bug in return status of MPI_WAIT()?
From: Katz, Jacob (jacob.katz_at_[hidden])
Date: 2009-05-12 10:49:30


Ah... Thanks, Jeff.
If the standard would explicitly mention that MPI::ERRORS_RETURN is useless with C++ binding, life would be a little easier...

--------------------------------
Jacob M. Katz | jacob.katz_at_[hidden] | Work: +972-4-865-5726 | iNet: (8)-465-5726

-----Original Message-----
From: users-bounces_at_[hidden] [mailto:users-bounces_at_[hidden]] On Behalf Of Jeff Squyres
Sent: Tuesday, May 12, 2009 16:37
To: Open MPI Users
Subject: Re: [OMPI users] Bug in return status of MPI_WAIT()?

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
MPI_STATUS argument)."

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
MPI_WAIT.

On May 10, 2009, at 5:51 AM, Katz, Jacob wrote:

> Hi,
> 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 wasn't.
> The issue didn't happen when using blocking recv.
>
> A bug or my incorrect usage?
>
> Thanks!
>
> // 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[100] = "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);
> r.Wait(stat);
> if (stat.Get_error() != MPI::SUCCESS)
> {
> cout << "0: Error during recv" << endl;
> }
> }
> else
> {
> MPI::COMM_WORLD.Send(buf, 2, MPI_CHAR, 0, 0);
> }
>
> MPI::Finalize();
> return (0);
> }
>
> --------------------------------
> Jacob M. Katz | jacob.katz_at_[hidden] | Work: +972-4-865-5726 | iNet:
> (8)-465-5726
>
> ---------------------------------------------------------------------
> 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
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

--
Jeff Squyres
Cisco Systems
_______________________________________________
users mailing list
users_at_[hidden]
http://www.open-mpi.org/mailman/listinfo.cgi/users
---------------------------------------------------------------------
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.