1. a complete pup for CkReductionMgr (lcount/gcount), which fixed a bug in restart...
authorGengbin Zheng <gzheng@illinois.edu>
Wed, 5 Dec 2007 22:56:24 +0000 (22:56 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Wed, 5 Dec 2007 22:56:24 +0000 (22:56 +0000)
2. an error checking preventing user from using the default group constructor in the migratable constructor of a user group class.

src/ck-core/ckcheckpoint.C
src/ck-core/ckreduction.C

index d501150be9fc65fe186a1e242b8b286c31ad01dd..e2e5630bde59a443401395d2844daa2253c16494 100644 (file)
@@ -29,6 +29,8 @@ typedef struct _GroupInfo{
 PUPbytes(GroupInfo)
 PUPmarshall(GroupInfo)
 
 PUPbytes(GroupInfo)
 PUPmarshall(GroupInfo)
 
+int _inrestart = 0;
+
 // help class to find how many array elements
 class ElementCounter : public CkLocIterator {
 private:
 // help class to find how many array elements
 class ElementCounter : public CkLocIterator {
 private:
@@ -424,6 +426,8 @@ void CkRestartMain(const char* dirname){
        char filename[1024];
        CkCallback cb;
        
        char filename[1024];
        CkCallback cb;
        
+        _inrestart = 1;
+
        // restore readonlys
        sprintf(filename,"%s/RO.dat",dirname);
        FILE* fRO = fopen(filename,"rb");
        // restore readonlys
        sprintf(filename,"%s/RO.dat",dirname);
        FILE* fRO = fopen(filename,"rb");
@@ -489,6 +493,8 @@ void CkRestartMain(const char* dirname){
             }
          }
 
             }
          }
 
+        _inrestart = 0;
+
        _initDone();
 
        if(CkMyPe()==0) {
        _initDone();
 
        if(CkMyPe()==0) {
index c7bbd4a3ed23e8ca72f97297e0177582549a734e..dabc5ef0dac867444aede5d445ec3fda0455fe5a 100644 (file)
@@ -78,9 +78,12 @@ waits for the migrant contributions to straggle in.
 #define INT_MAX 2147483647
 #endif
 
 #define INT_MAX 2147483647
 #endif
 
+extern int _inrestart;
 
 Group::Group()
 {
 
 Group::Group()
 {
+       if (_inrestart) CmiAbort("A Group object did not call the migratable constructor of its base class!");
+
        creatingContributors();
        contributorStamped(&reductionInfo);
        contributorCreated(&reductionInfo);
        creatingContributors();
        contributorStamped(&reductionInfo);
        contributorCreated(&reductionInfo);
@@ -664,10 +667,12 @@ void CkReductionMgr::pup(PUP::er &p)
   p|adjVec;
   p|nodeProxy;
   p|storedCallback;
   p|adjVec;
   p|nodeProxy;
   p|storedCallback;
+  p|lcount;
+  p|gcount;
   if(p.isUnpacking()){
     thisProxy = thisgroup;
   if(p.isUnpacking()){
     thisProxy = thisgroup;
-    lcount=0;
-    gcount=0;
+//    lcount=0;
+//    gcount=0;
     maxStartRequest=0;
   }
 #if DEBUGRED
     maxStartRequest=0;
   }
 #if DEBUGRED
@@ -1181,7 +1186,7 @@ CkNodeReductionMgr::CkNodeReductionMgr()//Constructor
 #ifdef BINOMIAL_TREE
   init_BinomialTree();
 #else
 #ifdef BINOMIAL_TREE
   init_BinomialTree();
 #else
-       init_BinaryTree();
+  init_BinaryTree();
 #endif
   storedCallback=NULL;
   redNo=0;
 #endif
   storedCallback=NULL;
   redNo=0;
@@ -1284,12 +1289,12 @@ void CkNodeReductionMgr::contributeWithCounter(contributorInfo *ci,CkReductionMs
 void CkNodeReductionMgr::ReductionStarting(CkReductionNumberMsg *m)
 {
   CmiLock(lockEverything);
 void CkNodeReductionMgr::ReductionStarting(CkReductionNumberMsg *m)
 {
   CmiLock(lockEverything);
-       if(blocked){
-               delete m;
+  if(blocked){
+       delete m;
        CmiUnlock(lockEverything);
        CmiUnlock(lockEverything);
-               return ;
-       }
-       int srcNode = CmiNodeOf((UsrToEnv(m))->getSrcPe());
+       return ;
+  }
+  int srcNode = CmiNodeOf((UsrToEnv(m))->getSrcPe());
   if (isPresent(m->num) && !inProgress)
   {
     DEBR((AA"Starting Node reduction #%d at parent's request\n"AB,m->num));
   if (isPresent(m->num) && !inProgress)
   {
     DEBR((AA"Starting Node reduction #%d at parent's request\n"AB,m->num));
@@ -1427,9 +1432,9 @@ void CkNodeReductionMgr::doAddContribution(CkReductionMsg *m){
 //Handle a message from one element for the reduction
 void CkNodeReductionMgr::addContribution(CkReductionMsg *m)
 {
 //Handle a message from one element for the reduction
 void CkNodeReductionMgr::addContribution(CkReductionMsg *m)
 {
-   interrupt = 1;
-   CmiLock(lockEverything);
-   doAddContribution(m);
+  interrupt = 1;
+  CmiLock(lockEverything);
+  doAddContribution(m);
   CmiUnlock(lockEverything);
   interrupt = 0;
 }
   CmiUnlock(lockEverything);
   interrupt = 0;
 }
@@ -1502,7 +1507,7 @@ void CkNodeReductionMgr::finishReduction(void)
                */
                        result->gcount += additionalGCount;//if u have replaced some node add its gcount to ur count
            thisProxy[treeParent()].RecvMsg(result);
                */
                        result->gcount += additionalGCount;//if u have replaced some node add its gcount to ur count
            thisProxy[treeParent()].RecvMsg(result);
-               }
+       }
 
   }
   else
 
   }
   else
@@ -1779,13 +1784,13 @@ void CkNodeReductionMgr::pup(PUP::er &p)
     thisProxy = thisgroup;
     lockEverything = CmiCreateLock();
 #ifdef BINOMIAL_TREE
     thisProxy = thisgroup;
     lockEverything = CmiCreateLock();
 #ifdef BINOMIAL_TREE
-               init_BinomialTree();
+    init_BinomialTree();
 #else
 #else
-               init_BinaryTree();
+    init_BinaryTree();
 #endif         
   }
 #endif         
   }
-       p | blocked;
-       p | maxModificationRedNo;
+  p | blocked;
+  p | maxModificationRedNo;
 }
 
 /*
 }
 
 /*