LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Josh Hursey (jjhursey_at_[hidden])
Date: 2005-02-04 15:39:40


Every MPI function returns an integer value which represents
SUCCESS/ERROR of executing that function. The reason that they are
signed integers is, basicly, because the standard states that it should
be so. :-) Further, if an error is reached in MPI_Comm_rank, the code
needs to set the value of the variable to a negative number, since all
other values would possibly reference a valid rank. The most common
value returned here is MPI_UNDEFINED (which is -32766, in LAM/MPI),
which occurs if the process calling the function is not the in the
communicator group being referenced.

There are a few different ways to have your application behave on
error. The default error handler is MPI_ERRORS_ARE_FATAL, in which case
your program will abort through the same mechanism as MPI_Abort.
Another error handler is MPI_ERRORS_RETURN, which just returns the
error code. The third option is to write your own error handler. All
this is discussed in the LAM/MPI manual, and on the MPI Forum:
http://www.mpi-forum.org/docs/mpi-11-html/node148.html#Node148

Josh

On Feb 4, 2005, at 2:14 PM, Curry Matthew J CRBE wrote:

>
> Because they do return error codes, if something is wrong. I thought
> I remembered reading something in the standard about changing the
> behavior on an error, i.e., you can make it not do an MPI_Abort on
> error, IIRC.
>
>
> -----Original Message-----
> From: Phil Ehrens [mailto:pehrens_at_[hidden]]
> Sent: Friday, February 04, 2005 13:20
> To: General LAM/MPI mailing list
> Subject: Re: LAM: Negative rank or communicator size?
>
>
> Angel Tsankov wrote:
>> Why do functions such as MPI_Comm_rank and MPI_Comm_size return int
>> instead
>> of unsigned int?
>
> I have wondered about that too... though I have to say, it
> certainly catches your attention when rank -32764 fails.
>
> --
> Phil Ehrens <pehrens_at_[hidden]>| Fun stuff:
> The LIGO Laboratory, MS 18-34 | http://www.ralphmag.org
> California Institute of Technology | http://www.yellow5.com
> 1200 East California Blvd. | http://www.total.net/~fishnet/
> Pasadena, CA 91125 USA | http://slashdot.org
> Phone:(626)395-8518 Fax:(626)793-9744 | http://kame56.homepage.com
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>

----
Josh Hursey
jjhursey_at_[hidden]
http://www.lam-mpi.org/