int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags) { int ret; char *error = NULL; if (0 < orte_initialized) { /* track number of times we have been called */ orte_initialized++; return ORTE_SUCCESS; } orte_initialized++; /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(pargc, pargv))) { error = "opal_init"; goto error; } /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* Register all MCA Params */ if (ORTE_SUCCESS != (ret = orte_register_params())) { error = "orte_register_params"; goto error; } /* setup the orte_show_help system */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { error = "opal_output_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* open the ESS and select the correct module for this environment */ if (ORTE_SUCCESS != (ret = orte_ess_base_open())) { error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { error = "orte_ess_base_select"; goto error; } if (ORTE_PROC_IS_APP) { #if !ORTE_DISABLE_FULL_SUPPORT && ORTE_ENABLE_PROGRESS_THREADS #if OPAL_EVENT_HAVE_THREAD_SUPPORT /* get a separate orte event base */ orte_event_base = opal_event_base_create(); /* setup the finalize event - we'll need it * to break the thread out of the event lib * when we want to stop it */ opal_event_set(orte_event_base, &orte_finalize_event, -1, OPAL_EV_WRITE, ignore_callback, NULL); opal_event_set_priority(&orte_finalize_event, ORTE_ERROR_PRI); #if 0 { /* seems strange, but wake us up once a second just so we can check for new events */ opal_event_t *ev; struct timeval tv = {1,0}; ev = opal_event_alloc(); opal_event_evtimer_set(orte_event_base, ev, ignore_callback, ev); opal_event_set_priority(ev, ORTE_INFO_PRI); opal_event_evtimer_add(ev, &tv); } #endif /* construct the thread object */ OBJ_CONSTRUCT(&orte_progress_thread, opal_thread_t); /* fork off a thread to progress it */ orte_progress_thread.t_run = orte_progress_thread_engine; if (OPAL_SUCCESS != (ret = opal_thread_start(&orte_progress_thread))) { error = "orte progress thread start"; goto error; } #else error = "event thread support is not configured"; ret = ORTE_ERROR; goto error; #endif #else /* set the event base to the opal one */ orte_event_base = opal_event_base; #endif } else { /* set the event base to the opal one */ orte_event_base = opal_event_base; } /* initialize the RTE for this environment */ if (ORTE_SUCCESS != (ret = orte_ess.init())) { error = "orte_ess_init"; goto error; } /* All done */ return ORTE_SUCCESS; error: if (ORTE_ERR_SILENT != ret) { orte_show_help("help-orte-runtime", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags) { int ret; char *error = NULL; if (0 < orte_initialized) { /* track number of times we have been called */ orte_initialized++; return ORTE_SUCCESS; } orte_initialized++; /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(pargc, pargv))) { error = "opal_init"; goto error; } /* Convince OPAL to use our naming scheme */ opal_process_name_print = _process_name_print_for_opal; opal_vpid_print = _vpid_print_for_opal; opal_jobid_print = _jobid_print_for_opal; opal_compare_proc = _process_name_compare; opal_convert_string_to_process_name = _convert_string_to_process_name; /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* Register all MCA Params */ if (ORTE_SUCCESS != (ret = orte_register_params())) { error = "orte_register_params"; goto error; } /* setup the orte_show_help system */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { error = "opal_output_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* we may have modified the local nodename according to * request to retain/strip the FQDN and prefix, so update * it here. The OPAL layer will strdup the hostname, so * we have to free it first to avoid a memory leak */ if (NULL != opal_process_info.nodename) { free(opal_process_info.nodename); } /* opal_finalize_util will call free on this pointer so set from strdup */ opal_process_info.nodename = strdup (orte_process_info.nodename); /* setup the dstore framework */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&opal_dstore_base_framework, 0))) { ORTE_ERROR_LOG(ret); error = "opal_dstore_base_open"; goto error; } if (ORTE_SUCCESS != (ret = opal_dstore_base_select())) { ORTE_ERROR_LOG(ret); error = "opal_dstore_base_select"; goto error; } /* create the handle */ if (0 > (opal_dstore_internal = opal_dstore.open("INTERNAL", "hash", NULL))) { error = "opal dstore internal"; ret = ORTE_ERR_FATAL; goto error; } if (ORTE_PROC_IS_APP) { if (0 > (opal_dstore_modex = opal_dstore.open("MODEX", "sm,hash", NULL))) { error = "opal dstore modex"; ret = ORTE_ERR_FATAL; goto error; } } if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* let the pmix server register params */ pmix_server_register(); } /* open the ESS and select the correct module for this environment */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_ess_base_framework, 0))) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { error = "orte_ess_base_select"; goto error; } if (!ORTE_PROC_IS_APP) { /* ORTE tools "block" in their own loop over the event * base, so no progress thread is required - apps will * start their progress thread in ess_base_std_app.c * at the appropriate point */ orte_event_base = opal_event_base; } /* initialize the RTE for this environment */ if (ORTE_SUCCESS != (ret = orte_ess.init())) { error = "orte_ess_init"; goto error; } /* set the remaining opal_process_info fields. Note that * the OPAL layer will have initialized these to NULL, and * anyone between us would not have strdup'd the string, so * we cannot free it here */ opal_process_info.job_session_dir = orte_process_info.job_session_dir; opal_process_info.proc_session_dir = orte_process_info.proc_session_dir; opal_process_info.num_local_peers = (int32_t)orte_process_info.num_local_peers; opal_process_info.my_local_rank = (int32_t)orte_process_info.my_local_rank; #if OPAL_HAVE_HWLOC opal_process_info.cpuset = orte_process_info.cpuset; #endif /* OPAL_HAVE_HWLOC */ #if OPAL_ENABLE_TIMING opal_timing_set_jobid(ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); #endif /* All done */ return ORTE_SUCCESS; error: if (ORTE_ERR_SILENT != ret) { orte_show_help("help-orte-runtime", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int orcm_init(orcm_proc_type_t flags) { int ret; char *error; int spin; opal_output_stream_t lds; if (0 < orcm_initialized) { /* track number of times we have been called */ orcm_initialized++; return ORCM_SUCCESS; } orcm_initialized++; if (NULL != getenv("ORCM_MCA_spin")) { spin = 1; /* spin until a debugger can attach */ while (0 != spin) { ret = 0; while (ret < 10000) { ret++; }; } } /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(NULL, NULL))) { error = "opal_init"; goto error; } orcm_debug_verbosity = -1; (void) mca_base_var_register ("orcm", "orcm", NULL, "debug_verbose", "Verbosity level for ORCM debug messages (default: 1)", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL, &orcm_debug_verbosity); if (0 <= orcm_debug_verbosity) { /* get a debug output channel */ OBJ_CONSTRUCT(&lds, opal_output_stream_t); lds.lds_want_stdout = true; orcm_debug_output = opal_output_open(&lds); OBJ_DESTRUCT(&lds); /* set the verbosity */ opal_output_set_verbosity(orcm_debug_output, orcm_debug_verbosity); } /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORCM", ORCM_ERR_BASE, ORCM_ERR_MAX, orcm_err2str); /* register handler for attr key -> string conversion */ if (ORTE_SUCCESS != (ret = orte_attr_register("orcm", ORCM_ATTR_KEY_BASE, ORCM_ATTR_KEY_MAX, orcm_attr_key_print))) { error = "register attr print"; goto error; } /* we don't need a progress thread as all our tools loop inside themselves, * so define orte_event_base to be the base opal_event_base */ orte_event_base = opal_sync_event_base; /* setup the globals */ orcm_clusters = OBJ_NEW(opal_list_t); orcm_schedulers = OBJ_NEW(opal_list_t); /* everyone must open the cfgi framework */ if (ORCM_SUCCESS != (ret = mca_base_framework_open(&orcm_cfgi_base_framework, 0))) { error = "orcm_cfgi_base_open"; goto error; } if (ORCM_SUCCESS != (ret = orcm_cfgi_base_select())) { error = "orcm_cfgi_select"; goto error; } /* everyone must open the sst framework */ if (ORCM_SUCCESS != (ret = mca_base_framework_open(&orcm_sst_base_framework, 0))) { error = "orcm_sst_base_open"; goto error; } if (ORCM_SUCCESS != (ret = orcm_sst_base_select())) { error = "orcm_sst_select"; goto error; } /* open the ESS and select the correct module for this environment - the * orcm module is basically a no-op, but we need the framework defined * as other parts of ORTE will want to call it */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_ess_base_framework, 0))) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { error = "orte_ess_base_select"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess.init())) { error = "orte_ess_init"; goto error; } /* initialize us - we will register the ORTE-level MCA params in there */ if (ORTE_SUCCESS != (ret = orcm_sst.init())) { error = "orte_init"; goto error; } /* setup the orte_show_help system - don't do this until the * end as otherwise show_help messages won't appear */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { error = "opal_output_init"; goto error; } /* initialize orcm datatype support */ if (ORCM_SUCCESS != (ret = orcm_dt_init())) { error = "orcm_dt_init"; goto error; } /* flag that orte is initialized so things can work */ orte_initialized = true; return ORCM_SUCCESS; error: if (ORCM_ERR_SILENT != ret) { opal_show_help("help-orcm-runtime.txt", "orcm_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags) { int ret; char *error = NULL; if (orte_initialized) { return ORTE_SUCCESS; } /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(pargc, pargv))) { ORTE_ERROR_LOG(ret); return ret; } /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* Register all MCA Params */ if (ORTE_SUCCESS != (ret = orte_register_params())) { error = "orte_register_params"; goto error; } /* setup the orte_show_help system */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { ORTE_ERROR_LOG(ret); error = "opal_output_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* open the ESS and select the correct module for this environment */ if (ORTE_SUCCESS != (ret = orte_ess_base_open())) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_select"; goto error; } /* initialize the RTE for this environment */ if (ORTE_SUCCESS != (ret = orte_ess.init())) { ORTE_ERROR_LOG(ret); error = "orte_ess_set_name"; goto error; } /* All done */ orte_initialized = true; return ORTE_SUCCESS; error: if (ORTE_ERR_SILENT != OPAL_SOS_GET_ERROR_CODE(ret)) { orte_show_help("help-orte-runtime", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int orcm_init(orcm_proc_type_t flags) { int ret; char *error, *envar; int spin; opal_output_stream_t lds; if (0 < orcm_initialized) { /* track number of times we have been called */ orcm_initialized++; return ORCM_SUCCESS; } orcm_initialized++; if (NULL != getenv("ORCM_MCA_spin")) { spin = 1; /* spin until a debugger can attach */ while (0 != spin) { ret = 0; while (ret < 10000) { ret++; }; } } /* prior to initializing the OPAL layer, check to see * if the OPAL (and friends) install location has been * moved. In order to avoid conflicts with any other * OPAL-using software, the relocation point will have * been expressed as a set of "ORCM_foo" envars. We * therefore check for the ORCM_foo values, and name-shift * any we find to OPAL_foo so that OPAL will find them. * Since all ORCM tools will have already copied their * local environment, these name-shifted vars will not * appear in the environment of any launched processes */ if (NULL != (envar = getenv("ORCM_PREFIX"))) { opal_unsetenv("ORCM_PREFIX", &environ); opal_setenv("OPAL_PREFIX", envar, true, &environ); } if (NULL != (envar = getenv("ORCM_LIBDIR"))) { opal_unsetenv("ORCM_LIBDIR", &environ); opal_setenv("OPAL_LIBDIR", envar, true, &environ); } if (NULL != (envar = getenv("ORCM_DATADIR"))) { opal_unsetenv("ORCM_DATADIR", &environ); opal_setenv("OPAL_DATADIR", envar, true, &environ); } /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(NULL, NULL))) { error = "opal_init"; goto error; } orcm_debug_verbosity = -1; (void) mca_base_var_register ("orcm", "orcm", NULL, "debug_verbose", "Verbosity level for ORCM debug messages (default: 1)", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL, &orcm_debug_verbosity); if (0 <= orcm_debug_verbosity) { /* get a debug output channel */ OBJ_CONSTRUCT(&lds, opal_output_stream_t); lds.lds_want_stdout = true; orcm_debug_output = opal_output_open(&lds); OBJ_DESTRUCT(&lds); /* set the verbosity */ opal_output_set_verbosity(orcm_debug_output, orcm_debug_verbosity); } /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORCM", ORCM_ERR_BASE, ORCM_ERR_MAX, orcm_err2str); /* register handler for attr key -> string conversion */ if (ORTE_SUCCESS != (ret = orte_attr_register("orcm", ORCM_ATTR_KEY_BASE, ORCM_ATTR_KEY_MAX, orcm_attr_key_print))) { error = "register attr print"; goto error; } /* we don't need a progress thread as all our tools loop inside themselves, * so define orte_event_base to be the base opal_event_base */ orte_event_base = opal_sync_event_base; /* setup the globals */ orcm_clusters = OBJ_NEW(opal_list_t); orcm_schedulers = OBJ_NEW(opal_list_t); if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orcm_parser_base_framework, 0))) { ORTE_ERROR_LOG(ret); error = "orcm_parser_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orcm_parser_base_select())) { ORTE_ERROR_LOG(ret); error = "orcm_parser_select"; goto error; } /* everyone must open the cfgi framework */ if (ORCM_SUCCESS != (ret = mca_base_framework_open(&orcm_cfgi_base_framework, 0))) { error = "orcm_cfgi_base_open"; goto error; } if (ORCM_SUCCESS != (ret = orcm_cfgi_base_select())) { error = "orcm_cfgi_select"; goto error; } envar = getenv("ORCM_MCA_logical_group_config_file"); if (ORCM_SUCCESS != (ret = orcm_logical_group_load_to_memory(envar))) { error = "orcm_logical_group_load_to_memory"; goto error; } if (ORCM_SCHED == flags) { if (NULL == (envar = getenv("ORCM_MCA_event_exec_path"))) { asprintf(&orcm_event_exec_path, "%s/bin", opal_install_dirs.prefix); } else { orcm_event_exec_path = strdup(envar); } if (NULL == orcm_event_exec_path) { error = "orcm_event_exec_path"; goto error; } } /* everyone must open the sst framework */ if (ORCM_SUCCESS != (ret = mca_base_framework_open(&orcm_sst_base_framework, 0))) { error = "orcm_sst_base_open"; goto error; } if (ORCM_SUCCESS != (ret = orcm_sst_base_select())) { error = "orcm_sst_select"; goto error; } /* open the ESS and select the correct module for this environment - the * orcm module is basically a no-op, but we need the framework defined * as other parts of ORTE will want to call it */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_ess_base_framework, 0))) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { error = "orte_ess_base_select"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess.init())) { error = "orte_ess_init"; goto error; } /* initialize us - we will register the ORTE-level MCA params in there */ if (ORTE_SUCCESS != (ret = orcm_sst.init())) { error = "orte_init"; goto error; } /* setup the orte_show_help system - don't do this until the * end as otherwise show_help messages won't appear */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { error = "opal_output_init"; goto error; } /* initialize orcm datatype support */ if (ORCM_SUCCESS != (ret = orcm_dt_init())) { error = "orcm_dt_init"; goto error; } /* flag that orte is initialized so things can work */ orte_initialized = true; orte_help_want_aggregate = false; return ORCM_SUCCESS; error: if (ORCM_ERR_SILENT != ret) { opal_show_help("help-orcm-runtime.txt", "orcm_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags) { int ret; char *error = NULL; if (0 < orte_initialized) { /* track number of times we have been called */ orte_initialized++; return ORTE_SUCCESS; } orte_initialized++; /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(pargc, pargv))) { error = "opal_init"; goto error; } /* Convince OPAL to use our naming scheme */ opal_process_name_print = _process_name_print_for_opal; opal_process_name_vpid = _process_name_vpid_for_opal; opal_process_name_jobid = _process_name_jobid_for_opal; opal_compare_proc = _process_name_compare; /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* Register all MCA Params */ if (ORTE_SUCCESS != (ret = orte_register_params())) { error = "orte_register_params"; goto error; } /* setup the orte_show_help system */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { error = "opal_output_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* open the ESS and select the correct module for this environment */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_ess_base_framework, 0))) { ORTE_ERROR_LOG(ret); error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { error = "orte_ess_base_select"; goto error; } if (!ORTE_PROC_IS_APP) { /* ORTE tools "block" in their own loop over the event * base, so no progress thread is required - apps will * start their progress thread in ess_base_std_app.c * at the appropriate point */ orte_event_base = opal_event_base; } /* initialize the RTE for this environment */ if (ORTE_SUCCESS != (ret = orte_ess.init())) { error = "orte_ess_init"; goto error; } /* All done */ return ORTE_SUCCESS; error: if (ORTE_ERR_SILENT != ret) { orte_show_help("help-orte-runtime", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags) { int ret; char *error = NULL; if (0 < orte_initialized) { /* track number of times we have been called */ orte_initialized++; return ORTE_SUCCESS; } orte_initialized++; /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(pargc, pargv))) { error = "opal_init"; goto error; } /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* Register all MCA Params */ if (ORTE_SUCCESS != (ret = orte_register_params())) { error = "orte_register_params"; goto error; } /* setup the orte_show_help system */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { error = "opal_output_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* open the ESS and select the correct module for this environment */ if (ORTE_SUCCESS != (ret = orte_ess_base_open())) { error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { error = "orte_ess_base_select"; goto error; } #if ORTE_ENABLE_PROGRESS_THREADS #if OPAL_EVENT_HAVE_THREAD_SUPPORT /* get a separate orte event base */ orte_event_base = opal_event_base_create(); /* construct the thread object */ OBJ_CONSTRUCT(&orte_progress_thread, opal_thread_t); /* fork off a thread to progress it */ orte_progress_thread.t_run = orte_progress_thread_engine; if (OPAL_SUCCESS != (ret = opal_thread_start(&orte_progress_thread))) { error = "orte progress thread start"; goto error; } #else error = "event thread support is not configured"; ret = ORTE_ERROR; goto error; #endif #else /* set the event base to the opal one */ orte_event_base = opal_event_base; #endif /* initialize the RTE for this environment */ if (ORTE_SUCCESS != (ret = orte_ess.init())) { error = "orte_ess_init"; goto error; } /* All done */ return ORTE_SUCCESS; error: if (ORTE_ERR_SILENT != ret) { orte_show_help("help-orte-runtime", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int main(int argc, char *argv[]) { int ret = 0; bool want_help = false; bool cmd_error = false; bool acted = false; bool want_all = false; char **app_env = NULL, **global_env = NULL; int i, len; char *str; /* Initialize the argv parsing handle */ if (ORTE_SUCCESS != opal_init_util(&argc, &argv)) { orte_show_help("help-orte-info.txt", "lib-call-fail", true, "opal_init_util", __FILE__, __LINE__, NULL); exit(ret); } orte_info_cmd_line = OBJ_NEW(opal_cmd_line_t); if (NULL == orte_info_cmd_line) { ret = errno; orte_show_help("help-orte-info.txt", "lib-call-fail", true, "opal_cmd_line_create", __FILE__, __LINE__, NULL); opal_finalize_util(); exit(ret); } opal_cmd_line_make_opt3(orte_info_cmd_line, 'v', NULL, "version", 2, "Show version of ORTE or a component. The first parameter can be the keywords \"orte\" or \"all\", a framework name (indicating all components in a framework), or a framework:component string (indicating a specific component). The second parameter can be one of: full, major, minor, release, greek, svn."); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "param", 2, "Show MCA parameters. The first parameter is the framework (or the keyword \"all\"); the second parameter is the specific component name (or the keyword \"all\")."); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "internal", 0, "Show internal MCA parameters (not meant to be modified by users)"); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "path", 1, "Show paths that Open MPI was configured with. Accepts the following parameters: prefix, bindir, libdir, incdir, mandir, pkglibdir, sysconfdir"); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "arch", 0, "Show architecture Open MPI was corteled on"); opal_cmd_line_make_opt3(orte_info_cmd_line, 'c', NULL, "config", 0, "Show configuration options"); opal_cmd_line_make_opt3(orte_info_cmd_line, 'h', NULL, "help", 0, "Show this help message"); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "orte_info_pretty", 0, "When used in conjunction with other parameters, the output is displayed in 'orte_info_prettyprint' format (default)"); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "parsable", 0, "When used in conjunction with other parameters, the output is displayed in a machine-parsable format"); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "parseable", 0, "Synonym for --parsable"); opal_cmd_line_make_opt3(orte_info_cmd_line, '\0', NULL, "hostname", 0, "Show the hostname that Open MPI was configured " "and built on"); opal_cmd_line_make_opt3(orte_info_cmd_line, 'a', NULL, "all", 0, "Show all configuration options and MCA parameters"); /* Call some useless functions in order to guarantee to link in some * global variables. Only check the return value so that the * corteler doesn't optimize out the useless function. */ if (ORTE_SUCCESS != orte_locks_init()) { /* Stop .. or I'll say stop again! */ ++ret; } else { --ret; } /* set our threading level */ opal_set_using_threads(false); /* Get MCA parameters, if any */ if( ORTE_SUCCESS != mca_base_open() ) { orte_show_help("help-orte-info.txt", "lib-call-fail", true, "mca_base_open", __FILE__, __LINE__ ); OBJ_RELEASE(orte_info_cmd_line); opal_finalize_util(); exit(1); } mca_base_cmd_line_setup(orte_info_cmd_line); /* Do the parsing */ ret = opal_cmd_line_parse(orte_info_cmd_line, false, argc, argv); if (OPAL_SUCCESS != ret) { if (OPAL_ERR_SILENT != ret) { fprintf(stderr, "%s: command line error (%s)\n", argv[0], opal_strerror(ret)); } cmd_error = true; } if (!cmd_error && (opal_cmd_line_is_taken(orte_info_cmd_line, "help") || opal_cmd_line_is_taken(orte_info_cmd_line, "h"))) { char *str, *usage; want_help = true; usage = opal_cmd_line_get_usage_msg(orte_info_cmd_line); str = opal_show_help_string("help-orte-info.txt", "usage", true, usage); if (NULL != str) { printf("%s", str); free(str); } free(usage); } if (cmd_error || want_help) { mca_base_close(); OBJ_RELEASE(orte_info_cmd_line); opal_finalize_util(); exit(cmd_error ? 1 : 0); } mca_base_cmd_line_process_args(orte_info_cmd_line, &app_env, &global_env); /* putenv() all the stuff that we got back from env (in case the * user specified some --mca params on the command line). This * creates a memory leak, but that's unfortunately how putenv() * works. :-( */ len = opal_argv_count(app_env); for (i = 0; i < len; ++i) { putenv(app_env[i]); } len = opal_argv_count(global_env); for (i = 0; i < len; ++i) { putenv(global_env[i]); } /* setup the mca_types array */ OBJ_CONSTRUCT(&mca_types, opal_pointer_array_t); opal_pointer_array_init(&mca_types, 256, INT_MAX, 128); opal_info_register_types(&mca_types); orte_info_register_types(&mca_types); /* Execute the desired action(s) */ if (opal_cmd_line_is_taken(orte_info_cmd_line, "orte_info_pretty")) { orte_info_pretty = true; } else if (opal_cmd_line_is_taken(orte_info_cmd_line, "parsable") || opal_cmd_line_is_taken(orte_info_cmd_line, "parseable")) { orte_info_pretty = false; } want_all = opal_cmd_line_is_taken(orte_info_cmd_line, "all"); if (want_all || opal_cmd_line_is_taken(orte_info_cmd_line, "version")) { orte_info_do_version(want_all, orte_info_cmd_line); acted = true; } if (want_all || opal_cmd_line_is_taken(orte_info_cmd_line, "path")) { orte_info_do_path(want_all, orte_info_cmd_line); acted = true; } if (want_all || opal_cmd_line_is_taken(orte_info_cmd_line, "arch")) { orte_info_do_arch(); acted = true; } if (want_all || opal_cmd_line_is_taken(orte_info_cmd_line, "hostname")) { orte_info_do_hostname(); acted = true; } if (want_all || opal_cmd_line_is_taken(orte_info_cmd_line, "config")) { orte_info_do_config(true); acted = true; } if (want_all || opal_cmd_line_is_taken(orte_info_cmd_line, "param")) { orte_info_do_params(want_all, opal_cmd_line_is_taken(orte_info_cmd_line, "internal")); acted = true; } /* If no command line args are specified, show default set */ if (!acted) { orte_info_show_orte_version(orte_info_ver_full); orte_info_show_path(orte_info_path_prefix, opal_install_dirs.prefix); orte_info_do_arch(); orte_info_do_hostname(); orte_info_do_config(false); orte_info_components_open(); for (i = 0; i < mca_types.size; ++i) { if (NULL == (str = (char*)opal_pointer_array_get_item(&mca_types, i))) { continue; } orte_info_show_component_version(str, orte_info_component_all, orte_info_ver_full, orte_info_type_all); } } /* All done */ if (NULL != app_env) { opal_argv_free(app_env); } if (NULL != global_env) { opal_argv_free(global_env); } orte_info_components_close (); OBJ_RELEASE(orte_info_cmd_line); OBJ_DESTRUCT(&mca_types); mca_base_close(); opal_finalize_util(); return 0; }