root/opal/mca/crs/base/base.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2007      Evergrid, Inc. All rights reserved.
  13  *
  14  * Copyright (c) 2017      IBM Corporation. All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 #ifndef OPAL_CRS_BASE_H
  22 #define OPAL_CRS_BASE_H
  23 
  24 #include "opal_config.h"
  25 #include "opal/mca/base/base.h"
  26 #include "opal/mca/crs/crs.h"
  27 #include "opal/util/opal_environ.h"
  28 #include "opal/runtime/opal_cr.h"
  29 
  30 /*
  31  * Global functions for MCA overall CRS
  32  */
  33 
  34 BEGIN_C_DECLS
  35 
  36 /* Some local strings to use genericly with the local metadata file */
  37 #define CRS_METADATA_BASE       ("# ")
  38 #define CRS_METADATA_COMP       ("# OPAL CRS Component: ")
  39 #define CRS_METADATA_PID        ("# PID: ")
  40 #define CRS_METADATA_CONTEXT    ("# CONTEXT: ")
  41 #define CRS_METADATA_MKDIR      ("# MKDIR: ")
  42 #define CRS_METADATA_TOUCH      ("# TOUCH: ")
  43 
  44     /**
  45      * Initialize the CRS MCA framework
  46      *
  47      * @retval OPAL_SUCCESS Upon success
  48      * @retval OPAL_ERROR   Upon failures
  49      *
  50      * This function is invoked during opal_init();
  51      */
  52     OPAL_DECLSPEC int opal_crs_base_open(mca_base_open_flag_t flags);
  53 
  54     /**
  55      * Select an available component.
  56      *
  57      * @retval OPAL_SUCCESS Upon Success
  58      * @retval OPAL_NOT_FOUND If no component can be selected
  59      * @retval OPAL_ERROR Upon other failure
  60      *
  61      */
  62     OPAL_DECLSPEC int opal_crs_base_select(void);
  63 
  64     /**
  65      * Finalize the CRS MCA framework
  66      *
  67      * @retval OPAL_SUCCESS Upon success
  68      * @retval OPAL_ERROR   Upon failures
  69      *
  70      * This function is invoked during opal_finalize();
  71      */
  72     OPAL_DECLSPEC int opal_crs_base_close(void);
  73 
  74     /**
  75      * Globals
  76      */
  77     OPAL_DECLSPEC extern mca_base_framework_t opal_crs_base_framework;
  78     OPAL_DECLSPEC extern opal_crs_base_component_t opal_crs_base_selected_component;
  79     OPAL_DECLSPEC extern opal_crs_base_module_t opal_crs;
  80 
  81     /**
  82      * Some utility functions
  83      */
  84     OPAL_DECLSPEC char * opal_crs_base_state_str(opal_crs_state_type_t state);
  85 
  86     /*
  87      * Extract the expected component and pid from the metadata
  88      */
  89     OPAL_DECLSPEC int opal_crs_base_extract_expected_component(FILE *metadata, char ** component_name, int *prev_pid);
  90 
  91     /*
  92      * Read a token to the metadata file
  93      */
  94     OPAL_DECLSPEC int opal_crs_base_metadata_read_token(FILE *metadata, char * token, char ***value);
  95 
  96     /*
  97      * Register a file for cleanup.
  98      * Useful in C/R when files only need to temporarily exist for restart
  99      */
 100     OPAL_DECLSPEC int opal_crs_base_cleanup_append(char* filename, bool is_dir);
 101 
 102     /*
 103      * Flush the cleanup of all registered files.
 104      */
 105     OPAL_DECLSPEC int opal_crs_base_cleanup_flush(void);
 106 
 107     /*
 108      * Copy the options structure
 109      */
 110     OPAL_DECLSPEC int opal_crs_base_copy_options(opal_crs_base_ckpt_options_t *from,
 111                                                  opal_crs_base_ckpt_options_t *to);
 112     /*
 113      * Clear the options structure
 114      */
 115     OPAL_DECLSPEC int opal_crs_base_clear_options(opal_crs_base_ckpt_options_t *target);
 116 
 117     /*
 118      * CRS self application interface functions
 119      */
 120     typedef int (*opal_crs_base_self_checkpoint_fn_t)(char **restart_cmd);
 121     typedef int (*opal_crs_base_self_restart_fn_t)(void);
 122     typedef int (*opal_crs_base_self_continue_fn_t)(void);
 123 
 124     extern opal_crs_base_self_checkpoint_fn_t ompi_crs_base_self_checkpoint_fn;
 125     extern opal_crs_base_self_restart_fn_t    ompi_crs_base_self_restart_fn;
 126     extern opal_crs_base_self_continue_fn_t   ompi_crs_base_self_continue_fn;
 127 
 128     OPAL_DECLSPEC int opal_crs_base_self_register_checkpoint_callback
 129                       (opal_crs_base_self_checkpoint_fn_t  function);
 130     OPAL_DECLSPEC int opal_crs_base_self_register_restart_callback
 131                       (opal_crs_base_self_restart_fn_t  function);
 132     OPAL_DECLSPEC int opal_crs_base_self_register_continue_callback
 133                       (opal_crs_base_self_continue_fn_t  function);
 134 
 135 END_C_DECLS
 136 
 137 #endif /* OPAL_CRS_BASE_H */

/* [<][>][^][v][top][bottom][index][help] */