This source file includes following definitions.
- check_launch_environment
- finalize
1
2
3
4
5
6
7
8
9
10
11 #include "orte_config.h"
12 #include "orte/types.h"
13 #include "opal/types.h"
14
15 #ifdef HAVE_UNISTD_H
16 #include <unistd.h>
17 #endif
18 #include <ctype.h>
19
20 #include "opal/util/argv.h"
21 #include "opal/util/basename.h"
22 #include "opal/util/opal_environ.h"
23
24 #include "orte/runtime/orte_globals.h"
25 #include "orte/util/name_fns.h"
26 #include "orte/mca/schizo/base/base.h"
27
28 #include "schizo_orte.h"
29
30 static orte_schizo_launch_environ_t check_launch_environment(void);
31 static void finalize(void);
32
33 orte_schizo_base_module_t orte_schizo_orte_module = {
34 .check_launch_environment = check_launch_environment,
35 .finalize = finalize
36 };
37
38 static char **pushed_envs = NULL;
39 static char **pushed_vals = NULL;
40 static orte_schizo_launch_environ_t myenv;
41 static bool myenvdefined = false;
42
43 static orte_schizo_launch_environ_t check_launch_environment(void)
44 {
45 int i;
46
47 if (myenvdefined) {
48 return myenv;
49 }
50 myenvdefined = true;
51
52
53
54
55 if (NULL != orte_process_info.my_daemon_uri) {
56
57 myenv = ORTE_SCHIZO_NATIVE_LAUNCHED;
58 opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"ess");
59 opal_argv_append_nosize(&pushed_vals, "pmi");
60 goto setup;
61 }
62
63
64
65 myenv = ORTE_SCHIZO_UNMANAGED_SINGLETON;
66 opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"ess");
67 opal_argv_append_nosize(&pushed_vals, "singleton");
68
69 opal_argv_append_nosize(&pushed_envs, "ORTE_SCHIZO_DETECTION");
70 opal_argv_append_nosize(&pushed_vals, "ORTE");
71
72
73 setup:
74 opal_output_verbose(1, orte_schizo_base_framework.framework_output,
75 "schizo:orte DECLARED AS %s", orte_schizo_base_print_env(myenv));
76 if (NULL != pushed_envs) {
77 for (i=0; NULL != pushed_envs[i]; i++) {
78 opal_setenv(pushed_envs[i], pushed_vals[i], true, &environ);
79 }
80 }
81 return myenv;
82 }
83
84 static void finalize(void)
85 {
86 int i;
87
88 if (NULL != pushed_envs) {
89 for (i=0; NULL != pushed_envs[i]; i++) {
90 opal_unsetenv(pushed_envs[i], &environ);
91 }
92 opal_argv_free(pushed_envs);
93 opal_argv_free(pushed_vals);
94 }
95 }