[mpich2-commits] r7916 - in mpich2/trunk/src: include mpi/pt2pt mpid/ch3/include mpid/ch3/src mpid/dcmfd/src/impl

goodell at mcs.anl.gov goodell at mcs.anl.gov
Fri Feb 4 16:55:48 CST 2011


Author: goodell
Date: 2011-02-04 16:55:48 -0600 (Fri, 04 Feb 2011)
New Revision: 7916

Modified:
   mpich2/trunk/src/include/mpiimpl.h
   mpich2/trunk/src/mpi/pt2pt/greq_start.c
   mpich2/trunk/src/mpi/pt2pt/mpir_request.c
   mpich2/trunk/src/mpi/pt2pt/test.c
   mpich2/trunk/src/mpi/pt2pt/testall.c
   mpich2/trunk/src/mpi/pt2pt/testany.c
   mpich2/trunk/src/mpi/pt2pt/testsome.c
   mpich2/trunk/src/mpi/pt2pt/wait.c
   mpich2/trunk/src/mpi/pt2pt/waitany.c
   mpich2/trunk/src/mpid/ch3/include/mpidimpl.h
   mpich2/trunk/src/mpid/ch3/src/ch3u_request.c
   mpich2/trunk/src/mpid/dcmfd/src/impl/mpid_request.c
Log:
refactor greq storage in request to save space in pt2pt requests

This change moves the greq functions and state into a subordinate
struct that is only created for generalized requests.  This saves ~48 bytes
per request on many platforms in the common pt2pt request case.

Reviewed by buntinas at .

Modified: mpich2/trunk/src/include/mpiimpl.h
===================================================================
--- mpich2/trunk/src/include/mpiimpl.h	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/include/mpiimpl.h	2011-02-04 22:55:48 UTC (rev 7916)
@@ -1351,6 +1351,19 @@
 typedef void (MPIR_Grequest_f77_free_function)(void *, int *); 
 typedef void (MPIR_Grequest_f77_query_function)(void *, MPI_Status *, int *); 
 
+/* vtable-ish structure holding generalized request function pointers and other
+ * state.  Saves ~48 bytes in pt2pt requests on many platforms. */
+struct MPID_Grequest_fns {
+    MPI_Grequest_cancel_function *cancel_fn;
+    MPI_Grequest_free_function   *free_fn;
+    MPI_Grequest_query_function  *query_fn;
+    MPIX_Grequest_poll_function   *poll_fn;
+    MPIX_Grequest_wait_function   *wait_fn;
+    void             *grequest_extra_state;
+    MPIX_Grequest_class         greq_class;
+    MPID_Lang_t                  greq_lang;         /* language that defined
+                                                       the generalize req */
+};
 
 /* see mpiimplthread.h for the def of MPID_cc_t and related functions/macros */
 #define MPID_Request_is_complete(req_) (MPID_cc_is_complete((req_)->cc_ptr))
@@ -1386,17 +1399,11 @@
     /* Persistent requests have their own "real" requests.  Receive requests
        have partnering send requests when src=dest. etc. */
     struct MPID_Request *partner_request;
-    /* User-defined request support */
-    MPI_Grequest_cancel_function *cancel_fn;
-    MPI_Grequest_free_function   *free_fn;
-    MPI_Grequest_query_function  *query_fn;
-    MPIX_Grequest_poll_function   *poll_fn;
-    MPIX_Grequest_wait_function   *wait_fn;
-    void             *grequest_extra_state;
-    MPIX_Grequest_class	        greq_class;
-    MPID_Lang_t                  greq_lang;         /* language that defined
-						       the generalize req */
-    
+
+    /* User-defined request support via a "vtable".  Saves space in the already
+     * bloated request for regular pt2pt and NBC requests. */
+    struct MPID_Grequest_fns *greq_fns;
+
     /* Other, device-specific information */
 #ifdef MPID_DEV_REQUEST_DECL
     MPID_DEV_REQUEST_DECL

