This source file includes following definitions.
- rte_init
- rte_finalize
- alps_set_name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "orte_config.h"
25 #include "orte/constants.h"
26
27 #include "orte/util/show_help.h"
28 #include "opal/util/argv.h"
29
30 #include "orte/util/proc_info.h"
31 #include "orte/mca/errmgr/base/base.h"
32 #include "orte/util/name_fns.h"
33 #include "orte/runtime/orte_globals.h"
34
35 #include "orte/mca/ess/ess.h"
36 #include "orte/mca/ess/base/base.h"
37 #include "orte/mca/ess/alps/ess_alps.h"
38
39 #include <errno.h>
40
41 static int alps_set_name(void);
42 static int rte_init(void);
43 static int rte_finalize(void);
44
45 orte_ess_base_module_t orte_ess_alps_module = {
46 rte_init,
47 rte_finalize,
48 NULL,
49 NULL
50 };
51
52
53 static orte_vpid_t starting_vpid = 0;
54
55
56 static int rte_init(void)
57 {
58 int ret;
59 char *error = NULL;
60
61 OPAL_OUTPUT_VERBOSE((1, orte_ess_base_framework.framework_output,
62 "ess:alps in rte_init"));
63
64
65
66
67
68
69 if (ORTE_PROC_IS_APP) {
70 error = "mpi rank invoking alps rte_init";
71 ret = ORTE_ERR_NOT_SUPPORTED;
72 goto fn_fail;
73 }
74
75
76 if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
77 error = "orte_ess_base_std_prolog";
78 goto fn_fail;
79 }
80
81 if (ORTE_SUCCESS != (ret = alps_set_name())) {
82 error = "alps_set_name";
83 goto fn_fail;
84 }
85
86
87
88
89
90 if (ORTE_PROC_IS_DAEMON) {
91 if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup())) {
92 ORTE_ERROR_LOG(ret);
93 error = "orte_ess_base_orted_setup";
94 goto fn_fail;
95 }
96
97
98
99
100
101 if (ORTE_SUCCESS != (ret = orte_ess_alps_sync_start())) {
102 error = "orte_ess_alps_sync";
103 goto fn_fail;
104 }
105
106 ret = ORTE_SUCCESS;
107 goto fn_exit;
108 }
109
110 if (ORTE_PROC_IS_TOOL) {
111
112 if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup(NULL))) {
113 ORTE_ERROR_LOG(ret);
114 error = "orte_ess_base_tool_setup";
115 goto fn_fail;
116 }
117
118 ret = ORTE_SUCCESS;
119 goto fn_exit;
120 }
121
122 fn_exit:
123 return ret;
124
125 fn_fail:
126 if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) {
127 orte_show_help("help-orte-runtime.txt",
128 "orte_init:startup:internal-failure",
129 true, error, ORTE_ERROR_NAME(ret), ret);
130 }
131 goto fn_exit;
132 }
133
134 static int rte_finalize(void)
135 {
136 int ret = ORTE_SUCCESS;
137
138
139 if (ORTE_PROC_IS_DAEMON) {
140 if (ORTE_SUCCESS != (ret = orte_ess_base_orted_finalize())) {
141 ORTE_ERROR_LOG(ret);
142 goto fn_exit;
143 }
144
145
146 if (ORTE_SUCCESS != (ret = orte_ess_alps_sync_complete())) {
147 ORTE_ERROR_LOG(ret);
148 }
149
150 } else if (ORTE_PROC_IS_TOOL) {
151
152 if (ORTE_SUCCESS != (ret = orte_ess_base_tool_finalize())) {
153 ORTE_ERROR_LOG(ret);
154 }
155 }
156
157 fn_exit:
158 return ret;
159 }
160
161 static int alps_set_name(void)
162 {
163 int rc;
164 int rank;
165 orte_jobid_t jobid;
166
167 if (NULL == orte_ess_base_jobid) {
168 ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
169 return ORTE_ERR_NOT_FOUND;
170 }
171 if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_jobid(&jobid, orte_ess_base_jobid))) {
172 ORTE_ERROR_LOG(rc);
173 return rc;
174 }
175
176 if (NULL == orte_ess_base_vpid) {
177 ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
178 return ORTE_ERR_NOT_FOUND;
179 }
180 if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_vpid(&starting_vpid,
181 orte_ess_base_vpid))) {
182 ORTE_ERROR_LOG(rc);
183 return(rc);
184 }
185
186 ORTE_PROC_MY_NAME->jobid = jobid;
187
188 if (ORTE_SUCCESS != (rc = orte_ess_alps_get_first_rank_on_node(&rank))) {
189 ORTE_ERROR_LOG(rc);
190 return(rc);
191 }
192
193 ORTE_PROC_MY_NAME->vpid = (orte_vpid_t)rank + starting_vpid;
194
195
196 if (ORTE_SUCCESS != (rc = orte_ess_env_get())) {
197 ORTE_ERROR_LOG(rc);
198 return rc;
199 }
200
201 return ORTE_SUCCESS;
202 }