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 * Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. 14 * 15 * $COPYRIGHT$ 16 * 17 * Additional copyrights may follow 18 * 19 * $HEADER$ 20 */ 21 #ifndef ORTE_SNAPC_BASE_H 22 #define ORTE_SNAPC_BASE_H 23 24 #include "orte_config.h" 25 #include "orte/types.h" 26 27 28 #include "orte/mca/snapc/snapc.h" 29 30 /* 31 * Global functions for MCA overall SNAPC 32 */ 33 34 BEGIN_C_DECLS 35 36 /* 37 * MCA Framework 38 */ 39 ORTE_DECLSPEC extern mca_base_framework_t orte_snapc_base_framework; 40 /* select a component */ 41 ORTE_DECLSPEC int orte_snapc_base_select(bool seed, bool app); 42 43 /* 44 * Commands for command line tool and SnapC interaction 45 */ 46 typedef uint8_t orte_snapc_cmd_flag_t; 47 #define ORTE_SNAPC_CMD OPAL_UINT8 48 #define ORTE_SNAPC_GLOBAL_INIT_CMD 1 49 #define ORTE_SNAPC_GLOBAL_TERM_CMD 2 50 #define ORTE_SNAPC_GLOBAL_UPDATE_CMD 3 51 #define ORTE_SNAPC_LOCAL_UPDATE_CMD 4 52 #define ORTE_SNAPC_LOCAL_FINISH_CMD 5 53 54 /** 55 * There are 3 types of Coordinators, and any process may be once or more type. 56 * e.g., orterun is can often be both a Global and Local coordinator if it 57 * launches processes locally. 58 */ 59 typedef uint32_t orte_snapc_coord_type_t; 60 #define ORTE_SNAPC_UNASSIGN_TYPE 0 61 #define ORTE_SNAPC_GLOBAL_COORD_TYPE 1 62 #define ORTE_SNAPC_LOCAL_COORD_TYPE 2 63 #define ORTE_SNAPC_APP_COORD_TYPE 4 64 ORTE_DECLSPEC extern orte_snapc_coord_type_t orte_snapc_coord_type; 65 66 #define ORTE_SNAPC_COORD_NAME_PRINT(ct) ( (ct == (ORTE_SNAPC_GLOBAL_COORD_TYPE | ORTE_SNAPC_LOCAL_COORD_TYPE) ) ? "Global-Local" : \ 67 (ct == ORTE_SNAPC_GLOBAL_COORD_TYPE) ? "Global" : \ 68 (ct == ORTE_SNAPC_LOCAL_COORD_TYPE) ? "Local" : \ 69 (ct == ORTE_SNAPC_APP_COORD_TYPE) ? "App" : \ 70 "Unknown") 71 72 /** 73 * Global Snapshot Object Maintenance functions 74 */ 75 void orte_snapc_base_local_snapshot_construct(orte_snapc_base_local_snapshot_t *obj); 76 void orte_snapc_base_local_snapshot_destruct( orte_snapc_base_local_snapshot_t *obj); 77 78 void orte_snapc_base_global_snapshot_construct(orte_snapc_base_global_snapshot_t *obj); 79 void orte_snapc_base_global_snapshot_destruct( orte_snapc_base_global_snapshot_t *obj); 80 81 void orte_snapc_base_quiesce_construct(orte_snapc_base_quiesce_t *obj); 82 void orte_snapc_base_quiesce_destruct( orte_snapc_base_quiesce_t *obj); 83 84 void orte_snapc_base_request_op_construct(orte_snapc_base_request_op_t *op); 85 void orte_snapc_base_request_op_destruct(orte_snapc_base_request_op_t *op); 86 87 /** 88 * 'None' component functions 89 * These are to be used when no component is selected. 90 * They just return success, and empty strings as necessary. 91 */ 92 ORTE_DECLSPEC int orte_snapc_base_none_open(void); 93 ORTE_DECLSPEC int orte_snapc_base_none_close(void); 94 ORTE_DECLSPEC int orte_snapc_base_none_query(mca_base_module_t **module, int *priority); 95 96 ORTE_DECLSPEC int orte_snapc_base_module_init(bool seed, bool app); 97 ORTE_DECLSPEC int orte_snapc_base_module_finalize(void); 98 ORTE_DECLSPEC int orte_snapc_base_none_setup_job(orte_jobid_t jobid); 99 ORTE_DECLSPEC int orte_snapc_base_none_release_job(orte_jobid_t jobid); 100 ORTE_DECLSPEC int orte_snapc_base_none_ft_event(int state); 101 ORTE_DECLSPEC int orte_snapc_base_none_start_ckpt(orte_snapc_base_quiesce_t *datum); 102 ORTE_DECLSPEC int orte_snapc_base_none_end_ckpt(orte_snapc_base_quiesce_t *datum); 103 104 ORTE_DECLSPEC extern orte_snapc_base_module_t orte_snapc; 105 106 /** 107 * Globals 108 */ 109 ORTE_DECLSPEC extern bool orte_snapc_base_store_only_one_seq; 110 ORTE_DECLSPEC extern size_t orte_snapc_base_snapshot_seq_number; 111 ORTE_DECLSPEC extern bool orte_snapc_base_has_recovered; 112 113 /** 114 * Some utility functions 115 */ 116 ORTE_DECLSPEC void orte_snapc_ckpt_state_notify(int state); 117 ORTE_DECLSPEC int orte_snapc_ckpt_state_str(char ** state_str, int state); 118 119 /******************************* 120 * Global Coordinator functions 121 *******************************/ 122 /* Initial handshake with the orte_checkpoint command */ 123 ORTE_DECLSPEC int orte_snapc_base_global_coord_ckpt_init_cmd(orte_process_name_t* peer, 124 opal_buffer_t* buffer, 125 opal_crs_base_ckpt_options_t *options, 126 orte_jobid_t *jobid); 127 ORTE_DECLSPEC int orte_snapc_base_global_coord_ckpt_update_cmd(orte_process_name_t* peer, 128 orte_sstore_base_handle_t handle, 129 int ckpt_status); 130 131 ORTE_DECLSPEC int orte_snapc_base_unpack_options(opal_buffer_t* buffer, 132 opal_crs_base_ckpt_options_t *options); 133 ORTE_DECLSPEC int orte_snapc_base_pack_options(opal_buffer_t* buffer, 134 opal_crs_base_ckpt_options_t *options); 135 136 END_C_DECLS 137 138 #endif /* ORTE_SNAPC_BASE_H */ 139