Modified: mpich2/trunk/src/mpi/pt2pt/greq_start.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/greq_start.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/greq_start.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -76,7 +76,8 @@
                              void *extra_state, MPID_Request **request_ptr)
 {
     int mpi_errno = MPI_SUCCESS;
-        
+    MPIU_CHKPMEM_DECL(1);
+
     /* MT FIXME this routine is not thread-safe in the non-global case */
     
     *request_ptr = MPID_Request_create();
@@ -87,17 +88,21 @@
     (*request_ptr)->cc_ptr               = &(*request_ptr)->cc;
     MPID_cc_set((*request_ptr)->cc_ptr, 1);
     (*request_ptr)->comm                 = NULL;
-    (*request_ptr)->cancel_fn            = cancel_fn;
-    (*request_ptr)->free_fn              = free_fn;
-    (*request_ptr)->query_fn             = query_fn;
-    (*request_ptr)->poll_fn              = NULL;
-    (*request_ptr)->wait_fn              = NULL;
-    (*request_ptr)->grequest_extra_state = extra_state;
-    (*request_ptr)->greq_lang            = MPID_LANG_C;
+    (*request_ptr)->greq_fns             = NULL;
+    MPIU_CHKPMEM_MALLOC((*request_ptr)->greq_fns, struct MPID_Grequest_fns *, sizeof(struct MPID_Grequest_fns), mpi_errno, "greq_fns");
+    (*request_ptr)->greq_fns->cancel_fn            = cancel_fn;
+    (*request_ptr)->greq_fns->free_fn              = free_fn;
+    (*request_ptr)->greq_fns->query_fn             = query_fn;
+    (*request_ptr)->greq_fns->poll_fn              = NULL;
+    (*request_ptr)->greq_fns->wait_fn              = NULL;
+    (*request_ptr)->greq_fns->grequest_extra_state = extra_state;
+    (*request_ptr)->greq_fns->greq_lang            = MPID_LANG_C;
 
+    MPIU_CHKPMEM_COMMIT();
  fn_exit:
     return mpi_errno;
  fn_fail:
+    MPIU_CHKPMEM_REAP();
     goto fn_exit;
 }
 
@@ -333,17 +338,17 @@
 	MPID_Request *lrequest_ptr;
 	MPID_Grequest_class *class_ptr;
 
-
+        *request = MPI_REQUEST_NULL;
 	MPID_Grequest_class_get_ptr(greq_class, class_ptr);
-	mpi_errno = MPI_Grequest_start(class_ptr->query_fn, 
-			class_ptr->free_fn, class_ptr->cancel_fn, 
-			extra_state, request);
+        mpi_errno = MPIR_Grequest_start_impl(class_ptr->query_fn, class_ptr->free_fn,
+                                             class_ptr->cancel_fn, extra_state,
+                                             &lrequest_ptr);
 	if (mpi_errno == MPI_SUCCESS)
 	{
-		MPID_Request_get_ptr(*request, lrequest_ptr);
-		lrequest_ptr->poll_fn     = class_ptr->poll_fn;
-		lrequest_ptr->wait_fn     = class_ptr->wait_fn;
-		lrequest_ptr->greq_class  = greq_class;  
+            *request = lrequest_ptr->handle;
+            lrequest_ptr->greq_fns->poll_fn     = class_ptr->poll_fn;
+            lrequest_ptr->greq_fns->wait_fn     = class_ptr->wait_fn;
+            lrequest_ptr->greq_fns->greq_class  = greq_class;
 	}
 	return mpi_errno;
 }
@@ -378,14 +383,14 @@
     int mpi_errno;
     MPID_Request *lrequest_ptr;
 
-    mpi_errno = MPI_Grequest_start(query_fn, free_fn, cancel_fn, 
-		    extra_state, request);
+    *request = MPI_REQUEST_NULL;
+    mpi_errno = MPIR_Grequest_start_impl(query_fn, free_fn, cancel_fn, extra_state, &lrequest_ptr);
 
     if (mpi_errno == MPI_SUCCESS)
