fixed a bug in pumpMsgs.
authorGengbin Zheng <gzheng@illinois.edu>
Fri, 29 Jul 2011 00:55:27 +0000 (17:55 -0700)
committerGengbin Zheng <gzheng@illinois.edu>
Fri, 29 Jul 2011 00:55:27 +0000 (17:55 -0700)
src/arch/gemini_gni/machine.c
src/arch/util/machine-common.c

index dfd472cc5bb75f7a319deb8eb7c0f9d61b89a8b1..69d955bd09e0257d2f1ba3a58eca72e436d10ab8 100644 (file)
@@ -40,7 +40,7 @@ static void sleep(int secs) {
 #define DEBUY_PRINT
 
 #ifdef DEBUY_PRINT
-#define PRINT_INFO(msg) {fprintf(stdout, "%s\n", msg); fflush(stdout);}
+#define PRINT_INFO(msg) {fprintf(stdout, "[%d] %s\n", CmiMyPe(), msg); fflush(stdout);}
 #else
 #define PRINT_INFO(msg)
 #endif
@@ -53,7 +53,7 @@ static int size, rank;
 #define FMA_BUFFER_SIZE 1024
 #define SMSG_PER_MSG    1024
 #define SMSG_MAX_CREDIT 16
-#define SMSG_BUFFER_SIZE        10240
+#define SMSG_BUFFER_SIZE        102400
 #define FMA_BTE_THRESHOLD  4096
 #define MSGQ_MAXSIZE       4096
 
@@ -383,6 +383,8 @@ static int send_with_smsg(int destNode, int size, char *msg)
             buffered_smsg_tail = msg_tmp;
             return 0;
         }
+        else
+            GNI_RC_CHECK("GNI_SmsgSendWTag", status);
     }
 }
 
@@ -432,8 +434,10 @@ static void PumpMsgs()
     if((status = GNI_SmsgGetNextWTag(ep_hndl_array[inst_id], &header, &tag_data)) == GNI_RC_SUCCESS)
     {
         /* copy msg out and then put into queue */
-        memcpy(&msg_nbytes, header, sizeof(int));   
+        // memcpy(&msg_nbytes, header, sizeof(int));   
+        msg_nbytes = *(int*)header;
         msg_data = CmiAlloc(msg_nbytes);
+        memcpy(msg_data, (char*)header+sizeof(int), msg_nbytes);
         handleOneRecvedMsg(msg_nbytes, msg_data);
         GNI_SmsgRelease(ep_hndl_array[inst_id]);
     } else if ((status = GNI_SmsgGetNextWTag(ep_hndl_array[inst_id], &header, &tag_control)) == GNI_RC_SUCCESS)
index 706586d992e05452df97aa8613dce390efff8a53..b5dd3c4d64b33662eb65c11b4fd5f7ed4bdee9b6 100644 (file)
 #define CMI_DEST_RANK(msg)               ((CmiMsgHeaderBasic *)msg)->rank
 #define CMI_SET_BROADCAST_ROOT(msg, root)  CMI_BROADCAST_ROOT(msg) = (root);
 
-#if USE_COMMON_SYNC_BCAST || USE_COMMON_ASYNC_BCAST
-#if !CMK_BROADCAST_SPANNING_TREE && !CMK_BROADCAST_HYPERCUBE
-#warning "Broadcast function is based on the plain P2P O(P)-message scheme!!!"
-#endif
-#endif
-
 /**
  * For some machine layers such as on Active Message framework,
  * the receiver callback is usally executed on an internal
@@ -181,6 +175,12 @@ void CmiPushNode(void *msg);
 #define USE_COMMON_ASYNC_BCAST 1
 #endif
 
+#if USE_COMMON_SYNC_BCAST || USE_COMMON_ASYNC_BCAST
+#if !CMK_BROADCAST_SPANNING_TREE && !CMK_BROADCAST_HYPERCUBE
+#warning "Broadcast function is based on the plain P2P O(P)-message scheme!!!"
+#endif
+#endif
+
 static void CmiSendSelf(char *msg);
 
 void CmiSyncSendFn(int destPE, int size, char *msg);