This source file includes following definitions.
- orte_sstore_base_register
- orte_sstore_base_close
- orte_sstore_base_open
- orte_sstore_base_determine_context
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include "orte_config.h"
19
20 #include "orte/constants.h"
21 #include "orte/mca/mca.h"
22 #include "opal/util/output.h"
23 #include "opal/util/opal_environ.h"
24 #include "opal/mca/base/base.h"
25
26 #include "orte/util/proc_info.h"
27
28 #include "orte/mca/sstore/sstore.h"
29 #include "orte/mca/sstore/base/base.h"
30
31 #include "orte/mca/sstore/base/static-components.h"
32
33
34
35
36 orte_sstore_base_module_t orte_sstore = {
37 NULL,
38 NULL,
39
40 NULL,
41 NULL,
42 NULL,
43 NULL,
44 NULL,
45 NULL,
46 NULL,
47 NULL,
48 NULL,
49 NULL,
50 NULL,
51 NULL
52 };
53 int orte_sstore_context = -1;
54
55 bool orte_sstore_base_is_checkpoint_available = false;
56 char * orte_sstore_base_local_metadata_filename = NULL;
57 char * orte_sstore_base_global_metadata_filename = NULL;
58 char * orte_sstore_base_local_snapshot_fmt = NULL;
59 char * orte_sstore_base_global_snapshot_dir = NULL;
60 char * orte_sstore_base_global_snapshot_ref = NULL;
61 char * orte_sstore_base_prelaunch_location = NULL;
62
63 orte_sstore_base_handle_t orte_sstore_handle_current = {0};
64 orte_sstore_base_handle_t orte_sstore_handle_last_stable = {0};
65
66
67 int orte_sstore_base_determine_context(void);
68
69 static int orte_sstore_base_register(mca_base_register_flag_t flags)
70 {
71 int mca_index;
72
73
74
75 orte_sstore_base_global_snapshot_dir = (char *) opal_home_directory();
76 mca_index = mca_base_var_register("orte", "sstore", "base", "global_snapshot_dir",
77 "The base directory to use when storing global snapshots",
78 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
79 OPAL_INFO_LVL_9,
80 MCA_BASE_VAR_SCOPE_READONLY,
81 &orte_sstore_base_global_snapshot_dir);
82 mca_base_var_register_synonym(mca_index, "orte", "snapc", "base", "global_snapshot_dir",
83 MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
84
85
86
87
88 orte_sstore_base_global_snapshot_ref = NULL;
89 mca_index = mca_base_var_register("orte", "sstore", "base", "global_snapshot_ref",
90 "The global snapshot reference to be used for this job. "
91 " [Default = ompi_global_snapshot_MPIRUNPID.ckpt]",
92 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
93 OPAL_INFO_LVL_9,
94 MCA_BASE_VAR_SCOPE_READONLY,
95 &orte_sstore_base_global_snapshot_ref);
96 mca_base_var_register_synonym(mca_index, "orte", "snapc", "base", "global_snapshot_ref",
97 MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
98
99 return ORTE_SUCCESS;
100 }
101
102 static int orte_sstore_base_close(void)
103 {
104
105 if( NULL != orte_sstore.sstore_finalize ) {
106 orte_sstore.sstore_finalize();
107 }
108
109 return mca_base_framework_components_close(&orte_sstore_base_framework, NULL);
110 }
111
112
113
114
115
116 static int orte_sstore_base_open(mca_base_open_flag_t flags)
117 {
118 int rc;
119
120 orte_sstore_handle_current = ORTE_SSTORE_HANDLE_INVALID;
121 orte_sstore_handle_last_stable = ORTE_SSTORE_HANDLE_INVALID;
122
123 orte_sstore_base_local_metadata_filename = strdup("snapshot_meta.data");
124 orte_sstore_base_global_metadata_filename = strdup("global_snapshot_meta.data");
125 orte_sstore_base_local_snapshot_fmt = strdup("opal_snapshot_%d.ckpt");
126
127
128
129
130
131 if( NULL != orte_sstore_base_global_snapshot_ref ) {
132 opal_asprintf(&orte_sstore_base_prelaunch_location,
133 "%s/%s/%d",
134 orte_sstore_base_global_snapshot_dir,
135 orte_sstore_base_global_snapshot_ref,
136 0);
137 }
138
139
140 if (ORTE_SUCCESS != (rc = mca_base_framework_components_open(&orte_sstore_base_framework, flags))) {
141 return rc;
142 }
143
144 opal_output_verbose(10, orte_sstore_base_framework.framework_output,
145 "sstore:base: open()");
146 opal_output_verbose(10, orte_sstore_base_framework.framework_output,
147 "sstore:base: open: Global snapshot directory = %s",
148 orte_sstore_base_global_snapshot_dir);
149 opal_output_verbose(10, orte_sstore_base_framework.framework_output,
150 "sstore:base: open: Global snapshot reference = %s",
151 (NULL == orte_sstore_base_global_snapshot_ref ? "Default" : orte_sstore_base_global_snapshot_ref));
152 opal_output_verbose(10, orte_sstore_base_framework.framework_output,
153 "sstore:base: open: Prelaunch location = %s",
154 (NULL == orte_sstore_base_prelaunch_location ? "Undefined" : orte_sstore_base_prelaunch_location));
155
156 orte_sstore_context = ORTE_SSTORE_UNASSIGN_TYPE;
157 orte_sstore_base_determine_context();
158
159 return ORTE_SUCCESS;
160 }
161
162 MCA_BASE_FRAMEWORK_DECLARE(orte, sstore, "ORTE Sstore", orte_sstore_base_register,
163 orte_sstore_base_open, orte_sstore_base_close,
164 mca_sstore_base_static_components, 0);
165
166
167 int orte_sstore_base_determine_context(void)
168 {
169 if( ORTE_PROC_IS_HNP) {
170 orte_sstore_context |= ORTE_SSTORE_GLOBAL_TYPE;
171 if( ORTE_PROC_IS_DAEMON ) {
172 orte_sstore_context |= ORTE_SSTORE_LOCAL_TYPE;
173 }
174 }
175 else if( ORTE_PROC_IS_DAEMON ) {
176 orte_sstore_context |= ORTE_SSTORE_LOCAL_TYPE;
177 }
178 else if( ORTE_PROC_IS_TOOL ) {
179 orte_sstore_context |= ORTE_SSTORE_TOOL_TYPE;
180 }
181 else if( !ORTE_PROC_IS_DAEMON ) {
182 orte_sstore_context |= ORTE_SSTORE_APP_TYPE;
183 }
184
185 return ORTE_SUCCESS;
186 }