-    { 
-	MPID_Request_get_ptr(*request, lrequest_ptr);
-        lrequest_ptr->poll_fn              = poll_fn;
-	lrequest_ptr->wait_fn              = wait_fn;
+    {
+        *request = lrequest_ptr->handle;
+        lrequest_ptr->greq_fns->poll_fn = poll_fn;
+        lrequest_ptr->greq_fns->wait_fn = wait_fn;
     }
 
     return mpi_errno;

Modified: mpich2/trunk/src/mpi/pt2pt/mpir_request.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/mpir_request.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/mpir_request.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -306,14 +306,14 @@
 	    
 	    /* Note that we've acquired the thread private storage above */
     
-	    switch (request_ptr->greq_lang)
+	    switch (request_ptr->greq_fns->greq_lang)
 	    {
 		case MPID_LANG_C:
 #ifdef HAVE_CXX_BINDING
 		case MPID_LANG_CXX:
 #endif
-		    rc = (request_ptr->query_fn)(
-			request_ptr->grequest_extra_state,
+		    rc = (request_ptr->greq_fns->query_fn)(
+			request_ptr->greq_fns->grequest_extra_state,
 			&request_ptr->status);
 		    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno,
 			MPI_ERR_OTHER,;, "**user", "**userquery %d", rc);
@@ -323,8 +323,8 @@
 		case MPID_LANG_FORTRAN90:
 		{
 		    MPI_Fint ierr;
-		    ((MPIR_Grequest_f77_query_function*)(request_ptr->query_fn))( 
-			request_ptr->grequest_extra_state, &request_ptr->status,
+		    ((MPIR_Grequest_f77_query_function*)(request_ptr->greq_fns->query_fn))( 
+			request_ptr->greq_fns->grequest_extra_state, &request_ptr->status,
 			&ierr );
 		    rc = (int) ierr;
 		    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno,
@@ -339,7 +339,7 @@
 		    /* This should not happen */
 		    MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN,;, 
 				 "**badcase", 
-				 "**badcase %d", request_ptr->greq_lang);
+				 "**badcase %d", request_ptr->greq_fns->greq_lang);
 		    break;
 		    /* --END ERROR HANDLING-- */
 		}
@@ -370,7 +370,7 @@
 
     MPID_Request_get_ptr( greq, greq_ptr );
 
-    greq_ptr->greq_lang = MPID_LANG_FORTRAN;
+    greq_ptr->greq_fns->greq_lang = MPID_LANG_FORTRAN;
 }
 #endif
 
@@ -384,14 +384,14 @@
     int rc;
     int mpi_errno = MPI_SUCCESS;
     
-    switch (request_ptr->greq_lang)
+    switch (request_ptr->greq_fns->greq_lang)
     {
 	case MPID_LANG_C:
 #ifdef HAVE_CXX_BINDING
 	case MPID_LANG_CXX:
 #endif
-	    rc = (request_ptr->cancel_fn)(
-		request_ptr->grequest_extra_state, complete);
+	    rc = (request_ptr->greq_fns->cancel_fn)(
+		request_ptr->greq_fns->grequest_extra_state, complete);
 	    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno,
 		MPI_ERR_OTHER,;, "**user", "**usercancel %d", rc);
 	    break;
@@ -401,8 +401,8 @@
 	{
 	    MPI_Fint ierr;
 
-	    ((MPIR_Grequest_f77_cancel_function *)(request_ptr->cancel_fn))(
-		request_ptr->grequest_extra_state, &complete, &ierr);
+	    ((MPIR_Grequest_f77_cancel_function *)(request_ptr->greq_fns->cancel_fn))(
+		request_ptr->greq_fns->grequest_extra_state, &complete, &ierr);
 	    rc = (int) ierr;
 	    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
 		{;}, "**user", "**usercancel %d", rc);
@@ -415,7 +415,7 @@
 	    /* --BEGIN ERROR HANDLING-- */
 	    /* This should not happen */
 	    MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN,;, "**badcase",
