This source file includes following definitions.
- orte_schizo_base_print_env
- orte_schizo_base_define_cli
- orte_schizo_base_parse_cli
- orte_schizo_base_parse_env
- orte_schizo_base_setup_app
- orte_schizo_base_setup_fork
- orte_schizo_base_setup_child
- orte_schizo_base_check_launch_environment
- orte_schizo_base_get_remaining_time
- orte_schizo_base_finalize
1
2
3
4
5
6
7
8
9
10
11
12 #include "orte_config.h"
13 #include "orte/constants.h"
14
15 #include "opal/class/opal_list.h"
16
17 #include "orte/mca/errmgr/errmgr.h"
18 #include "orte/runtime/orte_globals.h"
19 #include "orte/util/name_fns.h"
20 #include "orte/mca/schizo/base/base.h"
21
22 const char* orte_schizo_base_print_env(orte_schizo_launch_environ_t env)
23 {
24 switch(env) {
25 case ORTE_SCHIZO_UNDETERMINED:
26 return "UNDETERMINED";
27 case ORTE_SCHIZO_NATIVE_LAUNCHED:
28 return "NATIVE_LAUNCHED";
29 case ORTE_SCHIZO_UNMANAGED_SINGLETON:
30 return "UNMANAGED_SINGLETON";
31 case ORTE_SCHIZO_DIRECT_LAUNCHED:
32 return "DIRECT_LAUNCHED";
33 case ORTE_SCHIZO_MANAGED_SINGLETON:
34 return "MANAGED_SINGLETON";
35 default:
36 return "INVALID_CODE";
37 }
38 }
39
40 int orte_schizo_base_define_cli(opal_cmd_line_t *cli)
41 {
42 int rc;
43 orte_schizo_base_active_module_t *mod;
44
45 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
46 if (NULL != mod->module->define_cli) {
47 rc = mod->module->define_cli(cli);
48 if (ORTE_SUCCESS != rc && ORTE_ERR_TAKE_NEXT_OPTION != rc) {
49 ORTE_ERROR_LOG(rc);
50 return rc;
51 }
52 }
53 }
54 return ORTE_SUCCESS;
55 }
56
57 int orte_schizo_base_parse_cli(int argc, int start, char **argv)
58 {
59 int rc;
60 orte_schizo_base_active_module_t *mod;
61
62 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
63 if (NULL != mod->module->parse_cli) {
64 rc = mod->module->parse_cli(argc, start, argv);
65 if (ORTE_SUCCESS != rc && ORTE_ERR_TAKE_NEXT_OPTION != rc) {
66 ORTE_ERROR_LOG(rc);
67 return rc;
68 }
69 }
70 }
71 return ORTE_SUCCESS;
72 }
73
74 int orte_schizo_base_parse_env(char *path,
75 opal_cmd_line_t *cmd_line,
76 char **srcenv,
77 char ***dstenv)
78 {
79 int rc;
80 orte_schizo_base_active_module_t *mod;
81
82 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
83 if (NULL != mod->module->parse_env) {
84 rc = mod->module->parse_env(path, cmd_line, srcenv, dstenv);
85 if (ORTE_SUCCESS != rc && ORTE_ERR_TAKE_NEXT_OPTION != rc) {
86 ORTE_ERROR_LOG(rc);
87 return rc;
88 }
89 }
90 }
91 return ORTE_SUCCESS;
92 }
93
94 int orte_schizo_base_setup_app(orte_app_context_t *app)
95 {
96 int rc;
97 orte_schizo_base_active_module_t *mod;
98
99 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
100 if (NULL != mod->module->setup_app) {
101 rc = mod->module->setup_app(app);
102 if (ORTE_SUCCESS != rc && ORTE_ERR_TAKE_NEXT_OPTION != rc) {
103 ORTE_ERROR_LOG(rc);
104 return rc;
105 }
106 }
107 }
108 return ORTE_SUCCESS;
109 }
110
111 int orte_schizo_base_setup_fork(orte_job_t *jdata,
112 orte_app_context_t *context)
113 {
114 int rc;
115 orte_schizo_base_active_module_t *mod;
116
117 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
118 if (NULL != mod->module->setup_fork) {
119 rc = mod->module->setup_fork(jdata, context);
120 if (ORTE_SUCCESS != rc && ORTE_ERR_TAKE_NEXT_OPTION != rc) {
121 ORTE_ERROR_LOG(rc);
122 return rc;
123 }
124 }
125 }
126 return ORTE_SUCCESS;
127 }
128
129 int orte_schizo_base_setup_child(orte_job_t *jdata,
130 orte_proc_t *child,
131 orte_app_context_t *app,
132 char ***env)
133 {
134 int rc;
135 orte_schizo_base_active_module_t *mod;
136
137 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
138 if (NULL != mod->module->setup_child) {
139 rc = mod->module->setup_child(jdata, child, app, env);
140 if (ORTE_SUCCESS != rc && ORTE_ERR_TAKE_NEXT_OPTION != rc) {
141 ORTE_ERROR_LOG(rc);
142 return rc;
143 }
144 }
145 }
146 return ORTE_SUCCESS;
147 }
148
149 orte_schizo_launch_environ_t orte_schizo_base_check_launch_environment(void)
150 {
151 orte_schizo_launch_environ_t rc;
152 orte_schizo_base_active_module_t *mod;
153
154 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
155 if (NULL != mod->module->check_launch_environment) {
156 rc = mod->module->check_launch_environment();
157 if (ORTE_SCHIZO_UNDETERMINED != rc) {
158 return rc;
159 }
160 }
161 }
162 return ORTE_SCHIZO_UNDETERMINED;
163 }
164
165 int orte_schizo_base_get_remaining_time(uint32_t *timeleft)
166 {
167 int rc;
168 orte_schizo_base_active_module_t *mod;
169
170 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
171 if (NULL != mod->module->get_remaining_time) {
172 rc = mod->module->get_remaining_time(timeleft);
173 if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
174 return rc;
175 }
176 }
177 }
178 return ORTE_ERR_NOT_SUPPORTED;
179 }
180
181 void orte_schizo_base_finalize(void)
182 {
183 orte_schizo_base_active_module_t *mod;
184
185 OPAL_LIST_FOREACH(mod, &orte_schizo_base.active_modules, orte_schizo_base_active_module_t) {
186 if (NULL != mod->module->finalize) {
187 mod->module->finalize();
188 }
189 }
190 }