ZC Direct API: do not reconstruct callback data when unnecessary 22/4422/2
authorNitin Bhat <nbhat4@illinois.edu>
Mon, 30 Jul 2018 21:04:02 +0000 (16:04 -0500)
committerNitin Bhat <nbhat4@illinois.edu>
Tue, 7 Aug 2018 20:10:37 +0000 (15:10 -0500)
Change-Id: I6b1dde7b5515a58bb22237035957281f085c85e4

src/ck-core/ckrdma.C

index fc7e015b8591661431a7795535826202c46d3bcc..794bedbdd176f886df5ce21b094f01a7956011e1 100644 (file)
@@ -327,26 +327,31 @@ void CkRdmaDirectAckHandler(void *ack) {
   CkCallback *srcCb = (CkCallback *)(info->srcAck);
   CkCallback *destCb = (CkCallback *)(info->destAck);
 
-  // reconstruct the CkNcpyBuffer object for the source
-  CkNcpyBuffer src;
-  src.ptr = info->srcPtr;
-  src.pe  = info->srcPe;
-  src.cnt = info->srcSize;
-  src.ref = info->srcRef;
-  src.mode = info->srcMode;
-  src.isRegistered = info->isSrcRegistered;
-  memcpy((char *)(&src.cb), srcCb, info->srcAckSize); // initialize cb
-  memcpy((char *)(src.layerInfo), info->srcLayerInfo, info->srcLayerSize); // initialize layerInfo
-
-  CkNcpyBuffer dest;
-  dest.ptr = info->destPtr;
-  dest.pe  = info->destPe;
-  dest.cnt = info->destSize;
-  dest.ref = info->destRef;
-  dest.mode = info->destMode;
-  dest.isRegistered = info->isDestRegistered;
-  memcpy((char *)(&dest.cb), destCb, info->destAckSize); // initialize cb
-  memcpy((char *)(dest.layerInfo), info->destLayerInfo, info->destLayerSize); // initialize layerInfo
+  CkNcpyBuffer src, dest;
+
+  if(srcCb->requiresMsgConstruction()) {
+    // reconstruct the CkNcpyBuffer object for the source
+    src.ptr = info->srcPtr;
+    src.pe  = info->srcPe;
+    src.cnt = info->srcSize;
+    src.ref = info->srcRef;
+    src.mode = info->srcMode;
+    src.isRegistered = info->isSrcRegistered;
+    memcpy((char *)(&src.cb), srcCb, info->srcAckSize); // initialize cb
+    memcpy((char *)(src.layerInfo), info->srcLayerInfo, info->srcLayerSize); // initialize layerInfo
+  }
+
+  if(destCb->requiresMsgConstruction()) {
+    // reconstruct the CkNcpyBuffer object for the destination
+    dest.ptr = info->destPtr;
+    dest.pe  = info->destPe;
+    dest.cnt = info->destSize;
+    dest.ref = info->destRef;
+    dest.mode = info->destMode;
+    dest.isRegistered = info->isDestRegistered;
+    memcpy((char *)(&dest.cb), destCb, info->destAckSize); // initialize cb
+    memcpy((char *)(dest.layerInfo), info->destLayerInfo, info->destLayerSize); // initialize layerInfo
+  }
 
   if(info->ackMode == 0 || info->ackMode == 1) {