-		"**badcase %d", request_ptr->greq_lang);
+		"**badcase %d", request_ptr->greq_fns->greq_lang);
 	    break;
 	    /* --END ERROR HANDLING-- */
 	}
@@ -434,13 +434,13 @@
     int rc;
     int mpi_errno = MPI_SUCCESS;
     
-    switch (request_ptr->greq_lang)
+    switch (request_ptr->greq_fns->greq_lang)
     {
 	case MPID_LANG_C:
 #ifdef HAVE_CXX_BINDING
 	case MPID_LANG_CXX:
 #endif
-	    rc = (request_ptr->query_fn)(request_ptr->grequest_extra_state,
+	    rc = (request_ptr->greq_fns->query_fn)(request_ptr->greq_fns->grequest_extra_state,
 		&request_ptr->status);
 	    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
 		{;}, "**user", "**userquery %d", rc);
@@ -450,8 +450,8 @@
 	case MPID_LANG_FORTRAN90:
 	{
 	    MPI_Fint ierr;
-	    ((MPIR_Grequest_f77_query_function *)(request_ptr->query_fn))( 
-		request_ptr->grequest_extra_state, &request_ptr->status, &ierr );
+	    ((MPIR_Grequest_f77_query_function *)(request_ptr->greq_fns->query_fn))( 
+		request_ptr->greq_fns->grequest_extra_state, &request_ptr->status, &ierr );
 	    rc = (int)ierr;
 	    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
 		{;}, "**user", "**userquery %d", rc);
@@ -463,7 +463,7 @@
 	    /* --BEGIN ERROR HANDLING-- */
 	    /* This should not happen */
 	    MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN,;, "**badcase",
-		"**badcase %d", request_ptr->greq_lang);
+		"**badcase %d", request_ptr->greq_fns->greq_lang);
 	    break;
 	    /* --END ERROR HANDLING-- */
 	}
@@ -482,13 +482,13 @@
     int rc;
     int mpi_errno = MPI_SUCCESS;
     
-    switch (request_ptr->greq_lang)
+    switch (request_ptr->greq_fns->greq_lang)
     {
 	case MPID_LANG_C:
 #ifdef HAVE_CXX_BINDING
 	case MPID_LANG_CXX:
 #endif
-	    rc = (request_ptr->free_fn)(request_ptr->grequest_extra_state);
+	    rc = (request_ptr->greq_fns->free_fn)(request_ptr->greq_fns->grequest_extra_state);
 	    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
 		{;}, "**user", "**userfree %d", rc);
 	    break;
@@ -498,8 +498,8 @@
 	{
 	    MPI_Fint ierr;
 		    
-	    ((MPIR_Grequest_f77_free_function *)(request_ptr->free_fn))(
-		request_ptr->grequest_extra_state, &ierr);
+	    ((MPIR_Grequest_f77_free_function *)(request_ptr->greq_fns->free_fn))(
+		request_ptr->greq_fns->grequest_extra_state, &ierr);
 	    rc = (int) ierr;
 	    MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
 		{;}, "**user", "**userfree %d", rc);
@@ -512,7 +512,7 @@
 	    /* --BEGIN ERROR HANDLING-- */
 	    /* This should not happen */
 	    MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN, {;}, "**badcase",
-		"**badcase %d", request_ptr->greq_lang);
+		"**badcase %d", request_ptr->greq_fns->greq_lang);
 	    break;
 	    /* --END ERROR HANDLING-- */
 	}
