checksum support
authorXiang Ni <xiangni2@illinois.edu>
Sun, 6 Jan 2013 06:42:51 +0000 (00:42 -0600)
committerXiang Ni <xiangni2@illinois.edu>
Sun, 6 Jan 2013 06:42:51 +0000 (00:42 -0600)
src/ck-core/ckmemcheckpoint.C
src/util/pup.h
src/util/pup_util.C

index 7cf43ccbd699a0e116358a74dbbde517084da691..2cf2c9f10f1ec65d4f984f72fde2e0c345be9727 100644 (file)
@@ -68,6 +68,7 @@ void noopck(const char*, ...)
 
 #define CMK_CHKP_ALL           1
 #define CMK_USE_BARRIER                0
 
 #define CMK_CHKP_ALL           1
 #define CMK_USE_BARRIER                0
+#define CMK_USE_CHECKSUM               1
 
 //stream remote records happned only if CK_NO_PROC_POOL =1 which means the chares to pe map will change
 #define STREAMING_INFORMHOME                    1
 
 //stream remote records happned only if CK_NO_PROC_POOL =1 which means the chares to pe map will change
 #define STREAMING_INFORMHOME                    1
@@ -131,8 +132,11 @@ CpvDeclare(int, localChkpDone);
 CpvDeclare(int, remoteChkpDone);
 CpvDeclare(int, recvdArrayChkp);
 CpvDeclare(int, recvdProcChkp);
 CpvDeclare(int, remoteChkpDone);
 CpvDeclare(int, recvdArrayChkp);
 CpvDeclare(int, recvdProcChkp);
+CpvDeclare(int, localChecksum);
+CpvDeclare(int, remoteChecksum);
 
 bool compare(char * buf1, char * buf2);
 
 bool compare(char * buf1, char * buf2);
+int getChecksum(char * buf);
 static inline void _handleProcData(PUP::er &p,CmiBool create= CmiTrue);
 // Converse function handles
 static int askPhaseHandlerIdx;
 static inline void _handleProcData(PUP::er &p,CmiBool create= CmiTrue);
 // Converse function handles
 static int askPhaseHandlerIdx;
@@ -606,30 +610,30 @@ void CkMemCheckPT::doItNow(int starter, CkCallback &cb)
 
 class MemElementPacker : public CkLocIterator{
   private:
 
 class MemElementPacker : public CkLocIterator{
   private:
-//    CkLocMgr *locMgr;
+    //    CkLocMgr *locMgr;
     PUP::er &p;
     PUP::er &p;
-       std::map<CkHashCode,CkLocation> arrayMap;
+    std::map<CkHashCode,CkLocation> arrayMap;
   public:
     MemElementPacker(PUP::er &p_):p(p_){};
     void addLocation(CkLocation &loc){
       CkArrayIndexMax idx = loc.getIndex();
       arrayMap[idx.hash()] = loc;
     }
   public:
     MemElementPacker(PUP::er &p_):p(p_){};
     void addLocation(CkLocation &loc){
       CkArrayIndexMax idx = loc.getIndex();
       arrayMap[idx.hash()] = loc;
     }
-       void writeCheckpoint(){
-               std::map<CkHashCode, CkLocation>::iterator it;
-               for(it = arrayMap.begin();it!=arrayMap.end();it++){
-                       if(CkMyPe()==0){
-//                             CkPrintf("[%d][%d] pack %d\n",CmiMyPartition(),CkMyPe(),it->first);
-                       }
-                       CkLocation loc = it->second;
-               CkLocMgr *locMgr = loc.getManager();
-               CkArrayIndexMax idx = loc.getIndex();
-                       CkGroupID gID = locMgr->ckGetGroupID();
-                       p|gID;
-               p|idx;
-               locMgr->pupElementsFor(p,loc.getLocalRecord(),CkElementCreation_migrate);
-               }
-       }
+    void writeCheckpoint(){
+      std::map<CkHashCode, CkLocation>::iterator it;
+      for(it = arrayMap.begin();it!=arrayMap.end();it++){
+        if(CkMyPe()==0){
+          //                           CkPrintf("[%d][%d] pack %d\n",CmiMyPartition(),CkMyPe(),it->first);
+        }
+        CkLocation loc = it->second;
+        CkLocMgr *locMgr = loc.getManager();
+        CkArrayIndexMax idx = loc.getIndex();
+        CkGroupID gID = locMgr->ckGetGroupID();
+        p|gID;
+        p|idx;
+        locMgr->pupElementsFor(p,loc.getLocalRecord(),CkElementCreation_migrate);
+      }
+    }
 };
 
 void pupAllElements(PUP::er &p){
 };
 
 void pupAllElements(PUP::er &p){
@@ -640,9 +644,9 @@ void pupAllElements(PUP::er &p){
   }
   p | numElements;
   if(!p.isUnpacking()){
   }
   p | numElements;
   if(!p.isUnpacking()){
-         MemElementPacker packer(p);
-      CKLOCMGR_LOOP(mgr->iterate(packer););
-         packer.writeCheckpoint();
+    MemElementPacker packer(p);
+    CKLOCMGR_LOOP(mgr->iterate(packer););
+    packer.writeCheckpoint();
   }
 #endif
 }
   }
 #endif
 }
