fix debug print error in cmidirect
authorYanhua Sun <sun51@hopper05.(none)>
Mon, 27 Feb 2012 02:36:38 +0000 (18:36 -0800)
committerYanhua Sun <sun51@hopper05.(none)>
Mon, 27 Feb 2012 02:36:38 +0000 (18:36 -0800)
src/arch/gemini_gni/machine-cmidirect.c
src/arch/gemini_gni/machine.c

index 2cedf6525cecd4daebf94d2c28d32fe6df24d529..b2e310181418767881fd4823ad11ddd6e5ff1fe8 100644 (file)
@@ -8,7 +8,7 @@
   Yanhua Sun, 2/5/2012
 */
 
-#define     CMI_DIRECT_DEBUG    1
+#define     CMI_DIRECT_DEBUG    0
 #include "cmidirect.h"
 
 CmiDirectMemoryHandler CmiDirect_registerMemory(void *buff, int size)
@@ -40,7 +40,7 @@ struct infiDirectUserHandle CmiDirect_createHandle_mem(CmiDirectMemoryHandler *m
 
     userHandle.initialValue=0;
 #if CMI_DIRECT_DEBUG
-    printHandle(&userHandle, "Create Handler");
+    //printHandle(&userHandle, "Create Handler");
 #endif
     return userHandle;
 
@@ -76,7 +76,7 @@ CmiDirectUserHandle CmiDirect_createHandle(int localNode,void *recvBuf, int recv
     }
 
 #if CMI_DIRECT_DEBUG
-    printHandle(&userHandle, "Create Handler");
+    //printHandle(&userHandle, "Create Handler");
 #endif
     return userHandle;
 }
@@ -156,26 +156,18 @@ void CmiDirect_put(CmiDirectUserHandle *userHandle) {
         pd->first_operand   = (uint64_t) (userHandle->callbackFnPtr);
         pd->second_operand  = (uint64_t) (userHandle->callbackData);
         pd->amo_cmd         = 1;
-        pd->cqwrite_value   = 0;        
-       // if(pd->type == GNI_POST_RDMA_PUT) 
-       //     status = GNI_PostRdma(ep_hndl_array[userHandle->remoteNode], pd);
-       // else
-       //     status = GNI_PostFma(ep_hndl_array[userHandle->remoteNode],  pd);
-        //if(status == GNI_RC_ERROR_RESOURCE|| status == GNI_RC_ERROR_NOMEM )
-        //{
-            bufferRdmaMsg(userHandle->remoteNode, pd); 
-        //}else
-        //    GNI_RC_CHECK("CMI_Direct_PUT", status);
+        pd->cqwrite_value   = 1;        
+        bufferRdmaMsg(userHandle->remoteNode, pd); 
+#if CMI_DIRECT_DEBUG
+        printHandle(userHandle, "After Direct_put");
+        CmiPrintf("[%d] RDMA put %d,%d bytes addr %p to remoteNode %d:%p \n\n",CmiMyPe(), userHandle->transSize, pd->length, (void*)(pd->local_addr), userHandle->remoteNode, (void*) (pd->remote_addr));
+#endif
     }
 #else
     CmiPrintf("Normal Send in CmiDirect Put\n");
     CmiAbort("");
 #endif
 
-#if CMI_DIRECT_DEBUG
-    printHandle(userHandle, "After Direct_put");
-    CmiPrintf("[%d] RDMA put %d,%d bytes addr %p to remoteNode %d:%p \n\n",CmiMyPe(), userHandle->transSize, pd->length, (void*)(pd->local_addr), userHandle->remoteNode, (void*) (pd->remote_addr));
-#endif
 
 }
 
@@ -208,24 +200,17 @@ void CmiDirect_get(CmiDirectUserHandle *userHandle) {
         pd->first_operand   = (uint64_t) (userHandle->callbackFnPtr);
         pd->second_operand  = (uint64_t) (userHandle->callbackData);
         pd->amo_cmd         = 2;
-   //     if(pd->type == GNI_POST_RDMA_GET) 
-   //         status = GNI_PostRdma(ep_hndl_array[userHandle->remoteNode], pd);
-   //     else
-   //         status = GNI_PostFma(ep_hndl_array[userHandle->remoteNode],  pd);
-   //     if(status == GNI_RC_ERROR_RESOURCE|| status == GNI_RC_ERROR_NOMEM )
-   //     {
-            bufferRdmaMsg(userHandle->remoteNode, pd); 
-   //     }else
-   //         GNI_RC_CHECK("CMI_Direct_GET", status);
+        pd->cqwrite_value   = 1;
+        bufferRdmaMsg(userHandle->remoteNode, pd); 
+#if CMI_DIRECT_DEBUG
+    CmiPrintf("[%d] RDMA get %d,%d bytes addr %p to remoteNode %d:%p \n\n",CmiMyPe(), userHandle->transSize, pd->length, (void*)(pd->local_addr), userHandle->remoteNode, (void*) (pd->remote_addr));
+#endif
     }
 #else
     CmiPrintf("Normal Send in CmiDirect Get\n");
     CmiAbort("");
 #endif
 
-#if CMI_DIRECT_DEBUG
-    CmiPrintf("[%d] RDMA get %d,%d bytes addr %p to remoteNode %d:%p \n\n",CmiMyPe(), userHandle->transSize, pd->length, (void*)(pd->local_addr), userHandle->remoteNode, (void*) (pd->remote_addr));
-#endif
 
 
 }
index 5bd5573a883b00908be54652f2fbb5977732d715..a1092f9864603175fa0750f9f52018073de5f110 100644 (file)
@@ -478,7 +478,8 @@ static gni_post_descriptor_t *post_freelist=0;
   d = post_freelist;\
   if (d==0) { \
      d = ((gni_post_descriptor_t*)malloc(sizeof(gni_post_descriptor_t)));\
-     _MEMCHECK(d);\
+     d->next_descr = 0;\
+      _MEMCHECK(d);\
   } else post_freelist = d->next_descr;
 #else
 
@@ -1936,7 +1937,7 @@ static void  SendRdmaMsg()
                 register_size = GetMempoolsize((void*)(pd->local_addr));
             else
                 register_size = 0;
-        }else if( IsMemHndlZero(pd->local_mem_hndl)) //big msg, can not fit into memory pool
+        }else if( IsMemHndlZero(pd->local_mem_hndl)) //big msg, can not fit into memory pool, or CmiDirect Msg (which is not from mempool)
         {
             status = registerMemory((void*)(pd->local_addr), pd->length, &(pd->local_mem_hndl)); 
         }