![]() ![]() ![]() ![]() Next: Parameters Up: Providing Your own Checkpointing/Recovery Previous: Adding a Checkpointing Method Contents Adding a Recovery MethodRecovering from a checkpoint is a two step operation:
The flesh provides the special time bins RECOVER_PARAMETERS and
RECOVER_VARIABLES for these two steps (see also the chapter on
Adding a Checkpointing/Recovery Method in the Infrastructure Thorn
Writer's Guide as part of the Cactus User's Guide).
Thorn IOUtil evaluates the recovery parameters (determines the recovery
mode to use, construct the name(s) of the recovery file(s) etc.).
It also controls the recovery process by invoking the recovery methods of
other I/O thorns, one after another until one method succeeded.
A recovery method must provide a routine with the following prototype:
int Recover (cGH *GH, const char *basefilename, int called_from); This routine will be invoked by IOUtil with the following arguments:
To perform the first step of recovery process, a recovery method must register a routine with the flesh's scheduler at the RECOVER_PARAMETERS time bin. This routine itself should call the IOUtil API
int IOUtil_RecoverParameters (int (*recover_fn) (cGH *GH, const char *basefilename, int called_from), const char *file_extension, const char *file_type) which will determine the recovery filename(s) and in turn invoke the actual recovery method's routine as a callback function. The arguments to pass to this routine are
The routine registered at RECOVER_PARAMETERS should return to the scheduler a negative value if parameter recovery failed for this recovery method for some reason (e.g. if no appropriate recovery file was found). The scheduler will then continue with the next recovery method until one finally succeeds (a positive value is returned). If none of the available recovery methods were successful the flesh would stop the code.
A value of zero should be returned to the scheduler to indicate that no
recovery was requested.
The second step during recovery -- restoring the contents of grid variables from the recovery file -- is invoked by thorn IOUtil which registers a routine at RECOVER_VARIABLES. This routine calls all recovery methods which were registered before with IOUtil via the API
int IOUtil_RegisterRecover (const char *name, int (*recover_fn) (cGH *GH, const char *basefilename, int called_from)); With this registration, all recovery method's actual recovery routines are made known to IOUtil, along with a descriptive name under which they are registered. At RECOVER_VARIABLES thorn IOUtil will loop over all available recovery routines (passing the same arguments as for parameter recovery) until one succeeds (returns a positive value).
![]() ![]() ![]() ![]() Next: Parameters Up: Providing Your own Checkpointing/Recovery Previous: Adding a Checkpointing Method Contents |