This source file includes following definitions.
- rte_init
- rte_finalize
- tm_set_name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "orte_config.h"
23 #include "orte/constants.h"
24
25 #ifdef HAVE_UNISTD_H
26 #include <unistd.h>
27 #endif
28 #include <string.h>
29 #include <ctype.h>
30
31
32 #include "opal/util/opal_environ.h"
33 #include "opal/util/output.h"
34 #include "opal/util/argv.h"
35 #include "opal/class/opal_pointer_array.h"
36 #include "opal/dss/dss.h"
37
38 #include "orte/util/proc_info.h"
39 #include "orte/util/show_help.h"
40 #include "orte/mca/errmgr/errmgr.h"
41 #include "orte/util/name_fns.h"
42 #include "orte/runtime/orte_globals.h"
43
44 #include "orte/mca/ess/ess.h"
45 #include "orte/mca/ess/base/base.h"
46 #include "orte/mca/ess/tm/ess_tm.h"
47
48 static int tm_set_name(void);
49
50 static int rte_init(void);
51 static int rte_finalize(void);
52
53 orte_ess_base_module_t orte_ess_tm_module = {
54 rte_init,
55 rte_finalize,
56 NULL,
57 NULL
58 };
59
60
61
62
63
64
65 static int rte_init(void)
66 {
67 int ret;
68 char *error = NULL;
69
70
71 if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
72 error = "orte_ess_base_std_prolog";
73 goto error;
74 }
75
76
77 tm_set_name();
78
79
80
81
82 if (ORTE_PROC_IS_DAEMON) {
83 if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup())) {
84 ORTE_ERROR_LOG(ret);
85 error = "orte_ess_base_orted_setup";
86 goto error;
87 }
88 return ORTE_SUCCESS;
89 }
90
91 if (ORTE_PROC_IS_TOOL) {
92
93 if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup(NULL))) {
94 ORTE_ERROR_LOG(ret);
95 error = "orte_ess_base_tool_setup";
96 goto error;
97 }
98 return ORTE_SUCCESS;
99
100 }
101
102
103 error = "ess_error";
104 ret = ORTE_ERROR;
105
106 error:
107 if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) {
108 orte_show_help("help-orte-runtime.txt",
109 "orte_init:startup:internal-failure",
110 true, error, ORTE_ERROR_NAME(ret), ret);
111 }
112
113 return ret;
114 }
115
116 static int rte_finalize(void)
117 {
118 int ret;
119
120
121 if (ORTE_PROC_IS_DAEMON) {
122 if (ORTE_SUCCESS != (ret = orte_ess_base_orted_finalize())) {
123 ORTE_ERROR_LOG(ret);
124 return ret;
125 }
126 } else if (ORTE_PROC_IS_TOOL) {
127
128 if (ORTE_SUCCESS != (ret = orte_ess_base_tool_finalize())) {
129 ORTE_ERROR_LOG(ret);
130 }
131 return ret;
132 }
133
134 return ORTE_SUCCESS;
135 }
136
137 static int tm_set_name(void)
138 {
139 int rc;
140 orte_jobid_t jobid;
141 orte_vpid_t vpid;
142
143 OPAL_OUTPUT_VERBOSE((1, orte_ess_base_framework.framework_output,
144 "ess:tm setting name"));
145 if (NULL == orte_ess_base_jobid) {
146 ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
147 return ORTE_ERR_NOT_FOUND;
148 }
149 if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_jobid(&jobid, orte_ess_base_jobid))) {
150 ORTE_ERROR_LOG(rc);
151 return(rc);
152 }
153
154 if (NULL == orte_ess_base_vpid) {
155 ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
156 return ORTE_ERR_NOT_FOUND;
157 }
158 if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_vpid(&vpid, orte_ess_base_vpid))) {
159 ORTE_ERROR_LOG(rc);
160 return(rc);
161 }
162
163 ORTE_PROC_MY_NAME->jobid = jobid;
164 ORTE_PROC_MY_NAME->vpid = vpid;
165
166 OPAL_OUTPUT_VERBOSE((1, orte_ess_base_framework.framework_output,
167 "ess:tm set name to %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
168
169
170 if (ORTE_SUCCESS != (rc = orte_ess_env_get())) {
171 ORTE_ERROR_LOG(rc);
172 return rc;
173 }
174
175 return ORTE_SUCCESS;
176 }