add pup support
[charm.git] / src / ck-core / cklocation.C
index 06ad7c5aeea67ee995316d4f7750ad288aaa264b..0230b9388129581fb2f001227354fdb88d1bdd5b 100644 (file)
@@ -1210,6 +1210,7 @@ void CkMigratable::ckFinishConstruction(void)
        myRec->setMeasure(usesAutoMeasure);
        if (barrierRegistered) return;
        DEBL((AA"Registering barrier client for %s\n"AB,idx2str(thisIndexMax)));
+       CkPrintf("Registering barrier client for %s\n",idx2str(thisIndexMax));
         if (usesAtSync)
          ldBarrierHandle = myRec->getLBDB()->AddLocalBarrierClient(
                (LDBarrierFn)staticResumeFromSync,(void*)(this));
@@ -1229,7 +1230,9 @@ void CkMigratable::AtSync(int waitForMigration)
        myRec->AsyncMigrate(!waitForMigration);
        if (waitForMigration) ReadyMigrate(CmiTrue);
        ckFinishConstruction();
-  DEBL((AA"Element %s going to sync\n"AB,idx2str(thisIndexMax)));
+  //DEBL((AA"Element %s going to sync\n"AB,idx2str(thisIndexMax)));
+  //if(CmiMyPartition()==1)
+       CkPrintf("Element %s going to sync\n",idx2str(thisIndexMax));
   // model-based load balancing, ask user to provide cpu load
   if (usesAutoMeasure == CmiFalse) UserSetLBLoad();
 
@@ -2782,12 +2785,13 @@ void CkLocMgr::pupElementsFor(PUP::er &p,CkLocRec_local *rec,
        // (A separate loop so ckLocal works even in element pup routines)
        for (m=firstManager;m!=NULL;m=m->next) {
                int elCType;
-               if (!p.isUnpacking())
+               if (!p.isUnpacking()&&!p.isChecking())
                { //Need to find the element's existing type
                        CkMigratable *elt=m->element(localIdx);
                        if (elt) elCType=elt->ckGetChareType();
                        else elCType=-1; //Element hasn't been created
                }
+
                p(elCType);
                if (p.isUnpacking() && elCType!=-1) {
                        //Create the element
@@ -2798,16 +2802,17 @@ void CkLocMgr::pupElementsFor(PUP::er &p,CkLocRec_local *rec,
                                if (!addElementToRec(rec,m,elt,migCtorIdx,NULL)) return;
                }
        }
+
        //Next pup the element data
        for (m=firstManager;m!=NULL;m=m->next) {
                CkMigratable *elt=m->element(localIdx);
                if (elt!=NULL)
-                {
-                        elt->pup(p);
+               {
+                       elt->pup(p);
 #if CMK_ERROR_CHECKING
-                        if (p.isUnpacking()) elt->sanitycheck();
+                       if (p.isUnpacking()) elt->sanitycheck();
 #endif
-                }
+               }
        }
 
 #if CMK_MEM_CHECKPOINT
@@ -3107,7 +3112,8 @@ void CkLocMgr::resume(const CkArrayIndex &idx, PUP::er &p, CmiBool notify,CmiBoo
                rec = (CkLocRec_local *)recGlobal;
        }
        pupElementsFor(p,rec,CkElementCreation_resume,rebuild,create);
-       callMethod(rec,&CkMigratable::ckJustMigrated);
+       if(!p.isChecking())
+               callMethod(rec,&CkMigratable::ckJustMigrated);
 }
 #endif