[mpich2-commits] r7778 - in mpich2/trunk/src/mpid/ch3/channels/nemesis: nemesis/include src

goodell at mcs.anl.gov goodell at mcs.anl.gov
Thu Jan 20 16:08:39 CST 2011


Author: goodell
Date: 2011-01-20 16:08:39 -0600 (Thu, 20 Jan 2011)
New Revision: 7778

Modified:
   mpich2/trunk/src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_inline.h
   mpich2/trunk/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
Log:
refactor blocking recv safety check into a common macro

The logic is duplicated in at least two places, leading to a potential error
in the future when new criteria are added.

Reviewed by balaji at .

Modified: mpich2/trunk/src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_inline.h
===================================================================
--- mpich2/trunk/src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_inline.h	2011-01-20 22:08:36 UTC (rev 7777)
+++ mpich2/trunk/src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_inline.h	2011-01-20 22:08:39 UTC (rev 7778)
@@ -32,6 +32,12 @@
 static inline void MPID_nem_mpich2_send_seg (MPID_Segment *segment, MPIDI_msg_sz_t *segment_first, MPIDI_msg_sz_t segment_size,
                                                     MPIDI_VC_t *vc, int *again);
 
+/* evaluates to TRUE if it is safe to block on recv operations in the progress
+ * loop, FALSE otherwise */
+#define MPID_nem_safe_to_block_recv()         \
+    (!MPID_nem_local_lmt_pending               && \
+     !MPIDI_CH3I_active_send[CH3_NORMAL_QUEUE] && \
+     !MPIDI_CH3I_SendQ_head(CH3_NORMAL_QUEUE))
 
 #undef FUNCNAME
 #define FUNCNAME MPID_nem_mpich2_send_header
@@ -904,8 +910,7 @@
 	    mpi_errno = MPID_nem_network_poll(TRUE /* blocking */);
             if (mpi_errno) MPIU_ERR_POP (mpi_errno);
 
-            if (MPID_nem_local_lmt_pending || MPIDI_CH3I_active_send[CH3_NORMAL_QUEUE]
-                || MPIDI_CH3I_SendQ_head(CH3_NORMAL_QUEUE))
+            if (!MPID_nem_safe_to_block_recv())
             {
                 *cell = NULL;
                 *in_fbox = 0;

Modified: mpich2/trunk/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
===================================================================
--- mpich2/trunk/src/mpid/ch3/channels/nemesis/src/ch3_progress.c	2011-01-20 22:08:36 UTC (rev 7777)
+++ mpich2/trunk/src/mpid/ch3/channels/nemesis/src/ch3_progress.c	2011-01-20 22:08:39 UTC (rev 7778)
@@ -330,8 +330,7 @@
 
             /* make progress receiving */
             /* check queue */
-            if (!MPID_nem_local_lmt_pending && !MPIDI_CH3I_active_send[CH3_NORMAL_QUEUE]
-                && !MPIDI_CH3I_SendQ_head(CH3_NORMAL_QUEUE) && is_blocking
+            if (MPID_nem_safe_to_block_recv() && is_blocking
 #ifdef MPICH_IS_THREADED
 #ifdef HAVE_RUNTIME_THREADCHECK
                 && !MPIR_ThreadInfo.isThreaded



More information about the mpich2-commits mailing list