a better fix.
authorGengbin Zheng <gzheng@illinois.edu>
Thu, 6 Dec 2007 05:38:47 +0000 (05:38 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Thu, 6 Dec 2007 05:38:47 +0000 (05:38 +0000)
src/ck-core/ckreduction.C
src/ck-core/ckreduction.h

index 769e79ba0d6765a23dd67610bc50e6af615e722f..f18274ccab639d864d6a0d85fb50ab02637b6397 100644 (file)
@@ -95,6 +95,14 @@ Group::Group()
        nodeProxy = nodetemp;
 }
 
+Group::Group(CkMigrateMessage *msg):CkReductionMgr(msg)
+{
+       creatingContributors();
+       contributorStamped(&reductionInfo);
+       contributorCreated(&reductionInfo);
+       doneCreatingContributors();
+}
+
 CK_REDUCTION_CONTRIBUTE_METHODS_DEF(Group,
                                    ((CkReductionMgr *)this),
                                    reductionInfo,false);
@@ -175,6 +183,11 @@ CkReductionMgr::CkReductionMgr()//Constructor
   DEBR((AA"In reductionMgr constructor at %d \n"AB,this));
 }
 
+CkReductionMgr::CkReductionMgr(CkMigrateMessage *m) :CkGroupInitCallback(m)
+{
+  gcount=lcount=0;
+}
+
 void CkReductionMgr::flushStates()
 {
   // CmiPrintf("[%d] CkReductionMgr::flushState\n", CkMyPe());
@@ -667,12 +680,18 @@ void CkReductionMgr::pup(PUP::er &p)
   p|adjVec;
   p|nodeProxy;
   p|storedCallback;
-  p|lcount;
-  p|gcount;
+
+  // subtle --- Gengbin
+  // Group : CkReductionMgr
+  // CkArray: CkReductionMgr
+  // lcount/gcount in Group is set in Group constructor
+  // lcount/gcount in CkArray is not, it is set when array elements are created
+  // we can not pup because inserting array elems will add the counters again
+//  p|lcount;
+//  p|gcount;
+
   if(p.isUnpacking()){
     thisProxy = thisgroup;
-//    lcount=0;
-//    gcount=0;
     maxStartRequest=0;
   }
 #if DEBUGRED
index 72c889b0df897360517cddbb71f2b582a6ce2638..dfa1750ad1db3cacc6927661bc67b066da5f0a23 100644 (file)
@@ -88,7 +88,7 @@ public:
 public:
        CProxy_CkArrayReductionMgr nodeProxy; //holds the local branch of the nodegroup tree
        CkReductionMgr(void);
-       CkReductionMgr(CkMigrateMessage *m) :CkGroupInitCallback(m) {}
+       CkReductionMgr(CkMigrateMessage *m);
 
        typedef CkReductionClientFn clientFn;
 
@@ -335,7 +335,7 @@ class Group : public CkReductionMgr
        contributorInfo reductionInfo;//My reduction information
  public:
        Group();
-       Group(CkMigrateMessage *msg):CkReductionMgr(msg) {}
+       Group(CkMigrateMessage *msg);
        virtual int isNodeGroup() { return 0; }
        virtual void pup(PUP::er &p);
        virtual void flushStates() {