@@ -550,13 +550,13 @@
 	if (request_ptrs[i]->kind == MPID_UREQUEST)
 	{
 	    n_greq += 1;
-	    wait_fn = request_ptrs[i]->wait_fn;
-	    state_ptrs[j] = request_ptrs[i]->grequest_extra_state;
+	    wait_fn = request_ptrs[i]->greq_fns->wait_fn;
+	    state_ptrs[j] = request_ptrs[i]->greq_fns->grequest_extra_state;
 	    j++;
 	    if (i+1 < count) {
 	        if (request_ptrs[i+1] == NULL ||
-			(request_ptrs[i]->greq_class != 
-				request_ptrs[i+1]->greq_class) )
+			(request_ptrs[i]->greq_fns->greq_class != 
+				request_ptrs[i+1]->greq_fns->greq_class) )
 	            n_classes += 1;
 	    }
 	} else {
@@ -572,9 +572,9 @@
 	    if (request_ptrs[i] != NULL && 
                 request_ptrs[i]->kind == MPID_UREQUEST && 
                 !MPID_Request_is_complete(request_ptrs[i]) &&
-                request_ptrs[i]->poll_fn != NULL)
+                request_ptrs[i]->greq_fns->poll_fn != NULL)
             {
-		mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state, &(array_of_statuses[i]));
+		mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state, &(array_of_statuses[i]));
                 if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 	    }
 	}
@@ -626,13 +626,13 @@
         if (request_ptrs[i] == NULL || *request_ptrs[i]->cc_ptr == 0 ||  request_ptrs[i]->kind != MPID_UREQUEST)
             continue;
         
-        if (n_greq == 0 || request_ptrs[i]->greq_class == curr_class)
+        if (n_greq == 0 || request_ptrs[i]->greq_fns->greq_class == curr_class)
         {
             /* if this is the first grequest of a group, or if it's the
                same class as the last one, add its state to the list  */
-            curr_class = request_ptrs[i]->greq_class;
-            wait_fn = request_ptrs[i]->wait_fn;
-            state_ptrs[n_greq] = request_ptrs[i]->grequest_extra_state;
+            curr_class = request_ptrs[i]->greq_fns->greq_class;
+            wait_fn = request_ptrs[i]->greq_fns->wait_fn;
+            state_ptrs[n_greq] = request_ptrs[i]->greq_fns->grequest_extra_state;
             ++n_greq;
         }
         else
@@ -642,9 +642,9 @@
             mpi_error = (wait_fn)(n_greq, state_ptrs, 0, NULL);
             if (mpi_error) MPIU_ERR_POP(mpi_error);
 
-            curr_class = request_ptrs[i]->greq_class;
-            wait_fn = request_ptrs[i]->wait_fn;
-            state_ptrs[0] = request_ptrs[i]->grequest_extra_state;
+            curr_class = request_ptrs[i]->greq_fns->greq_class;
+            wait_fn = request_ptrs[i]->greq_fns->wait_fn;
+            state_ptrs[0] = request_ptrs[i]->greq_fns->grequest_extra_state;
             n_greq = 1;
         }
     }
@@ -663,12 +663,12 @@
         if (request_ptrs[i] == NULL ||
             MPID_Request_is_complete(request_ptrs[i]) ||
             request_ptrs[i]->kind != MPID_UREQUEST ||
-            request_ptrs[i]->wait_fn == NULL)
+            request_ptrs[i]->greq_fns->wait_fn == NULL)
         {
             continue;
         }
 
-        mpi_error = (request_ptrs[i]->wait_fn)(1, &request_ptrs[i]->grequest_extra_state, 0, NULL);
+        mpi_error = (request_ptrs[i]->greq_fns->wait_fn)(1, &request_ptrs[i]->greq_fns->grequest_extra_state, 0, NULL);
         if (mpi_error) MPIU_ERR_POP(mpi_error);
         MPIU_Assert(MPID_Request_is_complete(request_ptrs[i]));
     }

Modified: mpich2/trunk/src/mpi/pt2pt/test.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/test.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/test.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -50,12 +50,14 @@
     mpi_errno = MPID_Progress_test();
     if (mpi_errno != MPI_SUCCESS) goto fn_fail;
 
