IBM Books

MPI Programming Guide

MP_SET_CKPT_CALLBACKS, mpc_set_ckpt_callbacks

Purpose

Registers subroutines to be invoked when the application is checkpointed, resumed, and restarted.

Library

libmpi_r.a

C synopsis

#include <pm_ckpt.h>
int mpc_set_ckpt_callbacks(callbacks_t *cbs);

FORTRAN synopsis

MP_SET_CKPT_CALLBACKS(EXTERNAL CHECKPOINT_CALLBACK_FUNC,
		      EXTERNAL RESUME_CALLBACK_FUNC,
		      EXTERNAL RESTART_CALLBACK_FUNC,
		      INTEGER RC) 

Parameters

In C, cbs is a pointer to a callbacks_t structure. The structure is defined as:

typedef struct {
void (*checkpoint_callback)(void);
void (*restart_callback)(void);
void (*resume_callback)(void);
} callbacks_t;

where:

checkpoint_callback	is a pointer to the subroutine to be called at checkpoint time
 
restart_callback	is a pointer to the subroutine to be called at restart time
 
resume_callback	is a pointer to the subroutine to be called when an application 
				is resumed after taking a checkpoint

In FORTRAN:

CHECKPOINT_CALLBACK_FUNC is the subroutine to be called at checkpoint time
 
RESUME_CALLBACK_FUNC	  is the subroutine to be called when an application 
				  is resumed after taking a checkpoint
 
RESTART_CALLBACK_FUNC	  is the subroutine to be called at restart time
		      
RC			  contains one of the values listed under 
				  Return Values			 

Description

The MP_SET_CKPT_CALLBACKS subroutine is called to register subroutines to be invoked when the application is checkpointed, resumed, and restarted.

Notes

In order to ensure their completion, the callback subroutines cannot be dependent on the action of any other thread in the current process, or any process created by the task being checkpointed, because these threads or processes or both may or may not be running while the callback subroutines are executing.

The callback subroutines cannot contain calls to: MP_SET_CKPT_CALLBACKS, MP_UNSET_CKPT_CALLBACKS, mpc_set_ckpt_callbacks, or mpc_unset_ckpt_callbacks.

If a call to MP_SET_CKPT_CALLBACKS is issued while a checkpoint is in progress, it is possible that the newly-registered callback may or may not run during this checkpoint.

There are certain limitations associated with checkpointing an application. See Checkpoint/restart limitations for more information.

For general information on checkpointing and restarting programs, see IBM Parallel Environment for AIX: Operation and Use, Volume 1.

For more information on the use of LoadLeveler and checkpointing, see IBM LoadLeveler for AIX 5L: Using and Administering.

Return values

-1
indicates that an error occurred. A message describing the error will be issued.

non-negative integer
indicates the handle that is to be used in MP_UNSET_CKPT_CALLBACKS to unregister the subroutines.

Examples

C Example

#include <pm_ckpt.h>
int ihndl;
callbacks_t cbs;
void foo(void); 
void bar(void); 
cbs.checkpoint_callback=foo;
cbs.resume_callback=bar;
cbs.restart_callback=bar;
ihndl = mpc_set_ckpt_callbacks(callbacks_t *cbs);

FORTRAN Example

SUBROUTINE FOO

·
·
·
RETURN END SUBROUTINE BAR
·
·
·
RETURN END PROGRAM MAIN EXTERNAL FOO, BAR INTEGER HANDLE, RC
·
·
·
CALL MP_SET_CKPT_CALLBACKS(FOO,BAR,BAR,HANDLE) IF (HANDLE .NE. 0) STOP 666
·
·
·
CALL MP_UNSET_CKPT_CALLBACKS(HANDLE,RC)
·
·
·
END

Related information

Commands:

Subroutines:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]