1. support nodegroup in ckcallbacks
authorGengbin Zheng <gzheng@illinois.edu>
Wed, 5 Dec 2007 23:48:33 +0000 (23:48 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Wed, 5 Dec 2007 23:48:33 +0000 (23:48 +0000)
2. reduction client is now pup'ed in nodegroup reduction manager.

src/ck-core/ckcallback.C
src/ck-core/ckcallback.h
src/ck-core/ckreduction.C

index b35593df51968b35b3b934f0f0ce58328d5314e2..76f677cd928882bd79336d7926c2cd780f9bd119 100644 (file)
@@ -71,6 +71,18 @@ void *CkCallback::impl_thread_delay(void) const
 /*These can't be defined in the .h file like the other constructors
  * because we need CkCallback before CProxyElement* are defined.
  */
 /*These can't be defined in the .h file like the other constructors
  * because we need CkCallback before CProxyElement* are defined.
  */
+CkCallback::CkCallback(int ep,const CProxy_NodeGroup &ngp)
+               :type(bcastNodeGroup) 
+{
+       d.group.ep=ep; d.group.id=ngp.ckGetGroupID();
+}
+
+CkCallback::CkCallback(int ep,int onPE,const CProxy_NodeGroup &ngp,CmiBool doInline)
+       :type(doInline?isendNodeGroup:sendNodeGroup) 
+{
+       d.group.ep=ep; d.group.id=ngp.ckGetGroupID(); d.group.onPE=onPE;
+}
+
 CkCallback::CkCallback(int ep,const CProxyElement_Group &grpElt,CmiBool doInline) 
        :type(doInline?isendGroup:sendGroup) 
 {
 CkCallback::CkCallback(int ep,const CProxyElement_Group &grpElt,CmiBool doInline) 
        :type(doInline?isendGroup:sendGroup) 
 {
@@ -139,10 +151,18 @@ void CkCallback::send(void *msg) const
                if (!msg) msg=CkAllocSysMsg();
                CkSendMsgBranch(d.group.ep,msg,d.group.onPE,d.group.id);
                break;
                if (!msg) msg=CkAllocSysMsg();
                CkSendMsgBranch(d.group.ep,msg,d.group.onPE,d.group.id);
                break;
+       case sendNodeGroup: //Send message to a group element
+               if (!msg) msg=CkAllocSysMsg();
+               CkSendMsgNodeBranch(d.group.ep,msg,d.group.onPE,d.group.id);
+               break;
        case isendGroup: //inline send-to-group element
                if (!msg) msg=CkAllocSysMsg();
                CkSendMsgBranchInline(d.group.ep,msg,d.group.onPE,d.group.id);
                break;
        case isendGroup: //inline send-to-group element
                if (!msg) msg=CkAllocSysMsg();
                CkSendMsgBranchInline(d.group.ep,msg,d.group.onPE,d.group.id);
                break;
+       case isendNodeGroup: //inline send-to-group element
+               if (!msg) msg=CkAllocSysMsg();
+               CkSendMsgNodeBranchInline(d.group.ep,msg,d.group.onPE,d.group.id);
+               break;
        case sendArray: //Send message to an array element
                if (!msg) msg=CkAllocSysMsg();
                CkSendMsgArray(d.array.ep,msg,d.array.id,d.array.idx.asMax());
        case sendArray: //Send message to an array element
                if (!msg) msg=CkAllocSysMsg();
                CkSendMsgArray(d.array.ep,msg,d.array.id,d.array.idx.asMax());
@@ -155,6 +175,10 @@ void CkCallback::send(void *msg) const
                if (!msg) msg=CkAllocSysMsg();
                CkBroadcastMsgBranch(d.group.ep,msg,d.group.id);
                break;
                if (!msg) msg=CkAllocSysMsg();
                CkBroadcastMsgBranch(d.group.ep,msg,d.group.id);
                break;
+       case bcastNodeGroup:
+               if (!msg) msg=CkAllocSysMsg();
+               CkBroadcastMsgNodeBranch(d.group.ep,msg,d.group.id);
+               break;
        case bcastArray:
                if (!msg) msg=CkAllocSysMsg();
                CkBroadcastMsgArray(d.array.ep,msg,d.array.id);
        case bcastArray:
                if (!msg) msg=CkAllocSysMsg();
                CkBroadcastMsgArray(d.array.ep,msg,d.array.id);
index 9a8b6dd7205b86bdfd871ac01662335b71f15032..fe1025661a54f6236cfbc3b8d7b1aca788a09258 100644 (file)
@@ -19,6 +19,7 @@ typedef void (*Ck1CallbackFn)(void *message);
 
 class CProxyElement_ArrayBase; /*forward declaration*/
 class CProxyElement_Group; /*forward declaration*/
 
 class CProxyElement_ArrayBase; /*forward declaration*/
 class CProxyElement_Group; /*forward declaration*/
+class CProxy_NodeGroup;
 
 class CkCallback {
 public:
 
 class CkCallback {
 public:
@@ -31,11 +32,14 @@ public:
        call1Fn, //Call a C function pointer on any processor (d.c1fn)
        sendChare, //Send to a chare (d.chare)
        sendGroup, //Send to a group (d.group)
        call1Fn, //Call a C function pointer on any processor (d.c1fn)
        sendChare, //Send to a chare (d.chare)
        sendGroup, //Send to a group (d.group)
+       sendNodeGroup, //Send to a nodegroup (d.group)
        sendArray, //Send to an array (d.array)
        isendChare, //Inlined send to a chare (d.chare)
        isendGroup, //Inlined send to a group (d.group)
        sendArray, //Send to an array (d.array)
        isendChare, //Inlined send to a chare (d.chare)
        isendGroup, //Inlined send to a group (d.group)
+       isendNodeGroup, //Inlined send to a nodegroup (d.group)
        isendArray, //Inlined send to an array (d.array)
        bcastGroup, //Broadcast to a group (d.group)
        isendArray, //Inlined send to an array (d.array)
        bcastGroup, //Broadcast to a group (d.group)
+       bcastNodeGroup, //Broadcast to a nodegroup (d.group)
        bcastArray, //Broadcast to an array (d.array)
        replyCCS // Reply to a CCS message (d.ccsReply)
        } callbackType;
        bcastArray, //Broadcast to an array (d.array)
        replyCCS // Reply to a CCS message (d.ccsReply)
        } callbackType;
@@ -97,12 +101,18 @@ public:
                :type(doInline?isendChare:sendChare) 
                {d.chare.ep=ep; d.chare.id=id;}
 
                :type(doInline?isendChare:sendChare) 
                {d.chare.ep=ep; d.chare.id=id;}
 
-       CkCallback(int ep,const CkGroupID &id)
-               :type(bcastGroup) 
+       CkCallback(int ep,const CProxy_NodeGroup &ngp);
+
+       CkCallback(int ep,const CkGroupID &id, int isNodeGroup=0)
+               :type(isNodeGroup?bcastNodeGroup:bcastGroup) 
                {d.group.ep=ep; d.group.id=id;}
                {d.group.ep=ep; d.group.id=id;}
-       CkCallback(int ep,int onPE,const CkGroupID &id,CmiBool doInline=CmiFalse)
-               :type(doInline?isendGroup:sendGroup) 
+
+       CkCallback(int ep,int onPE,const CProxy_NodeGroup &ngp,CmiBool doInline=CmiFalse);
+
+       CkCallback(int ep,int onPE,const CkGroupID &id,CmiBool doInline=CmiFalse, int isNodeGroup=0)
+               :type(doInline?(isNodeGroup?isendNodeGroup:isendGroup):(isNodeGroup?sendNodeGroup:sendGroup)) 
                {d.group.ep=ep; d.group.id=id; d.group.onPE=onPE;}
                {d.group.ep=ep; d.group.id=id; d.group.onPE=onPE;}
+
        CkCallback(int ep,const CProxyElement_Group &grpElt,CmiBool doInline=CmiFalse);
        
        CkCallback(int ep,const CkArrayID &id)
        CkCallback(int ep,const CProxyElement_Group &grpElt,CmiBool doInline=CmiFalse);
        
        CkCallback(int ep,const CkArrayID &id)
index dabc5ef0dac867444aede5d445ec3fda0455fe5a..769e79ba0d6765a23dd67610bc50e6af615e722f 100644 (file)
@@ -1778,7 +1778,7 @@ void CkNodeReductionMgr::pup(PUP::er &p)
   p|futureMsgs;
   p|futureRemoteMsgs;
   p|futureLateMigrantMsgs;
   p|futureMsgs;
   p|futureRemoteMsgs;
   p|futureLateMigrantMsgs;
-       p|parent;
+  p|parent;
   if(p.isUnpacking()) {
     gcount=CkNumNodes();
     thisProxy = thisgroup;
   if(p.isUnpacking()) {
     gcount=CkNumNodes();
     thisProxy = thisgroup;
@@ -1791,6 +1791,15 @@ void CkNodeReductionMgr::pup(PUP::er &p)
   }
   p | blocked;
   p | maxModificationRedNo;
   }
   p | blocked;
   p | maxModificationRedNo;
+
+  int isnull = (storedCallback == NULL);
+  p | isnull;
+  if (!isnull) {
+    if (p.isUnpacking()) {
+      storedCallback = new CkCallback;
+    }
+    p|*storedCallback;
+  }
 }
 
 /*
 }
 
 /*