Merge branch 'charm' of charmgit:charm into charm
authorNikhil Jain <nikhil@illinois.edu>
Tue, 4 Oct 2011 07:50:50 +0000 (02:50 -0500)
committerNikhil Jain <nikhil@illinois.edu>
Tue, 4 Oct 2011 07:50:50 +0000 (02:50 -0500)
src/arch/mpi/machine.c
src/arch/util/machine-broadcast.c

index f3bdb926be9bfdfd8854a623c12f44e8ddc4072c..07450acf20d14a5d943f8d29fe8cb892ea044851 100644 (file)
@@ -301,18 +301,11 @@ static void EnqueueMsg(void *m, int size, int node) {
 #endif
 
 /* The function that calls MPI_Isend so that both non-SMP and SMP could use */
-static CmiCommHandle MPISendOneMsg(SMSG_LIST *smsg) {
+static CmiCommHandle MPISendOneMsg(SMSG_LIST *smsg, int mode) {
     int node = smsg->destpe;
     int size = smsg->size;
     char *msg = smsg->msg;
 
-#if !CMI_DYNAMIC_EXERT_CAP && !CMI_EXERT_SEND_CAP
-    while (MsgQueueLen > request_max) {
-        CmiReleaseSentMessages();
-        PumpMsgs();
-    }
-#endif
-
     MACHSTATE2(3,"MPI_send to node %d rank: %d{", node, CMI_DEST_RANK(msg));
 #if CMK_ERROR_CHECKING
     CMI_MAGIC(msg) = CHARM_MAGIC_NUMBER;
@@ -364,6 +357,17 @@ static CmiCommHandle MPISendOneMsg(SMSG_LIST *smsg) {
     else
         end_sent->next = smsg;
     end_sent = smsg;
+
+#if !CMI_DYNAMIC_EXERT_CAP && !CMI_EXERT_SEND_CAP
+    if (mode == P2P_SYNC || mode == P2P_ASYNC)
+    {
+    while (MsgQueueLen > request_max) {
+        CmiReleaseSentMessages();
+        PumpMsgs();
+    }
+    }
+#endif
+
     return (CmiCommHandle) &(smsg->req);
 }
 
@@ -385,7 +389,7 @@ static CmiCommHandle MachineSpecificSendForMPI(int destNode, int size, char *msg
     msg_tmp->destpe = destNode;
     msg_tmp->size = size;
     msg_tmp->next = 0;
-    return MPISendOneMsg(msg_tmp);
+    return MPISendOneMsg(msg_tmp, mode);
 #endif
 }
 
index 3232e5420113b87c7f6c5163bd263f96cc443aea..523b9b6ff9870b4d6c989b65c7dbb87e4fc24660 100644 (file)
@@ -94,10 +94,10 @@ static void SendSpanningChildren(int size, char *msg, int rankToAssign, int star
         CmiAssert(nd>=0 && nd!=CmiMyNode());
 #if CMK_BROADCAST_USE_CMIREFERENCE
         CmiReference(msg);
-        LrtsSendFunc(nd, size, msg, P2P_SYNC);
+        LrtsSendFunc(nd, size, msg, BCAST_SYNC);
 #else
         newmsg = CopyMsg(msg, size);
-        LrtsSendFunc(nd, size, newmsg, P2P_SYNC);
+        LrtsSendFunc(nd, size, newmsg, BCAST_SYNC);
 #endif
     }
     CMI_DEST_RANK(msg) = oldRank;
@@ -142,10 +142,10 @@ static void SendHyperCube(int size,  char *msg, int rankToAssign, int startNode)
         CmiAssert(nd>=0 && nd!=CmiMyNode());
 #if CMK_BROADCAST_USE_CMIREFERENCE
         CmiReference(msg);
-        LrtsSendFunc(nd, size, msg, P2P_SYNC);
+        LrtsSendFunc(nd, size, msg, BCAST_SYNC);
 #else
         char *newmsg = CopyMsg(msg, size);
-        LrtsSendFunc(nd, size, newmsg, P2P_SYNC);
+        LrtsSendFunc(nd, size, newmsg, BCAST_SYNC);
 #endif
     }
     CMI_DEST_RANK(msg) = oldRank;