-    if (request_ptr->kind == MPID_UREQUEST && request_ptr->poll_fn != NULL) {
-	mpi_errno = (request_ptr->poll_fn)(request_ptr->grequest_extra_state,
-                                           status);
-	if (mpi_errno != MPI_SUCCESS) goto fn_fail;
+    if (request_ptr->kind == MPID_UREQUEST &&
+        request_ptr->greq_fns != NULL &&
+        request_ptr->greq_fns->poll_fn != NULL)
+    {
+        mpi_errno = (request_ptr->greq_fns->poll_fn)(request_ptr->greq_fns->grequest_extra_state, status);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
     }
-    
+
     if (MPID_Request_is_complete(request_ptr)) {
 	mpi_errno = MPIR_Request_complete(request, request_ptr, status,
 					  &active_flag);

Modified: mpich2/trunk/src/mpi/pt2pt/testall.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/testall.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/testall.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -162,11 +162,11 @@
     for (i = 0; i < count; i++)
     {
 	if (request_ptrs[i] != NULL && 
-			request_ptrs[i]->kind == MPID_UREQUEST &&
-			request_ptrs[i]->poll_fn != NULL)
+            request_ptrs[i]->kind == MPID_UREQUEST &&
+            request_ptrs[i]->greq_fns->poll_fn != NULL)
 	{
-	    mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state, 
-			    &(array_of_statuses[i]));
+            mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state,
+                                                             &(array_of_statuses[i]));
 	    if (mpi_errno != MPI_SUCCESS) goto fn_fail;
 	}
 	if (request_ptrs[i] != NULL && MPID_Request_is_complete(request_ptrs[i]))

Modified: mpich2/trunk/src/mpi/pt2pt/testany.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/testany.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/testany.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -163,11 +163,11 @@
     for (i = 0; i < count; i++)
     {
 	if (request_ptrs[i] != NULL && 
-			request_ptrs[i]->kind == MPID_UREQUEST &&
-			request_ptrs[i]->poll_fn != NULL)
+            request_ptrs[i]->kind == MPID_UREQUEST &&
+            request_ptrs[i]->greq_fns->poll_fn != NULL)
 	{
-	    mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state, 
-			    status);
+            mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state,
+                                                             status);
 	    if (mpi_errno != MPI_SUCCESS) goto fn_fail;
 	}
 	if (request_ptrs[i] != NULL && MPID_Request_is_complete(request_ptrs[i]))

Modified: mpich2/trunk/src/mpi/pt2pt/testsome.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/testsome.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/testsome.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -164,11 +164,11 @@
     for (i = 0; i < incount; i++)
     {
 	if (request_ptrs[i] != NULL && 
-			request_ptrs[i]->kind == MPID_UREQUEST &&
-			request_ptrs[i]->poll_fn != NULL)
+            request_ptrs[i]->kind == MPID_UREQUEST &&
+            request_ptrs[i]->greq_fns->poll_fn != NULL)
 	{
-	    mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state, 
-			    array_of_statuses);
+            mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state,
+                                                             array_of_statuses);
 	    if (mpi_errno != MPI_SUCCESS) goto fn_fail;
 	}
 	if (request_ptrs[i] != NULL && MPID_Request_is_complete(request_ptrs[i]))

Modified: mpich2/trunk/src/mpi/pt2pt/wait.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/wait.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/wait.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -50,7 +50,7 @@
 	{
 	    mpi_errno = MPIR_Grequest_progress_poke(1, &request_ptr, status);
 	    if (request_ptr->kind == MPID_UREQUEST &&
-                request_ptr->wait_fn != NULL)
+                request_ptr->greq_fns->wait_fn != NULL)
 	    {
 		if (mpi_errno) {
 		    /* --BEGIN ERROR HANDLING-- */

Modified: mpich2/trunk/src/mpi/pt2pt/waitany.c
===================================================================
--- mpich2/trunk/src/mpi/pt2pt/waitany.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpi/pt2pt/waitany.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -158,10 +158,10 @@
             /* we found at least one non-null request */
             found_nonnull_req = TRUE;
             
-	    if (request_ptrs[i]->kind == MPID_UREQUEST && request_ptrs[i]->poll_fn != NULL)
+            if (request_ptrs[i]->kind == MPID_UREQUEST && request_ptrs[i]->greq_fns->poll_fn != NULL)
 	    {
                 /* this is a generalized request; make progress on it */
-		mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state, status);
+                mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state, status);
 		if (mpi_errno != MPI_SUCCESS) goto fn_progress_end_fail;
 	    }
             if (MPID_Request_is_complete(request_ptrs[i]))

