On 03/13/12 13:25, Jeffrey Squyres wrote:
On Mar 9, 2012, at 5:17 PM, Jeremiah Willcock wrote:
On Open MPI 1.5.1, when I call MPI_Testsome with incount=0 and the two output
arrays NULL, I get an argument error (MPI_ERR_ARG). Is this the intended
behavior? If incount=0, no requests can complete, so the output arrays can
never be written to. I do not see anything in the MPI 2.2 standard that says
either way whether this is allowed.
I have no strong opinions here, so I coded up a patch to just return
MPI_SUCCESS in this scenario (attached).
If no one objects, we can probably get this in 1.6.
It isn't enough just to return MPI_SUCCESS when the count is zero. The
man pages indicate what behavior is expected when count==0 and the MTT
tests (ibm/pt2pt/[test|wait][any|some|all].c) check for this behavior.
Put another way, a bunch of MTT tests started failing since r26138 due
to quick return on count=0.
Again, the trunk since r26138 sets no output values when count=0. In
contrast, the ibm/pt2pt/*.c tests correctly check for the count=0
behavior that we document in our man pages. Here are excerpts from our
man pages:
Testall
Returns flag = true if all communications associated
with active handles in the array have completed (this
includes the case where no handle in the list is active).
Testany
MPI_Testany tests for completion of either one or none
of the operations associated with active handles. In
the latter case (no operation completed), it returns
flag = false, returns a value of MPI_UNDEFINED in index,
and status is undefined.
The array may contain null or inactive handles. If the
array contains no active handles then the call returns
immediately with flag = true, index = MPI_UNDEFINED,
and an empty status.
Testsome
If there is no active handle in the list, it returns
outcount = MPI_UNDEFINED.
Waitall
[...no issues...]
Waitany
The array_of_requests list may contain null or inactive
handles. If the list contains no active handles (list
has length zero or all entries are null or inactive),
then the call returns immediately with index = MPI_UNDEFINED,
and an empty status.
Waitsome
If the list contains no active handles, then the call
returns immediately with outcount = MPI_UNDEFINED.
I'll test and put back the attached patch.
Index: trunk/ompi/mpi/c/testall.c
===================================================================
--- trunk/ompi/mpi/c/testall.c (revision 26147)
+++ trunk/ompi/mpi/c/testall.c (working copy)
@@ -67,6 +67,7 @@
}
if (OPAL_UNLIKELY(0 == count)) {
+ *flag = true;
return MPI_SUCCESS;
}
Index: trunk/ompi/mpi/c/waitany.c
===================================================================
--- trunk/ompi/mpi/c/waitany.c (revision 26147)
+++ trunk/ompi/mpi/c/waitany.c (working copy)
@@ -67,6 +67,7 @@
}
if (OPAL_UNLIKELY(0 == count)) {
+ *indx = MPI_UNDEFINED;
return MPI_SUCCESS;
}
Index: trunk/ompi/mpi/c/testany.c
===================================================================
--- trunk/ompi/mpi/c/testany.c (revision 26147)
+++ trunk/ompi/mpi/c/testany.c (working copy)
@@ -67,6 +67,8 @@
}
if (OPAL_UNLIKELY(0 == count)) {
+ *completed = true;
+ *indx = MPI_UNDEFINED;
return MPI_SUCCESS;
}
Index: trunk/ompi/mpi/c/waitsome.c
===================================================================
--- trunk/ompi/mpi/c/waitsome.c (revision 26147)
+++ trunk/ompi/mpi/c/waitsome.c (working copy)
@@ -69,6 +69,7 @@
}
if (OPAL_UNLIKELY(0 == incount)) {
+ *outcount = MPI_UNDEFINED;
return MPI_SUCCESS;
}
Index: trunk/ompi/mpi/c/testsome.c
===================================================================
--- trunk/ompi/mpi/c/testsome.c (revision 26147)
+++ trunk/ompi/mpi/c/testsome.c (working copy)
@@ -69,6 +69,7 @@
}
if (OPAL_UNLIKELY(0 == incount)) {
+ *outcount = MPI_UNDEFINED;
return OMPI_SUCCESS;
}