This is a reformat of a mail to the mpi-forum list sent at 04/02/2008(d/m/y)
-----------------------------------------------------------------------------
Proposal
-----------------------------------------------------------------------------
Clarify the actions of the MPI functions dealing with multiple requests
when the request count is 0.
Functions affected:
MPI_Start_all
MPI_Wait_all
MPI_Test_all
MPI_Wait_some
MPI_Test_some
MPI_Wait_any
MPI_Test_any
Proposal:
Clarify that if count equals 0 nothing happens and that in this case
the arguments to the function are not validated (null pointers are
accepted)
Modifications: (numbers refer to the MPI-2.1 draft document of 23/02/2008)
* MPI_Waitany, pg. 59:
add after line 3:
If the list length is zero, the array of requests will not be
checked and does not need to point to a valid request.
* MPI_Testany, pg. 59:
add after line 42:
If count is zero, then the call returns immediately with flag=true,
index=MPI_UNDEFINED, and an empty status. In this case,
array_of_requests does not need to point to a valid request
structure.
* MPI_Waitall, pg. 60:
add after line 23-24;
If count is zero, array_of_requests and array_of_statuses is
ignored, and the call returns immediately with a return
code of MPI_SUCCESS.
* MPI_Testall, pg. 61:
add after line 10-11:
If count is zero, the call returns immediately with a return code
of MPI_SUCCESS and flag = true. Array_of_requests and
array_of_statuses are ignored in this case.
* MPI_Waitsome, pg. 61:
modify line 43:
If the list contains no active handles, ...
-> If the list has length zero, or contains no active handles, ...
Add:
If the list length is zero, array_of_requests, array_of_indices
and array_of_statuses are ignored.
* MPI_Testsome, pg. 62:
modify line 25-26:
If there is no active handle in the list ...
-> If there is no active handle in the list, or the list length is
zero, ...
Add:
If the list length is zero, array_of_requests, array_of_indices
and array_of_statuses are ignored.
* MPI_Start_all, pg. 72
add after line 12:
If count is zero, the call ignores array_of_requests and
returns immediately with error code MPI_SUCCESS.
-----------------------------------------------------------------------------
Rationale
-----------------------------------------------------------------------------
The current wording in the standard isn't clear on what happens if count is 0,
and if the pointer to the request array will be validated in this case.
This can be seen when looking at the behaviour of OpenMPI and mpich,
where the function result is different even within the same implementation
(MPI_Waitany doesn't check parameters in case of count==0, MPI_Startall
does). This can lead to portability issues.
Allowing count to be 0, and requiring the request/result/status array to
be ignored in this case allows for a cleaner user program.
Attachment:
pgpYhgcGddEq3.pgp
Description: PGP signature