Modified: mpich2/trunk/src/mpid/ch3/include/mpidimpl.h
===================================================================
--- mpich2/trunk/src/mpid/ch3/include/mpidimpl.h	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpid/ch3/include/mpidimpl.h	2011-02-04 22:55:48 UTC (rev 7916)
@@ -319,6 +319,7 @@
     MPIU_Object_set_ref((sreq_), 2);				\
     (sreq_)->kind = MPID_REQUEST_SEND;				\
     (sreq_)->comm = comm;					\
+    (sreq_)->greq_fns = NULL;                                   \
     MPID_cc_set(&(sreq_)->cc, 1);                               \
     (sreq_)->cc_ptr		   = &(sreq_)->cc;              \
     (sreq_)->partner_request   = NULL;                          \
@@ -357,6 +358,7 @@
     MPIU_Object_set_ref((rreq_), 2);				\
     (rreq_)->kind = MPID_REQUEST_RECV;				\
     (rreq_)->comm = NULL;					\
+    (rreq_)->greq_fns = NULL;                                   \
     MPID_cc_set(&(rreq_)->cc, 1);                               \
     (rreq_)->cc_ptr		   = &(rreq_)->cc;              \
     (rreq_)->status.MPI_ERROR	   = MPI_SUCCESS;               \

Modified: mpich2/trunk/src/mpid/ch3/src/ch3u_request.c
===================================================================
--- mpich2/trunk/src/mpid/ch3/src/ch3u_request.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpid/ch3/src/ch3u_request.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -72,6 +72,7 @@
 	req->status.count	   = 0;
 	req->status.cancelled	   = FALSE;
 	req->comm		   = NULL;
+        req->greq_fns              = NULL;
 	req->dev.datatype_ptr	   = NULL;
 	req->dev.segment_ptr	   = NULL;
 	/* Masks and flags for channel device state in an MPID_Request */
@@ -145,6 +146,10 @@
 	MPIR_Comm_release(req->comm, 0);
     }
 
+    if (req->greq_fns != NULL) {
+        MPIU_Free(req->greq_fns);
+    }
+
     if (req->dev.datatype_ptr != NULL) {
 	MPID_Datatype_release(req->dev.datatype_ptr);
     }

Modified: mpich2/trunk/src/mpid/dcmfd/src/impl/mpid_request.c
===================================================================
--- mpich2/trunk/src/mpid/dcmfd/src/impl/mpid_request.c	2011-02-04 22:55:46 UTC (rev 7915)
+++ mpich2/trunk/src/mpid/dcmfd/src/impl/mpid_request.c	2011-02-04 22:55:48 UTC (rev 7916)
@@ -48,6 +48,7 @@
   req->status.count      = 0;
   req->status.cancelled  = FALSE;
   req->comm              = NULL;
+  req->greq_fns          = NULL;
 
   struct MPIDI_DCMF_Request* dcmf = &req->dcmf;
   if (DCQuad_sizeof(MPIDI_DCMF_MsgInfo) == 1)
@@ -80,6 +81,7 @@
   if ( (req->ref_count == 0) && (MPID_Request_get_cc(req) == 0) )
     {
       if (req->comm)              MPIR_Comm_release(req->comm, 0);
+      if (req->greq_fns != NULL)  MPIU_Free(req->greq_fns);
       if (req->dcmf.datatype_ptr) MPID_Datatype_release(req->dcmf.datatype_ptr);
       MPIU_Handle_obj_free(&MPID_Request_mem, req);
     }



More information about the mpich2-commits mailing list