static int rte_init(void) { int ret; char *error = NULL; char **hosts = NULL; OPAL_OUTPUT_VERBOSE((1, orte_ess_base_framework.framework_output, "ess:alps in rte_init")); /* * shouldn't have been able to open this ess component if * process is app proc */ if (ORTE_PROC_IS_APP) { error = "mpi rank invoking alps rte_init"; ret = ORTE_ERR_NOT_SUPPORTED; goto fn_fail; } /* run the prolog */ if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) { error = "orte_ess_base_std_prolog"; goto fn_fail; } if (ORTE_SUCCESS != (ret = alps_set_name())) { error = "alps_set_name"; goto fn_fail; } /* * if I am a daemon, complete my setup using the * default procedure */ if (ORTE_PROC_IS_DAEMON) { if (NULL != orte_node_regex) { /* extract the nodes */ if (ORTE_SUCCESS != (ret = orte_regex_extract_node_names(orte_node_regex, &hosts)) || NULL == hosts) { error = "orte_regex_extract_node_names"; goto fn_fail; } } if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup(hosts))) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_orted_setup"; goto fn_fail; } if (NULL != hosts) { opal_argv_free(hosts); } /* * now synchronize with aprun. */ if (ORTE_SUCCESS != (ret = orte_ess_alps_sync_start())) { error = "orte_ess_alps_sync"; goto fn_fail; } ret = ORTE_SUCCESS; goto fn_exit; } if (ORTE_PROC_IS_TOOL) { /* otherwise, if I am a tool proc, use that procedure */ if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_tool_setup"; goto fn_fail; } /* as a tool, I don't need a nidmap - so just return now */ ret = ORTE_SUCCESS; goto fn_exit; } fn_exit: return ret; fn_fail: if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) { orte_show_help("help-orte-runtime.txt", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } goto fn_exit; }
static int rte_init(void) { int ret, i; char *error = NULL; char **hosts = NULL; /* run the prolog */ if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) { error = "orte_ess_base_std_prolog"; goto error; } /* Start by getting a unique name */ alps_set_name(); /* if I am a daemon, complete my setup using the * default procedure */ if (ORTE_PROC_IS_DAEMON) { if (NULL != orte_node_regex) { /* extract the nodes */ if (ORTE_SUCCESS != (ret = orte_regex_extract_node_names(orte_node_regex, &hosts)) || NULL == hosts) { error = "orte_regex_extract_node_names"; goto error; } /* find our host in the list */ for (i=0; NULL != hosts[i]; i++) { if (0 == strncmp(hosts[i], orte_process_info.nodename, strlen(hosts[i]))) { /* correct our vpid */ ORTE_PROC_MY_NAME->vpid = starting_vpid + i; OPAL_OUTPUT_VERBOSE((1, orte_ess_base_output, "ess:alps reset name to %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); break; } } } if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup(hosts))) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_orted_setup"; goto error; } opal_argv_free(hosts); return ORTE_SUCCESS; } if (ORTE_PROC_IS_TOOL) { /* otherwise, if I am a tool proc, use that procedure */ if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_tool_setup"; goto error; } /* as a tool, I don't need a nidmap - so just return now */ return ORTE_SUCCESS; } /* otherwise, I must be an application process - use * the default procedure to finish my setup */ if (ORTE_SUCCESS != (ret = orte_ess_base_app_setup())) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_app_setup"; goto error; } /* setup the nidmap arrays */ if (ORTE_SUCCESS != (ret = orte_util_nidmap_init(orte_process_info.sync_buf))) { ORTE_ERROR_LOG(ret); error = "orte_util_nidmap_init"; goto error; } return ORTE_SUCCESS; error: orte_show_help("help-orte-runtime.txt", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); return ret; }