@@ -715,19 +719,38 @@ void CkMemCheckPT::startCheckpoint(){
     CmiPrintf("[%d][%d] local checkpoint done at %lf\n",CmiMyPartition(),CkMyPe(),CmiWallTimer());
   if(CkReplicaAlive()==1){
     CpvAccess(recvdLocal) = 1;
     CmiPrintf("[%d][%d] local checkpoint done at %lf\n",CmiMyPartition(),CkMyPe(),CmiWallTimer());
   if(CkReplicaAlive()==1){
     CpvAccess(recvdLocal) = 1;
+#if CMK_USE_CHECKSUM
+    CkCheckPTMessage * tmpMsg = (CkCheckPTMessage *)CkCopyMsg((void **)&msg);
+    CpvAccess(localChecksum) = getChecksum((char *)(tmpMsg->packData));
+    CmiPrintf("[%d][%d] checksum %d\n",CmiMyPartition(),CkMyPe(),CpvAccess(localChecksum));
+    delete tmpMsg;
+    //send checksum
+    char *chkpMsg = (char*)CmiAlloc(CmiMsgHeaderSizeBytes+sizeof(int));
+    *(int *)(chkpMsg+CmiMsgHeaderSizeBytes) = CpvAccess(localChecksum);
+    CmiSetHandler(chkpMsg,recvRemoteChkpHandlerIdx);
+    CmiRemoteSyncSendAndFree(CkMyPe(),CmiMyPartition()^1,CmiMsgHeaderSizeBytes+sizeof(int),chkpMsg);
+#else
     envelope * env = (envelope *)(UsrToEnv((CkCheckPTMessage *)CkCopyMsg((void **)&msg)));
     CkPackMessage(&env);
     CmiSetHandler(env,recvRemoteChkpHandlerIdx);
     CmiRemoteSyncSendAndFree(CkMyPe(),CmiMyPartition()^1,env->getTotalsize(),(char *)env);
     envelope * env = (envelope *)(UsrToEnv((CkCheckPTMessage *)CkCopyMsg((void **)&msg)));
     CkPackMessage(&env);
     CmiSetHandler(env,recvRemoteChkpHandlerIdx);
     CmiRemoteSyncSendAndFree(CkMyPe(),CmiMyPartition()^1,env->getTotalsize(),(char *)env);
+#endif
   }
   if(CpvAccess(recvdRemote)==1){
     //compare the checkpoint 
     int size = CpvAccess(chkpBuf)[pointer]->len;
   }
   if(CpvAccess(recvdRemote)==1){
     //compare the checkpoint 
     int size = CpvAccess(chkpBuf)[pointer]->len;
-    CkPrintf("[%d][%d] checkpoint size %d pointer %d \n",CmiMyPartition(),CkMyPe(),size,pointer);
+//    CkPrintf("[%d][%d] checkpoint size %d pointer %d \n",CmiMyPartition(),CkMyPe(),size,pointer);
+#if CMK_USE_CHECKSUM
+    if(CpvAccess(localChecksum) == CpvAccess(remoteChecksum)){
+      thisProxy[CkMyPe()].doneComparison(true);
+    }
+#else
     if(CpvAccess(buddyBuf)->len == size && compare((char *)(CpvAccess(chkpBuf)[pointer]->packData),(char *)(CpvAccess(buddyBuf)->packData))){
       thisProxy[CkMyPe()].doneComparison(true);
     if(CpvAccess(buddyBuf)->len == size && compare((char *)(CpvAccess(chkpBuf)[pointer]->packData),(char *)(CpvAccess(buddyBuf)->packData))){
       thisProxy[CkMyPe()].doneComparison(true);
-    }else{
-      CkPrintf("[%d][%d] failed the test my size %d buddy size %d pointer %d \n",CmiMyPartition(),CkMyPe(),size,CpvAccess(buddyBuf)->len,pointer);
+    }
+#endif
+    else{
+      CkPrintf("[%d][%d] failed the test pointer %d \n",CmiMyPartition(),CkMyPe(),pointer);
       thisProxy[CkMyPe()].doneComparison(false);
     }
     if(CkMyPe()==0)
       thisProxy[CkMyPe()].doneComparison(false);
     }
     if(CkMyPe()==0)
@@ -1472,15 +1495,15 @@ void CkMemCheckPT::RollBack(){
     void CkMemCheckPT::recoverFromSoftFailure()
     {
       inRestarting = 0;
     void CkMemCheckPT::recoverFromSoftFailure()
     {
       inRestarting = 0;
-         CpvAccess(recvdRemote) = 0;
-         CpvAccess(recvdLocal) = 0;
-         CpvAccess(localChkpDone) = 0;
-         CpvAccess(remoteChkpDone) = 0;
-         inCheckpointing = 0;
-         notifyReplica = 0;
-         if(CkMyPe() == 0){
-               CmiPrintf("[%d][%d] Recover From soft failures, sending callback ... \n", CmiMyPartition(),CkMyPe());
-         }
+      CpvAccess(recvdRemote) = 0;
+      CpvAccess(recvdLocal) = 0;
+      CpvAccess(localChkpDone) = 0;
+      CpvAccess(remoteChkpDone) = 0;
+      inCheckpointing = 0;
+      notifyReplica = 0;
+      if(CkMyPe() == 0){
+        CmiPrintf("[%d][%d] Recover From soft failures, sending callback ... \n", CmiMyPartition(),CkMyPe());
+      }
       CKLOCMGR_LOOP(mgr->resumeFromChkp(););
     }
     // called only on 0
       CKLOCMGR_LOOP(mgr->resumeFromChkp(););
     }
     // called only on 0
@@ -1506,7 +1529,7 @@ void CkMemCheckPT::RollBack(){
         CkPrintf("Warning: In-Memory checkpoint has been disabled! \n");
         cb.send();
         return;
         CkPrintf("Warning: In-Memory checkpoint has been disabled! \n");
         cb.send();
         return;
-      }*/
+        }*/
       if (CkInRestarting()) {
         // trying to checkpointing during restart
         cb.send();
       if (CkInRestarting()) {
         // trying to checkpointing during restart
         cb.send();
@@ -1620,38 +1643,66 @@ void CkMemCheckPT::RollBack(){
     extern void _initDone();
 
     bool compare(char * buf1, char *buf2){
     extern void _initDone();
 
     bool compare(char * buf1, char *buf2){
-       PUP::checker pchecker(buf1,buf2);
-                pchecker.skip();
-
-                int numElements;
-                pchecker|numElements;
-                for(int i=0;i<numElements;i++){
-      CkGroupID gID;
-      CkArrayIndex idx;
+      PUP::checker pchecker(buf1,buf2);
+      pchecker.skip();
+      int numElements;
+      pchecker|numElements;
+      for(int i=0;i<numElements;i++){
+        CkGroupID gID;
+        CkArrayIndex idx;
 
 
-      pchecker|gID;
-      pchecker|idx;
+        pchecker|gID;
+        pchecker|idx;
 
 
-      CkLocMgr * mgr = (CkLocMgr *)CkpvAccess(_groupTable)->find(gID).getObj();
-      mgr->resume(idx,pchecker,CmiFalse,CmiFalse,CmiFalse);
+        CkLocMgr * mgr = (CkLocMgr *)CkpvAccess(_groupTable)->find(gID).getObj();
+        mgr->resume(idx,pchecker,CmiFalse,CmiFalse,CmiFalse);
       }
       return pchecker.getResult();
       //return true;
     }
       }
       return pchecker.getResult();
       //return true;
     }
+    int getChecksum(char * buf){
+      PUP::checker pchecker(buf);
+      pchecker.skip();
+      int numElements;
+      pchecker|numElements;
+//      CkPrintf("num %d\n",numElements);
+      for(int i=0;i<numElements;i++){
+        CkGroupID gID;
+        CkArrayIndex idx;
+
+        pchecker|gID;
+        pchecker|idx;
+
+        CkLocMgr * mgr = (CkLocMgr *)CkpvAccess(_groupTable)->find(gID).getObj();
+        mgr->resume(idx,pchecker,CmiFalse,CmiFalse,CmiFalse);
+      }
+      return pchecker.getChecksum();
+    }
 
     static void recvRemoteChkpHandler(char *msg){
 
     static void recvRemoteChkpHandler(char *msg){
+#if CMK_USE_CHECKSUM
+      CpvAccess(remoteChecksum) = *(int *)(msg+CmiMsgHeaderSizeBytes);
+      CpvAccess(recvdRemote) = 1;
+      if(CpvAccess(recvdLocal)==1){
+        if(CpvAccess(remoteChecksum) == CpvAccess(localChecksum)){
+          CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(true);
+        }
+        else{
+          CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(false);
+        }
+      }
+#else
       envelope *env = (envelope *)msg;
       CkUnpackMessage(&env);
       CkCheckPTMessage* chkpMsg = (CkCheckPTMessage *)(EnvToUsr(env));
       if(CpvAccess(recvdLocal)==1){
         int pointer = CpvAccess(curPointer);
         int size = CpvAccess(chkpBuf)[pointer]->len;
       envelope *env = (envelope *)msg;
       CkUnpackMessage(&env);
       CkCheckPTMessage* chkpMsg = (CkCheckPTMessage *)(EnvToUsr(env));
       if(CpvAccess(recvdLocal)==1){
         int pointer = CpvAccess(curPointer);
         int size = CpvAccess(chkpBuf)[pointer]->len;
-       CkPrintf("[%d][%d] checkpoint size %d pointer %d \n",CmiMyPartition(),CkMyPe(),size,pointer);
         if(chkpMsg->len == size && compare((char *)(CpvAccess(chkpBuf)[pointer]->packData),(char *)(chkpMsg->packData))){
           CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(true);
         }else
         {
         if(chkpMsg->len == size && compare((char *)(CpvAccess(chkpBuf)[pointer]->packData),(char *)(chkpMsg->packData))){
           CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(true);
         }else
         {
-               CkPrintf("[%d][%d] failed the test my size %d buddy size %d pointer %d\n",CmiMyPartition(),CkMyPe(),size,chkpMsg->len,pointer);
+         // CkPrintf("[%d][%d] failed the test my size %d buddy size %d pointer %d\n",CmiMyPartition(),CkMyPe(),size,chkpMsg->len,pointer);
           CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(false);
         }
         delete chkpMsg;
           CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(false);
         }
         delete chkpMsg;
@@ -1661,7 +1712,8 @@ void CkMemCheckPT::RollBack(){
         CpvAccess(recvdRemote) = 1;
         if(CpvAccess(buddyBuf)) delete CpvAccess(buddyBuf);
         CpvAccess(buddyBuf) = chkpMsg;
         CpvAccess(recvdRemote) = 1;
         if(CpvAccess(buddyBuf)) delete CpvAccess(buddyBuf);
         CpvAccess(buddyBuf) = chkpMsg;
-      }  
+      }
+#endif
     }
 
     static void replicaRecoverHandler(char *msg){
     }
 
     static void replicaRecoverHandler(char *msg){
@@ -1673,7 +1725,7 @@ void CkMemCheckPT::RollBack(){
       CpvAccess(remoteChkpDone) = 1;
       CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(ret);
       CmiFree(msg);
       CpvAccess(remoteChkpDone) = 1;
       CProxy_CkMemCheckPT(ckCheckPTGroupID).ckLocalBranch()->doneComparison(ret);
       CmiFree(msg);
-  
+
     }
     static void replicaChkpDoneHandler(char *msg){
       CpvAccess(remoteChkpDone) = 1;
     }
     static void replicaChkpDoneHandler(char *msg){
       CpvAccess(remoteChkpDone) = 1;
@@ -1851,7 +1903,7 @@ void CkMemCheckPT::RollBack(){
     void qd_callback(void *m)
     {
       CmiPrintf("[%d] callback after QD for crashed node: %d. at %lf\n", CkMyPe(), CpvAccess(_crashedNode),CmiWallTimer());
     void qd_callback(void *m)
     {
       CmiPrintf("[%d] callback after QD for crashed node: %d. at %lf\n", CkMyPe(), CpvAccess(_crashedNode),CmiWallTimer());
-        fflush(stdout);
+      fflush(stdout);
       CkFreeMsg(m);
       if(CmiNumPartition()==1){
 #ifdef CMK_SMP
       CkFreeMsg(m);
       if(CmiNumPartition()==1){
 #ifdef CMK_SMP
@@ -2159,6 +2211,8 @@ void CkMemCheckPT::RollBack(){
         CpvInitialize(int,remoteChkpDone);
         CpvInitialize(int,recvdRemote);
         CpvInitialize(int,recvdProcChkp);
         CpvInitialize(int,remoteChkpDone);
         CpvInitialize(int,recvdRemote);
         CpvInitialize(int,recvdProcChkp);
+        CpvInitialize(int,localChecksum);
+        CpvInitialize(int,remoteChecksum);
         CpvInitialize(int,recvdArrayChkp);
 
         CpvAccess(procChkptBuf) = NULL;
         CpvInitialize(int,recvdArrayChkp);
 
         CpvAccess(procChkptBuf) = NULL;
@@ -2176,6 +2230,8 @@ void CkMemCheckPT::RollBack(){
         CpvAccess(remoteChkpDone) = 0;
         CpvAccess(recvdRemote) = 0;
         CpvAccess(recvdProcChkp) = 0;
         CpvAccess(remoteChkpDone) = 0;
         CpvAccess(recvdRemote) = 0;
         CpvAccess(recvdProcChkp) = 0;
+        CpvAccess(localChecksum) = 0;
+        CpvAccess(remoteChecksum) = 0;
         CpvAccess(recvdArrayChkp) = 0;
 
         notify_crash_fn = notify_crash;
         CpvAccess(recvdArrayChkp) = 0;
 
         notify_crash_fn = notify_crash;
index 26e5be26a5469a8a2b81300d773af28289ee52ed..fbfdb71992042ccf5b5867239798d17d87a3926c 100644 (file)
@@ -316,6 +316,7 @@ class er {
   virtual int size(void) const { return 0; }
   
   virtual void setAccuracy(double _accuracy){}
   virtual int size(void) const { return 0; }
   
   virtual void setAccuracy(double _accuracy){}
+  virtual void setAccuracyBit(int _accuracy){}
   virtual void skipNext(){}
   virtual void skip(){}
   virtual void resume(){}
   virtual void skipNext(){}
   virtual void skip(){}
   virtual void resume(){}
@@ -414,19 +415,25 @@ class checker : public er {
   myByte * origBuf;
   myByte * buf;
   double accuracy;
   myByte * origBuf;
   myByte * buf;
   double accuracy;
+  int accuracyBit;
+  int sum1;
+  int sum2;
   bool _skip;
   bool result;
   bool reset;
   bool _skip;
   bool result;
   bool reset;
+  bool calCheck;
  public:
  public:
-       checker(void * Abuf, void * Bbuf):er(IS_CHECKING),origBuf((myByte *)Abuf),buf((myByte *)Bbuf),_skip(true),accuracy(0.0),result(true),reset(false) {}
+       checker(void * Abuf, void * Bbuf):er(IS_CHECKING),origBuf((myByte *)Abuf),buf((myByte *)Bbuf),_skip(true),accuracy(0.0),result(true),reset(false),calCheck(false) {}
+       checker(void * Abuf):er(IS_CHECKING),origBuf((myByte *)Abuf),_skip(true),accuracy(0.0),result(true),reset(false),calCheck(true),sum1(0),sum2(0) {}
        virtual void setAccuracy(double _accuracy) {
                accuracy = _accuracy;
        virtual void setAccuracy(double _accuracy) {
                accuracy = _accuracy;
-               //printf("set accuracy %lf\n",accuracy);
+       }
+       virtual void setAccuracyBit(int _accuracy) {
+               accuracyBit = _accuracy;
        }
        virtual void skipNext() {
                _skip = true;
                reset = true;
        }
        virtual void skipNext() {
                _skip = true;
                reset = true;
-               //printf("skip\n");
        }
        virtual void skip() {
                _skip = true;
        }
        virtual void skip() {
                _skip = true;
@@ -436,7 +443,37 @@ class checker : public er {
                _skip = false;
        }
 
                _skip = false;
        }
 
+       void add(int value){
+               union{int value;char byte[4];} data;
+               data.value = value;
+               for(int i=0;i<4;i++){
+                       add(data.byte[i]);
+               }
+       }
+       
+       void add(double value){
+               union{long long int value;char byte[8];} data;
+               long long int intA = *(long long int *)&value;
+               if(intA<0)
+                       intA = 0X8000000000000000 -intA;
+               long long int offset = 0XFFFFFFFFFFFFFFFF;
+               offset = offset<<accuracyBit;
+               intA = intA&offset;
+               data.value = intA;
+               for(int i=0;i<8;i++){
+       //              printf("byte %d\n",data.byte[i]);
+                        add(data.byte[i]);
+               }
+       }
+       
+       void add(char value){
+               sum1 = (sum1+value)%255;
+               sum2 = (sum1+sum2)%255;
+       }
+
+
        bool getResult() {return result;}       
        bool getResult() {return result;}       
+       int getChecksum() {return (sum2<<8)|sum1;}
 };
 
 //For packing into a preallocated, presized memory buffer
 };
 
 //For packing into a preallocated, presized memory buffer
index 1c2c3ca955b96ac820f9029c0e89b44a4b709c92..40fc39fff989dc092394bbeae78d8937ef5810b5 100644 (file)
@@ -148,65 +148,77 @@ void PUP::checker::bytes(void * p,int n,size_t itemSize,dataType t)
                        case Tdouble:
                                {
                                        double * p1;
                        case Tdouble:
                                {
                                        double * p1;
-                                       double * p2 = new double[n/itemSize];
+                                       double * p2;
                                        p1 = (double*)p;
                                        p1 = (double*)p;
-                                       memcpy((char *)p2,(const void *)buf,n); 
+                                       if(!calCheck){
+                                               p2 = new double[n/itemSize];
+                                               memcpy((char *)p2,(const void *)buf,n); 
+                                       }
                                        for(int i=0;i<n/itemSize;i++){
                                        for(int i=0;i<n/itemSize;i++){
-                                               long long int intA = *(long long int *)&p1[i];
-                                               long long int intB = *(long long int *)&p2[i];
-                                               if(intA<0)
-                                                       intA = 0X8000000000000000 -intA;
-                                               if(intB<0)
-                                                       intB = 0X8000000000000000 -intB;
-                                               if(fabs(p1[i]-p2[i])>accuracy){
-                                               //if(fabs(intA-intB)/intA>0.001){
-                                               //if(fabs(intA-intB)>10){
-                                                       if(result){
-                                                               printf("found incorrect double %e %e %lld %lld size %d %d diff %e\n",p1[i],p2[i],intA,intB,sizeof(double),sizeof(long long int),(p1[i]-p2[i]));
-                                                       /*      double test = 4.940656e-324;
-                                                               long int test_0 = *(long int *)(&test);
-                                                            printf("test %e %ld size %d\n",test,test_0,sizeof(long int));      
-                                                               test  = -4.940656e-324;
-                                                               test_0 = *(long long int *)(&test);
-                                                               test_0 = 0X8000000000000000-test_0;
-                                                            printf("test %e %lld\n",test,test_0);*/
-                                                       }        
-                                                       result = result && false;
+                                               if(!calCheck){
+                                                       if(fabs(p1[i]-p2[i])>accuracy){
+                                                               if(result){
+                                                                       printf("found incorrect double %e %e diff %e\n",p1[i],p2[i],(p1[i]-p2[i]));
+                                                               }        
+                                                               result = result && false;
+                                                       }
+                                               }else{
+                                                       add(p1[i]);
                                                }
                                        }
                                                }
                                        }
-                                       delete [] p2;
+                                       if(!calCheck){
+                                         delete [] p2;
+                                        }
                                }       
                                break;  
                        case Tint:
                                {
                                        int * p1;
                                }       
                                break;  
                        case Tint:
                                {
                                        int * p1;
-                                       int * p2 = new int[n/itemSize];
+                                       int * p2;
                                        p1 = (int *)p;
                                        p1 = (int *)p;
-                                       memcpy((char *)p2,(const void *)buf,n); 
+                                       if(!calCheck){
+                                               p2 = new int[n/itemSize];
+                                               memcpy((char *)p2,(const void *)buf,n); 
+                                       }
                                        for(int i=0;i<n/itemSize;i++){
                                        for(int i=0;i<n/itemSize;i++){
-                                               if(fabs(p1[i]-p2[i])>accuracy){
-                                                       if(result)
-                                                               printf("found incorrect int %d %d at %d total %d\n",p1[i],p2[i],i,n/itemSize);
-                                                       result = result && false;
+                                               if(!calCheck){
+                                                       if(fabs(p1[i]-p2[i])>accuracy){
+                                                               if(result)
+                                                                       printf("found incorrect int %d %d at %d total %d\n",p1[i],p2[i],i,n/itemSize);
+                                                               result = result && false;
+                                                       }
+                                               }else{
+                                                       add(p1[i]);
                                                }
                                        }
                                                }
                                        }
-                                       delete [] p2;
+                                       if(!calCheck){
+                                         delete [] p2;
+                                        }
                                }
                                break;
                        case Tchar:
                                {
                                        char * p1;
                                }
                                break;
                        case Tchar:
                                {
                                        char * p1;
-                                       char * p2 = new char[n/itemSize];
+                                       char * p2;
                                        p1 = (char *)p;
                                        p1 = (char *)p;
-                                       memcpy((char *)p2,(const void *)buf,n); 
+                                       if(!calCheck){
+                                               p2 = new char[n/itemSize];
+                                               memcpy((char *)p2,(const void *)buf,n); 
+                                       }
                                        for(int i=0;i<n/itemSize;i++){
                                        for(int i=0;i<n/itemSize;i++){
-                                               if(fabs(p1[i]-p2[i])>accuracy){
-                                                       if(result)
-                                                               printf("found incorrect char %d %d at %d, total %d\n",p1[i],p2[i],i,n/itemSize);
-                                                       result = result && false;
+                                               if(!calCheck){
+                                                       if(fabs(p1[i]-p2[i])>accuracy){
+                                                               if(result)
+                                                                       printf("found incorrect char %d %d at %d, total %d\n",p1[i],p2[i],i,n/itemSize);
+                                                               result = result && false;
+                                                       }
+                                               }else{
+                                                       add(p1[i]);
                                                }
                                        }
                                                }
                                        }
-                                       delete [] p2;
+                                       if(!calCheck){
+                                         delete [] p2;
+                                        }
                                }
                                break;
                        default:
                                }
                                break;
                        default:
@@ -218,7 +230,8 @@ void PUP::checker::bytes(void * p,int n,size_t itemSize,dataType t)
                reset = false;
        }
        origBuf+=n;
                reset = false;
        }
        origBuf+=n;
-       buf+=n;
+       if(!calCheck)
+               buf+=n;
 }
 
 // dealing with short write
 }
 
 // dealing with short write