On Feb 4, 2005, at 5:52 PM, Angel Tsankov wrote:
>>>> 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.
>>>
>>> If an error is reached in MPI_Comm_rank or MPI_Comm_size, the
>>> program should be aborted (by default). So, what is the point in
>>> setting the variable (rank or size) to a negative value since
>>> neither of those functions will return?
>>>
>>
>> Mostly for the non-default case. :-) By default, you may never see
>> this value propagated, but when you have an error handler in place
>> other than MPI_ERRORS_ARE_FATAL we need to return a value for the
>> variable. So if you happen not to catch that MPI_Comm_rank failed, we
>> want to provide a value that is not valid for use as a rank, so
>> something < 0.
>>
>
> Well, I think it is the responsibility of the caller to first check if
> the call has succeeded and then use the variable.
I agree.
> Is this the only reason for ranks and sizes being signed instead of
> unsigned - 'cause smb might forget to check the return value of a
> function?
This is not the only reason. One of the main reasons is so that it has
an equivalent interface to MPI_Group_rank. See the MPI Forum for more
details:
http://www.mpi-forum.org/docs/mpi-11-html/node101.html
http://www.mpi-forum.org/docs/mpi-11-html/node97.html#Node97
>
> And one more question: why do send functions take pointers instead of
> pointer to constants when they do not change the contents of the
> pointed to data, or do they?
The send functions do not change the values of the contents of the
buffer given to it. I am not familiar with the discussion, and
reasoning as to why the MPI standard uses pointers over pointers to
constants. However, if you look at the C++ Bindings they allow for
pointers to constants:
http://www.mpi-forum.org/docs/mpi-20-html/node287.htm#Node287
----
Josh Hursey
jjhursey_at_[hidden]
http://www.lam-mpi.org/
|