This source file includes following definitions.
- rte_init
- rte_finalize
- lsf_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 #ifdef HAVE_UNISTD_H
28 #include <unistd.h>
29 #endif
30 #include <string.h>
31 #include <ctype.h>
32
33 #include <lsf/lsbatch.h>
34
35 #include "opal/util/opal_environ.h"
36 #include "opal/util/argv.h"
37
38 #include "orte/util/show_help.h"
39 #include "orte/util/name_fns.h"
40 #include "orte/util/proc_info.h"
41 #include "orte/runtime/orte_globals.h"
42 #include "orte/mca/errmgr/errmgr.h"
43
44 #include "orte/mca/ess/ess.h"
45 #include "orte/mca/ess/base/base.h"
46 #include "orte/mca/ess/lsf/ess_lsf.h"
47
48 static int lsf_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_lsf_module = {
54 rte_init,
55 rte_finalize,
56 NULL,
57 NULL
58 };
59
60
61
62
63 static orte_node_rank_t my_node_rank=ORTE_NODE_RANK_INVALID;
64
65
66 static int rte_init(void)
67 {
68 int ret;
69 char *error = NULL;
70
71
72 if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
73 error = "orte_ess_base_std_prolog";
74 goto error;
75 }
76
77
78 lsf_set_name();
79
80
81
82
83 if (ORTE_PROC_IS_DAEMON) {
84 if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup())) {
85 ORTE_ERROR_LOG(ret);
86 error = "orte_ess_base_orted_setup";
87 goto error;
88 }
89 return ORTE_SUCCESS;
90 }
91
92 if (ORTE_PROC_IS_TOOL) {
93
94 if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup(NULL))) {
95 ORTE_ERROR_LOG(ret);
96 error = "orte_ess_base_tool_setup";
97 goto error;
98 }
99 return ORTE_SUCCESS;
100
101 }
102
103 return ORTE_SUCCESS;
104
105 error:
106 if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) {
107 orte_show_help("help-orte-runtime.txt",
108 "orte_init:startup:internal-failure",
109 true, error, ORTE_ERROR_NAME(ret), ret);
110 }
111
112 return ret;
113 }
114
115 static int rte_finalize(void)
116 {
117 int ret;
118
119
120 if (ORTE_PROC_IS_DAEMON) {
121 if (ORTE_SUCCESS != (ret = orte_ess_base_orted_finalize())) {
122 ORTE_ERROR_LOG(ret);
123 return ret;
124 }
125 } else if (ORTE_PROC_IS_TOOL) {
126
127 if (ORTE_SUCCESS != (ret = orte_ess_base_tool_finalize())) {
128 ORTE_ERROR_LOG(ret);
129 }
130 return ret;
131 }
132
133 return ORTE_SUCCESS;;
134 }
135
136 static int lsf_set_name(void)
137 {
138 int rc;
139 int lsf_nodeid;
140 orte_jobid_t jobid;
141 orte_vpid_t vpid;
142
143 if (NULL ==orte_ess_base_jobid) {
144 ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
145 return ORTE_ERR_NOT_FOUND;
146 }
147 if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_jobid(&jobid, orte_ess_base_jobid))) {
148 ORTE_ERROR_LOG(rc);
149 return(rc);
150 }
151 ORTE_PROC_MY_NAME->jobid = jobid;
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 lsf_nodeid = atoi(getenv("LSF_PM_TASKID"));
163 opal_output_verbose(1, orte_ess_base_framework.framework_output,
164 "ess:lsf found LSF_PM_TASKID set to %d",
165 lsf_nodeid);
166 ORTE_PROC_MY_NAME->vpid = vpid + lsf_nodeid - 1;
167
168
169 if (ORTE_SUCCESS != (rc = orte_ess_env_get())) {
170 ORTE_ERROR_LOG(rc);
171 return rc;
172 }
173
174 return ORTE_SUCCESS;
175 }