2 Charm++ File: Checkpoint Library
3 added 01/03/2003 by Chao Huang, chuang10@uiuc.edu
5 CkStartCheckpoint() is a function to start the procedure
6 of saving the status of a Charm++ program into disk files.
7 A corresponding restarting mechanism can later use the
8 files saved to restore the execution. A callback should
9 be provided to continue after the checkpoint is done.
11 Checkpoint manager is a Group to aid the saving and
12 restarting of Charm++ programs. ...
14 --- Updated 12/14/2003 by Gengbin, gzheng@uiuc.edu
15 rewrote to allow code reuse with following 5 functions,
16 these functions each handle both packing and unpacking of a system data:
17 void CkPupROData(PUP::er &p);
18 void CkPupMainChareData(PUP::er &p);
19 void CkPupGroupData(PUP::er &p);
20 void CkPupNodeGroupData(PUP::er &p);
21 void CkPupArrayElementsData(PUP::er &p);
22 Completely changed the data file format for array elements to become
23 one file for each processor.
24 Two main checkpoint/restart subroutines are greatly simplified.
26 #ifndef _CKCHECKPOINT_H
27 #define _CKCHECKPOINT_H
30 #include <ckcallback.h>
31 #include <ckmessage.h>
33 // loop over all CkLocMgr and do "code"
34 #define CKLOCMGR_LOOP(code) \
35 for(i=0;i<numGroups;i++) { \
36 IrrGroup *obj = CkpvAccess(_groupTable)->find((*CkpvAccess(_groupIDTable))[i]).getObj(); \
37 if(obj->isLocMgr()) { \
38 CkLocMgr *mgr = (CkLocMgr*)obj; \
43 // utility functions to pup system global tables
44 void CkPupROData(PUP::er
&p
);
45 void CkPupMainChareData(PUP::er
&p
, CkArgMsg
*args
);
46 void CkPupChareData(PUP::er
&p
);
47 #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
48 void CkPupGroupData(PUP::er
&p
,bool create
=true);
49 void CkPupNodeGroupData(PUP::er
&p
,bool create
=true);
51 void CkPupGroupData(PUP::er
&p
);
52 void CkPupNodeGroupData(PUP::er
&p
);
54 void CkPupArrayElementsData(PUP::er
&p
, int notifyListeners
=1);
55 void CkPupProcessorData(PUP::er
&p
);
56 void CkRemoveArrayElements();
57 //void CkTestArrayElements();
59 void CkStartCheckpoint(const char* dirname
,const CkCallback
& cb
);
60 void CkRestartMain(const char* dirname
, CkArgMsg
*args
);
62 int CkCountArrayElements();
65 // some useful flags (for disk checkpointing)
66 extern int _inrestart
; // 1: if is during restart process
67 extern int _restarted
; // 1: if this run is after restart
68 extern int _oldNumPes
; // number of processors in the last run
69 extern int _chareRestored
; // 1: if chare is restored at restart
71 #endif //_CKCHECKPOINT_H