OpenMPI  0.1.1
base.h
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$
15  *
16  * Additional copyrights may follow
17  *
18  * $HEADER$
19  */
20 #ifndef ORTE_SNAPC_BASE_H
21 #define ORTE_SNAPC_BASE_H
22 
23 #include "orte_config.h"
24 #include "orte/types.h"
25 
26 
27 #include "orte/mca/snapc/snapc.h"
28 
29 /*
30  * Global functions for MCA overall SNAPC
31  */
32 
33 BEGIN_C_DECLS
34 
35 /**
36  * Initialize the SNAPC MCA framework
37  *
38  * @retval ORTE_SUCCESS Upon success
39  * @retval ORTE_ERROR Upon failures
40  *
41  * This function is invoked during orte_init();
42  */
43 ORTE_DECLSPEC int orte_snapc_base_open(void);
44 
45 #if !ORTE_DISABLE_FULL_SUPPORT
46 
47 /*
48  * Commands for command line tool and SnapC interaction
49  */
50 typedef uint8_t orte_snapc_cmd_flag_t;
51 #define ORTE_SNAPC_CMD OPAL_UINT8
52 #define ORTE_SNAPC_GLOBAL_INIT_CMD 1
53 #define ORTE_SNAPC_GLOBAL_TERM_CMD 2
54 #define ORTE_SNAPC_GLOBAL_UPDATE_CMD 3
55 #define ORTE_SNAPC_LOCAL_UPDATE_CMD 4
56 #define ORTE_SNAPC_LOCAL_FINISH_CMD 5
57 
58 /**
59  * There are 3 types of Coordinators, and any process may be once or more type.
60  * e.g., orterun is can often be both a Global and Local coordinator if it
61  * launches processes locally.
62  */
63 typedef uint32_t orte_snapc_coord_type_t;
64 #define ORTE_SNAPC_UNASSIGN_TYPE 0
65 #define ORTE_SNAPC_GLOBAL_COORD_TYPE 1
66 #define ORTE_SNAPC_LOCAL_COORD_TYPE 2
67 #define ORTE_SNAPC_APP_COORD_TYPE 4
68 ORTE_DECLSPEC extern orte_snapc_coord_type_t orte_snapc_coord_type;
69 
70 #define ORTE_SNAPC_COORD_NAME_PRINT(ct) ( (ct == (ORTE_SNAPC_GLOBAL_COORD_TYPE | ORTE_SNAPC_LOCAL_COORD_TYPE) ) ? "Global-Local" : \
71  (ct == ORTE_SNAPC_GLOBAL_COORD_TYPE) ? "Global" : \
72  (ct == ORTE_SNAPC_LOCAL_COORD_TYPE) ? "Local" : \
73  (ct == ORTE_SNAPC_APP_COORD_TYPE) ? "App" : \
74  "Unknown")
75 
76  /**
77  * Global Snapshot Object Maintenance functions
78  */
79  void orte_snapc_base_local_snapshot_construct(orte_snapc_base_local_snapshot_t *obj);
80  void orte_snapc_base_local_snapshot_destruct( orte_snapc_base_local_snapshot_t *obj);
81 
82  void orte_snapc_base_global_snapshot_construct(orte_snapc_base_global_snapshot_t *obj);
83  void orte_snapc_base_global_snapshot_destruct( orte_snapc_base_global_snapshot_t *obj);
84 
85  /**
86  * Select an available component.
87  *
88  * @retval ORTE_SUCCESS Upon Success
89  * @retval ORTE_NOT_FOUND If no component can be selected
90  * @retval ORTE_ERROR Upon other failure
91  *
92  */
93  ORTE_DECLSPEC int orte_snapc_base_select(bool seed, bool app);
94 
95  /**
96  * Finalize the SNAPC MCA framework
97  *
98  * @retval ORTE_SUCCESS Upon success
99  * @retval ORTE_ERROR Upon failures
100  *
101  * This function is invoked during orte_finalize();
102  */
103  ORTE_DECLSPEC int orte_snapc_base_close(void);
104 
105  void orte_snapc_base_quiesce_construct(orte_snapc_base_quiesce_t *obj);
106  void orte_snapc_base_quiesce_destruct( orte_snapc_base_quiesce_t *obj);
107 
108  void orte_snapc_base_request_op_construct(orte_snapc_base_request_op_t *op);
109  void orte_snapc_base_request_op_destruct(orte_snapc_base_request_op_t *op);
110 
111  /**
112  * 'None' component functions
113  * These are to be used when no component is selected.
114  * They just return success, and empty strings as necessary.
115  */
116  ORTE_DECLSPEC int orte_snapc_base_none_open(void);
117  ORTE_DECLSPEC int orte_snapc_base_none_close(void);
118  ORTE_DECLSPEC int orte_snapc_base_none_query(mca_base_module_t **module, int *priority);
119 
120  ORTE_DECLSPEC int orte_snapc_base_module_init(bool seed, bool app);
121  ORTE_DECLSPEC int orte_snapc_base_module_finalize(void);
122  ORTE_DECLSPEC int orte_snapc_base_none_setup_job(orte_jobid_t jobid);
123  ORTE_DECLSPEC int orte_snapc_base_none_release_job(orte_jobid_t jobid);
124  ORTE_DECLSPEC int orte_snapc_base_none_ft_event(int state);
125  ORTE_DECLSPEC int orte_snapc_base_none_start_ckpt(orte_snapc_base_quiesce_t *datum);
126  ORTE_DECLSPEC int orte_snapc_base_none_end_ckpt(orte_snapc_base_quiesce_t *datum);
127 
128  ORTE_DECLSPEC extern int orte_snapc_base_output;
129  ORTE_DECLSPEC extern opal_list_t orte_snapc_base_components_available;
130  ORTE_DECLSPEC extern orte_snapc_base_component_t orte_snapc_base_selected_component;
131  ORTE_DECLSPEC extern orte_snapc_base_module_t orte_snapc;
132 
133  /**
134  * Globals
135  */
136  ORTE_DECLSPEC extern bool orte_snapc_base_store_only_one_seq;
137  ORTE_DECLSPEC extern size_t orte_snapc_base_snapshot_seq_number;
138  ORTE_DECLSPEC extern bool orte_snapc_base_has_recovered;
139 
140  /**
141  * Some utility functions
142  */
143  ORTE_DECLSPEC void orte_snapc_ckpt_state_notify(int state);
144  ORTE_DECLSPEC int orte_snapc_ckpt_state_str(char ** state_str, int state);
145 
146  /*******************************
147  * Global Coordinator functions
148  *******************************/
149  /* Initial handshake with the orte_checkpoint command */
150  ORTE_DECLSPEC int orte_snapc_base_global_coord_ckpt_init_cmd(orte_process_name_t* peer,
151  opal_buffer_t* buffer,
153  orte_jobid_t *jobid);
154  ORTE_DECLSPEC int orte_snapc_base_global_coord_ckpt_update_cmd(orte_process_name_t* peer,
155  orte_sstore_base_handle_t handle,
156  int ckpt_status);
157 
158  ORTE_DECLSPEC int orte_snapc_base_unpack_options(opal_buffer_t* buffer,
160  ORTE_DECLSPEC int orte_snapc_base_pack_options(opal_buffer_t* buffer,
162 
163 #endif /* ORTE_DISABLE_FULL_SUPPORT */
164 
165 END_C_DECLS
166 
167 #endif /* ORTE_SNAPC_BASE_H */
Common type for all MCA modules.
Definition: mca.h:100
uint32_t orte_jobid_t
Set the allowed range for ids in each space.
Definition: types.h:76
Definition: types.h:146
Structure for SNAPC components.
Definition: snapc.h:351
Definition of the global snapshot.
Definition: snapc.h:167
Structure for SNAPC modules.
Definition: snapc.h:370
Definition: snapc.h:241
Definition: snapc.h:185
Definition of a orte local snapshot.
Definition: snapc.h:144
Definition: opal_list.h:147
Structure for holding a buffer to be used with the RML or OOB subsystems.
Definition: dss_types.h:159
Snapshot Coordination (SNAPC) Interface.