Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: [OMPI devel] MPI_Request_get_status and opal_progress [PATCH]
From: Shaun Jackman (sjackman_at_[hidden])
Date: 2009-09-14 17:12:51


Hi,

MPI_Test includes logic (in ompi_request_default_test) that tests
request->req_complete a second time after calling opal_progress.
MPI_Request_get_status however is missing this logic, although it
performs a nearly identical task. After speaking with Jeff Squyres on
the phone, he agreed that this logic could be copied over. A patch is
attached. This patch is currently untested (other than it compiles),
but I wanted to post it before it left my head.

Two questions. Should the loop label recheck_request_status come
before or after the call to opal_atomic_mb? Is it necessary to check
request->req_state a second time, or is it only necessary to check
request->req_complete the second time?

Cheers,
Shaun

2009-09-14 Shaun Jackman <sjackman_at_[hidden]>

        * ompi/mpi/c/request_get_status.c (MPI_Request_get_status):
        If opal_progress is called then check the status of the request
        before returning. opal_progress is called only once. This logic
        parallels MPI_Test (ompi_request_default_test).

2009-09-14 Shaun Jackman <sjackman_at_[hidden]>

        * ompi/mpi/c/request_get_status.c (MPI_Request_get_status):
        If opal_progress is called then check the status of the request
        before returning. opal_progress is called only once. This logic
        parallels MPI_Test (ompi_request_default_test).

--- ompi/mpi/c/request_get_status.c.orig 2008-11-04 12:56:27.000000000 -0800
+++ ompi/mpi/c/request_get_status.c 2009-09-14 13:38:35.452391000 -0700
@@ -41,6 +41,10 @@
 int MPI_Request_get_status(MPI_Request request, int *flag,
                            MPI_Status *status)
 {
+#if OMPI_ENABLE_PROGRESS_THREADS == 0
+ int do_it_once = 0;
+#endif
+
     MEMCHECKER(
         memchecker_request(&request);
     );
@@ -65,6 +69,10 @@
         }
         return MPI_SUCCESS;
     }
+
+#if OMPI_ENABLE_PROGRESS_THREADS == 0
+ recheck_request_status:
+#endif
     if( request->req_complete ) {
         *flag = true;
         /* If this is a generalized request, we *always* have to call
@@ -78,9 +86,17 @@
         }
         return MPI_SUCCESS;
     }
- *flag = false;
 #if OMPI_ENABLE_PROGRESS_THREADS == 0
- opal_progress();
+ if( 0 == do_it_once ) {
+ /**
+ * If we run the opal_progress then check the status of the request before
+ * leaving. We will call the opal_progress only once per call.
+ */
+ opal_progress();
+ do_it_once++;
+ goto recheck_request_status;
+ }
 #endif
+ *flag = false;
     return MPI_SUCCESS;
 }