adding a new argument to CkFtFn functions (used during restart). This
authorFilippo Gioachin <gioachin@illinois.edu>
Sat, 8 Dec 2007 18:48:04 +0000 (18:48 +0000)
committerFilippo Gioachin <gioachin@illinois.edu>
Sat, 8 Dec 2007 18:48:04 +0000 (18:48 +0000)
is the list of arguments passed in at the restart (this can
potentially be null). This argument is passed in to the migrator
constructor of every mainchare as CkMigrateMsg. The mainchare can cast
it to a CkArgMsg if it desires to look at the new arguments.

src/ck-core/ckcheckpoint.C
src/ck-core/ckcheckpoint.h
src/ck-core/ckmemcheckpoint.C
src/ck-core/ckmemcheckpoint.h
src/ck-core/init.C

index e2e5630bde59a443401395d2844daa2253c16494..1800bb40a82af1c61f76b76b3da5e2655a3c4c70 100644 (file)
@@ -160,7 +160,7 @@ void CkPupROData(PUP::er &p)
 }
 
 // handle main chare
-void CkPupMainChareData(PUP::er &p)
+void CkPupMainChareData(PUP::er &p, CkArgMsg *args)
 {
        int nMains=_mainTable.size();
        DEBCHK("[%d] CkPupMainChareData %s: nMains = %d\n", CkMyPe(),p.typeString(),nMains);
@@ -175,8 +175,8 @@ void CkPupMainChareData(PUP::er &p)
                                obj = (Chare*)malloc(size);
                                _MEMCHECK(obj);
                                _mainTable[i]->setObj(obj);
-                               void *m = CkAllocSysMsg();
-                               _entryTable[entryMigCtor]->call(m, obj);
+                               //void *m = CkAllocSysMsg();
+                               _entryTable[entryMigCtor]->call(args, obj);
                        }
                        else 
                                obj = (Chare *)_mainTable[i]->getObj();
@@ -356,7 +356,7 @@ void CkPupProcessorData(PUP::er &p)
 
     // save mainchares into MainChares.dat
     if(CkMyPe()==0) {
-       CkPupMainChareData(p);
+      CkPupMainChareData(p, NULL);
     }
        
     // save groups into Groups.dat
@@ -394,7 +394,7 @@ static void checkpointOne(const char* dirname, CkCallback& cb){
                FILE* fMain = fopen(filename,"wb");
                if(!fMain) CkAbort("Failed to open checkpoint file for mainchare data!");
                PUP::toDisk pMain(fMain);
-               CkPupMainChareData(pMain);
+               CkPupMainChareData(pMain, NULL);
                fclose(fMain);
        }
 }
@@ -421,7 +421,7 @@ void CkStartCheckpoint(char* dirname,const CkCallback& cb)
   *          broadcast message.
   **/
 
-void CkRestartMain(const char* dirname){
+void CkRestartMain(const char* dirname, CkArgMsg *args){
        int i;
        char filename[1024];
        CkCallback cb;
@@ -445,7 +445,7 @@ void CkRestartMain(const char* dirname){
        FILE* fMain = fopen(filename,"rb");
        if(fMain && CkMyPe()==0){ // only main chares have been checkpointed, we restart on PE0
                PUP::fromDisk pMain(fMain);
-               CkPupMainChareData(pMain);
+               CkPupMainChareData(pMain, args);
                fclose(fMain);
                DEBCHK("[%d]CkRestartMain: mainchares restored\n",CkMyPe());
                //bdcastRO(); // moved to CkPupMainChareData()
index 26a64a171ec7a1044a49ca24b5b59dd6a9a6b510..2e39dccc760edce78f0497761bf968414d442ef7 100644 (file)
@@ -58,7 +58,7 @@ public:
 
 // utility functions to pup system global tables
 void CkPupROData(PUP::er &p);
-void CkPupMainChareData(PUP::er &p);
+void CkPupMainChareData(PUP::er &p, CkArgMsg *args);
 void CkPupGroupData(PUP::er &p);
 void CkPupNodeGroupData(PUP::er &p);
 void CkPupArrayElementsData(PUP::er &p, int notifyListeners=1);
@@ -66,7 +66,7 @@ void CkPupProcessorData(PUP::er &p);
 void CkRemoveArrayElements();
 
 void CkStartCheckpoint(char* dirname,const CkCallback& cb);
-void CkRestartMain(const char* dirname);
+void CkRestartMain(const char* dirname, CkArgMsg *args);
 
 
 #endif //_CKCHECKPOINT_H
index 43f3f2fcfad2aa78f19f3301d30891d0a0196219..b1d9f6f7d3613f155f15edbf8e1c3a03fb788c10 100644 (file)
@@ -368,7 +368,7 @@ static inline void _handleProcData(PUP::er &p)
     CkPupROData(p);
 
     // save mainchares into MainChares.dat
-    if(CkMyPe()==0) CkPupMainChareData(p);
+    if(CkMyPe()==0) CkPupMainChareData(p, (CkArgMsg*)NULL);
        
     // save groups into Groups.dat
     CkPupGroupData(p);
@@ -883,7 +883,7 @@ static void askProcDataHandler(char *msg)
 #endif
 }
 
-void CkMemRestart(const char *dummy)
+void CkMemRestart(const char *dummy, const CkArgMsg *args)
 {
 #if CMK_MEM_CHECKPOINT
    _diePE = CkMyPe();
index 2b7ad432cffb8ed5b34807d0663385210b111e4d..4e83cf8523d444a47eedecd711f4c537b4ed8626 100644 (file)
@@ -104,7 +104,7 @@ private:
 };
 
 // called in initCharm
-void CkMemRestart(const char *);
+void CkMemRestart(const char *, const CkArgMsg *);
 
 // called by user applications
 // to start a checkpointing
index 656111795920dff9b59937f7132c80dc526dec47..43f092adaff0f6914bea5a15f27d83c5224741b8 100644 (file)
@@ -127,7 +127,7 @@ static InitCallTable _initCallTable;
 #endif
 
 // fault tolerance
-typedef void (*CkFtFn)(const char *);
+typedef void (*CkFtFn)(const char *, CkArgMsg *);
 static CkFtFn  faultFunc = NULL;
 static char* _restartDir;
 
@@ -851,7 +851,13 @@ void _initCharm(int unused_argc, char **argv)
        
        if (faultFunc) {
                if (CkMyPe()==0) _allStats = new Stats*[CkNumPes()];
-               if (!inCommThread) faultFunc(_restartDir);
+               if (!inCommThread) {
+                  CkArgMsg *msg = (CkArgMsg *)CkAllocMsg(0, sizeof(CkArgMsg), 0);
+                  msg->argc = CmiGetArgc(argv);
+                  msg->argv = argv;
+                  faultFunc(_restartDir, msg);
+                  CkFreeMsg(msg);
+                }
        }else if(CkMyPe()==0){
                _allStats = new Stats*[CkNumPes()];
                register int i, nMains=_mainTable.size();