[mpich2-commits] r7965 - mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad

mercierg at mcs.anl.gov mercierg at mcs.anl.gov
Tue Feb 15 02:42:48 CST 2011


Author: mercierg
Date: 2011-02-15 02:42:48 -0600 (Tue, 15 Feb 2011)
New Revision: 7965

Modified:
   mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_impl.h
   mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_probe.c
Log:
Fixed Newmad probe


Modified: mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_impl.h
===================================================================
--- mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_impl.h	2011-02-15 02:27:27 UTC (rev 7964)
+++ mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_impl.h	2011-02-15 08:42:48 UTC (rev 7965)
@@ -151,12 +151,12 @@
     ((_match) |= (((nm_tag_t)((_tag)&(NEM_NMAD_MAX_TAG))) << SHIFT_TAG)); \
     }while(0)
 #define NEM_NMAD_SET_SRC(_match, _src) do {               \
-    MPIU_Assert(_src >= 0)&&(_src<=(NEM_NMAD_MAX_RANK))); \
+    MPIU_Assert((_src >= 0)&&(_src<=(NEM_NMAD_MAX_RANK)));\
     ((_match) |= (((nm_tag_t)(_src)) << SHIFT_RANK));     \
     }while(0)
-#define NEM_NMAD_SET_CTXT(_match, _ctxt) do {              \
-    MPIU_Assert(_ctxt >= 0)&&(_ctxt<=(NEM_NMAD_MAX_CTXT)));\
-    ((_match) |= (((nm_tag_t)(_ctxt)) << SHIFT_CTXT));	   \
+#define NEM_NMAD_SET_CTXT(_match, _ctxt) do {               \
+    MPIU_Assert((_ctxt >= 0)&&(_ctxt<=(NEM_NMAD_MAX_CTXT)));\
+    ((_match) |= (((nm_tag_t)(_ctxt)) << SHIFT_CTXT));	    \
     }while(0)
 #define NEM_NMAD_SET_PGRANK(_match, _pg_rank)  do {        \
     ((_match) |= (((nm_tag_t)(_pg_rank)) << SHIFT_PGRANK));\

Modified: mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_probe.c
===================================================================
--- mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_probe.c	2011-02-15 02:27:27 UTC (rev 7964)
+++ mpich2/branches/release/mpich2-1.3.x/src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_probe.c	2011-02-15 08:42:48 UTC (rev 7965)
@@ -17,10 +17,25 @@
     nm_tag_t  match_info = 0;
     nm_tag_t  match_mask = NEM_NMAD_MATCH_FULL_MASK;
     nm_gate_t out_gate;
+    nm_gate_t in_gate;
+    int out_tag;
+    int size;   
     int mpi_errno = MPI_SUCCESS;
     int ret;
 
-    NEM_NMAD_DIRECT_MATCH(match_info,0,source,comm->context_id + context_offset);
+    NEM_NMAD_SET_CTXT(match_info,comm->context_id + context_offset);
+    if( source  == MPI_ANY_SOURCE)
+    {
+       NEM_NMAD_SET_ANYSRC(match_info);
+       NEM_NMAD_SET_ANYSRC(match_mask);
+       in_gate = NM_ANY_GATE;
+    }
+    else
+    { 
+	NEM_NMAD_SET_SRC(match_info,source);
+	in_gate = VC_FIELD(vc,p_gate);
+    }
+   
     if (tag != MPI_ANY_TAG)
     {
         NEM_NMAD_SET_TAG(match_info,tag);
@@ -32,14 +47,32 @@
     }
 
     do {
-	ret = nm_sr_probe(mpid_nem_newmad_session,VC_FIELD(vc,p_gate),&out_gate,match_info,match_mask);
+	ret = nm_sr_probe(mpid_nem_newmad_session,in_gate,&out_gate,
+			  match_info,match_mask,&out_tag,&size);
     }
     while (ret != NM_ESUCCESS);
 
-    status->MPI_SOURCE = source;
-    status->MPI_TAG = tag;
-    status->count = 0; /* FIXME */
-
+   if (source != MPI_ANY_SOURCE)
+     status->MPI_SOURCE = source;
+   else 
+     {	
+	MPIDI_VC_t *vc;
+	int         index;
+	vc = (MPIDI_VC_t *)nm_gate_ref_get(out_gate);
+	for(index = 0 ; index < comm->local_size ; index ++)
+	  if (vc == comm->vcr[index])
+	    break;
+	status->MPI_SOURCE = index;
+     }
+   
+   if (tag != MPI_ANY_TAG)
+     status->MPI_TAG = tag;
+   else
+     status->MPI_TAG = out_tag;
+   
+   status->count = size;
+   *flag = TRUE;
+   
  fn_exit:
     return mpi_errno;
  fn_fail:  ATTRIBUTE((unused))
@@ -57,10 +90,25 @@
     nm_tag_t  match_info = 0;
     nm_tag_t  match_mask = NEM_NMAD_MATCH_FULL_MASK;
     nm_gate_t out_gate;
+    nm_gate_t in_gate;
+    int size;
+    int out_tag;
     int mpi_errno = MPI_SUCCESS;
     int ret;
 
-    NEM_NMAD_DIRECT_MATCH(match_info,0,source,comm->context_id + context_offset);
+    NEM_NMAD_SET_CTXT(match_info,comm->context_id + context_offset);
+    if( source  == MPI_ANY_SOURCE)
+    {
+       NEM_NMAD_SET_ANYSRC(match_info);
+       NEM_NMAD_SET_ANYSRC(match_mask);
+       in_gate = NM_ANY_GATE;
+    }
+    else
+    {
+	NEM_NMAD_SET_SRC(match_info,source);
+	in_gate = VC_FIELD(vc,p_gate);
+    }
+   
     if (tag != MPI_ANY_TAG)
     {
         NEM_NMAD_SET_TAG(match_info,tag);
@@ -71,21 +119,33 @@
        NEM_NMAD_SET_ANYTAG(match_mask);
     }
 
-    ret = nm_sr_probe(mpid_nem_newmad_session,VC_FIELD(vc,p_gate),&out_gate,match_info,match_mask);
+    ret = nm_sr_probe(mpid_nem_newmad_session,in_gate,&out_gate,
+		      match_info,match_mask,&out_tag,&size);
     if (ret == NM_ESUCCESS)
     {   
-	/*
-	size_t size;
-	nm_sr_get_size(mpid_nem_newmad_session, p_out_req, &size);
-	*/
-
-	status->MPI_SOURCE = source;
-	status->MPI_TAG = tag;
-	status->count = 0; /* FIXME */
-	*flag = TRUE;	
+       if (source != MPI_ANY_SOURCE)
+	 status->MPI_SOURCE = source;
+       else 
+	 {	    
+	    MPIDI_VC_t *vc;
+	    int         index;
+	    vc = (MPIDI_VC_t *)nm_gate_ref_get(out_gate);
+	    for(index = 0 ; index < comm->local_size ; index ++)
+	      if (vc == comm->vcr[index])
+		break;
+	    status->MPI_SOURCE = index;
+	 }
+       
+       if (tag != MPI_ANY_TAG)
+	 status->MPI_TAG = tag;
+       else
+	 status->MPI_TAG = out_tag;
+       
+       status->count = size;
+       *flag = TRUE;
     }
     else
-	*flag = FALSE;
+     *flag = FALSE;
  
  fn_exit:
     return mpi_errno;



More information about the mpich2-commits mailing list