|
39 | 39 | #include "orte/mca/routed/routed.h" |
40 | 40 | #include "orte/util/name_fns.h" |
41 | 41 | #include "orte/util/session_dir.h" |
| 42 | +#include "orte/util/show_help.h" |
42 | 43 | #include "orte/runtime/orte_globals.h" |
43 | 44 | #include "orte/runtime/orte_wait.h" |
44 | 45 | #include "orte/runtime/orte_data_server.h" |
@@ -198,3 +199,47 @@ void ompi_rte_wait_for_debugger(void) |
198 | 199 | opal_pmix.deregister_evhandler(handler, NULL, NULL); |
199 | 200 | } |
200 | 201 | } |
| 202 | + |
| 203 | +bool ompi_rte_connect_accept_support(const char *port) |
| 204 | +{ |
| 205 | + char *ptr, *tmp; |
| 206 | + orte_process_name_t name; |
| 207 | + |
| 208 | + /* were we launched by mpirun, or are we calling |
| 209 | + * without a defined port? */ |
| 210 | + if (NULL == orte_process_info.my_hnp_uri || |
| 211 | + 0 == strlen(port)) { |
| 212 | + return true; |
| 213 | + } |
| 214 | + |
| 215 | + /* is the job family in the port different than my own? */ |
| 216 | + tmp = strdup(port); // protect input |
| 217 | + if (NULL == (ptr = strchr(tmp, ':'))) { |
| 218 | + /* this port didn't come from us! */ |
| 219 | + orte_show_help("help-orterun.txt", "orterun:malformedport", true); |
| 220 | + free(tmp); |
| 221 | + return false; |
| 222 | + } |
| 223 | + *ptr = '\0'; |
| 224 | + if (ORTE_SUCCESS != orte_util_convert_string_to_process_name(&name, tmp)) { |
| 225 | + free(tmp); |
| 226 | + orte_show_help("help-orterun.txt", "orterun:malformedport", true); |
| 227 | + return false; |
| 228 | + } |
| 229 | + free(tmp); |
| 230 | + if (ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid) == ORTE_JOB_FAMILY(name.jobid)) { |
| 231 | + /* same job family, so our infrastructure is adequate */ |
| 232 | + return true; |
| 233 | + } |
| 234 | + |
| 235 | + /* if the job family of the port is different than our own |
| 236 | + * and we were launched by mpirun, then we require ompi-server |
| 237 | + * support */ |
| 238 | + if (NULL == orte_data_server_uri) { |
| 239 | + /* print a pretty help message */ |
| 240 | + orte_show_help("help-orterun.txt", "orterun:server-unavailable", true); |
| 241 | + return false; |
| 242 | + } |
| 243 | + |
| 244 | + return true; |
| 245 | +} |
0 commit comments