Hi Open MPI developers,

> > > The bugs are:
> > >
> > > (1) MPI_SOURCE of MPI_Status for a null request must be MPI_ANY_SOURCE.
> > >
> > > (2) MPI_Status for an inactive request must be an empty status.
> > >
> > > (3) Possible BUS errors on sparc64 processors.
> > >
> > >   r23554 fixed possible BUS errors on sparc64 processors.
> > >   But the fix seems to be insufficient.
> > >
> > >   We should use OMPI_STATUS_SET macro for all user-supplied
> > >   MPI_Status objects.
> > Regarding #3, see also a trac 3218. I'm putting a fix back today. Sorry
> > for the delay. One proposed solution was extending the use of the
> > OMPI_STATUS_SET macros, but I think the consensus was to fix the problem
> > in the Fortran layer. Indeed, the Fortran layer already routinely
> > converts between Fortran and C statuses. The problem was that we started
> > introducing optimizations to bypass the Fortran-to-C conversion and that
> > optimization was employed too liberally (e..g, in situations that would
> > introduce the alignment errors you're describing). My patch will clean
> > that up. I'll try to put it back in the next few hours.
> 
> Sorry, I didn't notice the ticket 3218.
> Now I've confirmed your commit r27403.
> Your modification is better for my issue (3).
> 
> With r27403, my patch for issue (1) and (2) needs modification.
> I'll re-send modified patch in a few hours.

The updated patch is attached.
This patch addresses bugs (1) and (2) in my previous mail
and fixes some typos in comments.

Regards,

Takahiro Kawashima,
MPI development team,
Fujitsu
Index: ompi/mpi/c/wait.c
===================================================================
--- ompi/mpi/c/wait.c	(revision 27414)
+++ ompi/mpi/c/wait.c	(working copy)
@@ -10,6 +10,7 @@
  * Copyright (c) 2004-2005 The Regents of the University of California.
  *                         All rights reserved.
  * Copyright (c) 2006      Cisco Systems, Inc.  All rights reserved.
+ * Copyright (c) 2012      FUJITSU LIMITED.  All rights reserved.
  * $COPYRIGHT$
  * 
  * Additional copyrights may follow
@@ -54,7 +55,7 @@
 
     if (MPI_REQUEST_NULL == *request) {
         if (MPI_STATUS_IGNORE != status) {
-            *status = ompi_request_empty.req_status;
+            *status = ompi_status_empty;
             /*
              * Per MPI-1, the MPI_ERROR field is not defined for single-completion calls
              */
Index: ompi/request/request.c
===================================================================
--- ompi/request/request.c	(revision 27414)
+++ ompi/request/request.c	(working copy)
@@ -13,6 +13,7 @@
  * Copyright (c) 2006-2012 Cisco Systems, Inc.  All rights reserved.
  * Copyright (c) 2009      Sun Microsystems, Inc.  All rights reserved.
  * Copyright (c) 2012      Oak Ridge National Labs.  All rights reserved.
+ * Copyright (c) 2012      FUJITSU LIMITED.  All rights reserved.
  * $COPYRIGHT$
  * 
  * Additional copyrights may follow
@@ -111,7 +112,7 @@
         return OMPI_ERROR;
     }
     ompi_request_null.request.req_type = OMPI_REQUEST_NULL;
-    ompi_request_null.request.req_status.MPI_SOURCE = MPI_PROC_NULL;
+    ompi_request_null.request.req_status.MPI_SOURCE = MPI_ANY_SOURCE;
     ompi_request_null.request.req_status.MPI_TAG = MPI_ANY_TAG;
     ompi_request_null.request.req_status.MPI_ERROR = MPI_SUCCESS;
     ompi_request_null.request.req_status._ucount = 0;
Index: ompi/request/req_wait.c
===================================================================
--- ompi/request/req_wait.c	(revision 27414)
+++ ompi/request/req_wait.c	(working copy)
@@ -12,6 +12,7 @@
  * Copyright (c) 2006-2008 Cisco Systems, Inc.  All rights reserved.
  * Copyright (c) 2010-2012 Oracle and/or its affiliates.  All rights reserved.
  * Copyright (c) 2012      Oak Ridge National Labs.  All rights reserved.
+ * Copyright (c) 2012      FUJITSU LIMITED.  All rights reserved.
  * $COPYRIGHT$
  * 
  * Additional copyrights may follow
@@ -46,7 +47,7 @@
 #endif
         
     /* return status.  If it's a generalized request, we *have* to
-       invoke the query_fn, even if the user procided STATUS_IGNORE.
+       invoke the query_fn, even if the user provided STATUS_IGNORE.
        MPI-2:8.2. */
     if (OMPI_REQUEST_GEN == req->req_type) {
         ompi_grequest_invoke_query(req, &req->req_status);
@@ -60,11 +61,15 @@
         status->_cancelled = req->req_status._cancelled;
     }
     if( req->req_persistent ) {
+        int error = req->req_status.MPI_ERROR;
         if( req->req_state == OMPI_REQUEST_INACTIVE ) {
             return OMPI_SUCCESS;
         }
         req->req_state = OMPI_REQUEST_INACTIVE;
-        return req->req_status.MPI_ERROR;
+        /* Next time MPI_Wait* or MPI_Test* is called, we must return
+           empty status. */
+        req->req_status = ompi_status_empty;
+        return error;
     }
 
     /* If there was an error, don't free the request -- just return
@@ -188,6 +193,9 @@
         rc = request->req_status.MPI_ERROR;
         if( request->req_persistent ) {
             request->req_state = OMPI_REQUEST_INACTIVE;
+            /* Next time MPI_Wait* or MPI_Test* is called, we must return
+               empty status. */
+            request->req_status = ompi_status_empty;
         } else if (MPI_SUCCESS == rc) {
             /* Only free the request if there is no error on it */
             /* If there's an error while freeing the request,
@@ -254,7 +262,7 @@
         /*
          * confirm the status of the pending requests. We have to do it before
          * taking the condition or otherwise we can miss some requests completion (the
-         * one that happpens between our initial test and the aquisition of the lock).
+         * one that happens between our initial test and the acquisition of the lock).
          */
         rptr = requests;
         for( completed = i = 0; i < count; i++ ) {
@@ -360,6 +368,9 @@
 
             if( request->req_persistent ) {
                 request->req_state = OMPI_REQUEST_INACTIVE;
+                /* Next time MPI_Wait* or MPI_Test* is called, we must return
+                   empty status. */
+                request->req_status = ompi_status_empty;
             } else {
                 /* Only free the request if there is no error on it */
                 if (MPI_SUCCESS == request->req_status.MPI_ERROR) {
@@ -409,6 +420,9 @@
             }
             if( request->req_persistent ) {
                 request->req_state = OMPI_REQUEST_INACTIVE;
+                /* Next time MPI_Wait* or MPI_Test* is called, we must return
+                   empty status. */
+                request->req_status = ompi_status_empty;
             } else if (MPI_SUCCESS == rc) {
                 /* Only free the request if there is no error on it */
                 int tmp = ompi_request_free(rptr);
@@ -566,6 +580,9 @@
 
             if( request->req_persistent ) {
                 request->req_state = OMPI_REQUEST_INACTIVE;
+                /* Next time MPI_Wait* or MPI_Test* is called, we must return
+                   empty status. */
+                request->req_status = ompi_status_empty;
             } else {
                 /* Only free the request if there was no error */
                 if (MPI_SUCCESS == request->req_status.MPI_ERROR) {
Index: ompi/request/req_test.c
===================================================================
--- ompi/request/req_test.c	(revision 27414)
+++ ompi/request/req_test.c	(working copy)
@@ -12,6 +12,7 @@
  * Copyright (c) 2006-2008 Cisco Systems, Inc.  All rights reserved.
  * Copyright (c) 2010-2012 Oracle and/or its affiliates.  All rights reserved.
  * Copyright (c) 2012      Oak Ridge National Labs.  All rights reserved.
+ * Copyright (c) 2012      FUJITSU LIMITED.  All rights reserved.
  * $COPYRIGHT$
  *
  * Additional copyrights may follow
@@ -68,8 +69,12 @@
             status->MPI_ERROR = old_error;
         }
         if( request->req_persistent ) {
+            int error = request->req_status.MPI_ERROR;
             request->req_state = OMPI_REQUEST_INACTIVE;
-            return request->req_status.MPI_ERROR;
+            /* Next time MPI_Wait* or MPI_Test* is called, we must return
+               empty status. */
+            request->req_status = ompi_status_empty;
+            return error;
         }
         /* If there was an error, don't free the request -- just
            return the single error. */
@@ -145,8 +150,12 @@
             }
 
             if( request->req_persistent ) {
+                int error = request->req_status.MPI_ERROR;
                 request->req_state = OMPI_REQUEST_INACTIVE;
-                return OMPI_SUCCESS;
+                /* Next time MPI_Wait* or MPI_Test* is called, we must return
+                   empty status. */
+                request->req_status = ompi_status_empty;
+                return error;
             }
             /* If there is an error on the request, don't free it */
             if (MPI_SUCCESS != request->req_status.MPI_ERROR) {
@@ -231,6 +240,9 @@
             statuses[i] = request->req_status;
             if( request->req_persistent ) {
                 request->req_state = OMPI_REQUEST_INACTIVE;
+                /* Next time MPI_Wait* or MPI_Test* is called, we must return
+                   empty status. */
+                request->req_status = ompi_status_empty;
                 continue;
             }
             /* MPI-2:4.5.1 says that we can return MPI_ERR_IN_STATUS
@@ -260,6 +272,9 @@
             }
             if( request->req_persistent ) {
                 request->req_state = OMPI_REQUEST_INACTIVE;
+                /* Next time MPI_Wait* or MPI_Test* is called, we must return
+                   empty status. */
+                request->req_status = ompi_status_empty;
                 continue;
             }
             /* Only free the request if there was no error */
@@ -338,6 +353,9 @@
 
         if( request->req_persistent ) {
             request->req_state = OMPI_REQUEST_INACTIVE;
+            /* Next time MPI_Wait* or MPI_Test* is called, we must return
+               empty status. */
+            request->req_status = ompi_status_empty;
         } else {
             /* Only free the request if there was no error */
             if (MPI_SUCCESS == request->req_status.MPI_ERROR) {

Reply via email to