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 opal_init_util(int* pargc, char*** pargv) { int ret; char *error = NULL; if( ++opal_util_initialized != 1 ) { if( opal_util_initialized < 1 ) { return OPAL_ERROR; } return OPAL_SUCCESS; } /* JMS See note in runtime/opal.h -- this is temporary; to be replaced with real hwloc information soon (in trunk/v1.5 and beyond, only). This *used* to be a #define, so it's important to define it very early. */ opal_cache_line_size = 128; /* initialize the memory allocator */ opal_malloc_init(); /* initialize the output system */ opal_output_init(); /* initialize install dirs code */ if (OPAL_SUCCESS != (ret = opal_installdirs_base_open())) { fprintf(stderr, "opal_installdirs_base_open() failed -- process will likely abort (%s:%d, returned %d instead of OPAL_INIT)\n", __FILE__, __LINE__, ret); return ret; } /* initialize the help system */ opal_show_help_init(); /* register handler for errnum -> string converstion */ if (OPAL_SUCCESS != (ret = opal_error_register("OPAL", OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { error = "opal_error_register"; goto return_error; } /* init the trace function */ opal_trace_init(); /* keyval lex-based parser */ if (OPAL_SUCCESS != (ret = opal_util_keyval_parse_init())) { error = "opal_util_keyval_parse_init"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_net_init())) { error = "opal_net_init"; goto return_error; } /* Setup the parameter system */ if (OPAL_SUCCESS != (ret = mca_base_param_init())) { error = "mca_base_param_init"; goto return_error; } /* register params for opal */ if (OPAL_SUCCESS != (ret = opal_register_params())) { error = "opal_register_params"; goto return_error; } /* pretty-print stack handlers */ if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers())) { error = "opal_util_register_stackhandlers"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_util_init_sys_limits())) { error = "opal_util_init_sys_limits"; goto return_error; } /* initialize the datatype engine */ if (OPAL_SUCCESS != (ret = opal_datatype_init ())) { error = "opal_datatype_init"; goto return_error; } /* Initialize the data storage service. */ if (OPAL_SUCCESS != (ret = opal_dss_open())) { error = "opal_dss_open"; goto return_error; } return OPAL_SUCCESS; return_error: opal_show_help( "help-opal-runtime.txt", "opal_init:startup:internal-failure", true, error, 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 opal_init_test(void) { int ret; char *error; /* initialize the memory allocator */ opal_malloc_init(); /* initialize the output system */ opal_output_init(); /* initialize install dirs code */ if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_installdirs_base_framework, 0))) { fprintf(stderr, "opal_installdirs_base_open() failed -- process will likely abort (%s:%d, returned %d instead of OPAL_SUCCESS)\n", __FILE__, __LINE__, ret); return ret; } /* initialize the help system */ opal_show_help_init(); /* register handler for errnum -> string converstion */ if (OPAL_SUCCESS != (ret = opal_error_register("OPAL", OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { error = "opal_error_register"; goto return_error; } /* keyval lex-based parser */ if (OPAL_SUCCESS != (ret = opal_util_keyval_parse_init())) { error = "opal_util_keyval_parse_init"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_net_init())) { error = "opal_net_init"; goto return_error; } /* Setup the parameter system */ if (OPAL_SUCCESS != (ret = mca_base_var_init())) { error = "mca_base_var_init"; goto return_error; } /* register params for opal */ if (OPAL_SUCCESS != (ret = opal_register_params())) { error = "opal_register_params"; goto return_error; } /* pretty-print stack handlers */ if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers())) { error = "opal_util_register_stackhandlers"; goto return_error; } /* Initialize the data storage service. */ if (OPAL_SUCCESS != (ret = opal_dss_open())) { error = "opal_dss_open"; goto return_error; } /* initialize the mca */ if (OPAL_SUCCESS != (ret = mca_base_open())) { error = "mca_base_open"; goto return_error; } if (OPAL_SUCCESS != (ret = mca_base_framework_register(&opal_event_base_framework, 0))) { error = "opal_event_register"; goto return_error; } return OPAL_SUCCESS; return_error: opal_show_help( "help-opal-runtime.txt", "opal_init:startup:internal-failure", true, error, ret ); return ret; }
int opal_init_util(void) { int ret; char *error = NULL; if( ++opal_initialized != 1 ) { if( opal_initialized < 1 ) { return OPAL_ERROR; } return OPAL_SUCCESS; } /* initialize the memory allocator */ opal_malloc_init(); /* initialize the output system */ opal_output_init(); /* register handler for errnum -> string converstion */ if (OPAL_SUCCESS != (ret = opal_error_register("OPAL", OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { error = "opal_error_register"; goto return_error; } /* initialize install dirs code */ if (OPAL_SUCCESS != (ret = opal_installdirs_base_open())) { fprintf(stderr, "opal_installdirs_base_open() failed -- process will likely abort (%s:%d, returned %d instead of OPAL_INIT)\n", __FILE__, __LINE__, ret); return ret; } /* init the trace function */ opal_trace_init(); /* keyval lex-based parser */ if (OPAL_SUCCESS != (ret = opal_util_keyval_parse_init())) { error = "opal_util_keyval_parse_init"; goto return_error; } /* Setup the parameter system */ if (OPAL_SUCCESS != (ret = mca_base_param_init())) { error = "mca_base_param_init"; goto return_error; } /* register params for opal */ if (OPAL_SUCCESS != opal_register_params()) { error = "opal_register_params"; goto return_error; } /* pretty-print stack handlers */ if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers ())) { error = "util_register_stackhandlers() failed"; goto return_error; } return OPAL_SUCCESS; return_error: opal_show_help( "help-opal-runtime", "opal_init:startup:internal-failure", true, error, ret ); return ret; }
int opal_init_util(int* pargc, char*** pargv) { int ret; char *error = NULL; char hostname[512]; if( ++opal_util_initialized != 1 ) { if( opal_util_initialized < 1 ) { return OPAL_ERROR; } return OPAL_SUCCESS; } #if OPAL_NO_LIB_DESTRUCTOR if (opal_init_called) { /* can't use show_help here */ fprintf (stderr, "opal_init_util: attempted to initialize after finalize without compiler " "support for either __attribute__(destructor) or linker support for -fini -- process " "will likely abort\n"); return OPAL_ERR_NOT_SUPPORTED; } #endif opal_init_called = true; /* set the nodename right away so anyone who needs it has it. Note * that we don't bother with fqdn and prefix issues here - we let * the RTE later replace this with a modified name if the user * requests it */ gethostname(hostname, 512); opal_process_info.nodename = strdup(hostname); /* initialize the memory allocator */ opal_malloc_init(); /* initialize the output system */ opal_output_init(); /* initialize install dirs code */ if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_installdirs_base_framework, 0))) { fprintf(stderr, "opal_installdirs_base_open() failed -- process will likely abort (%s:%d, returned %d instead of OPAL_SUCCESS)\n", __FILE__, __LINE__, ret); return ret; } /* initialize the help system */ opal_show_help_init(); /* register handler for errnum -> string converstion */ if (OPAL_SUCCESS != (ret = opal_error_register("OPAL", OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { error = "opal_error_register"; goto return_error; } /* keyval lex-based parser */ if (OPAL_SUCCESS != (ret = opal_util_keyval_parse_init())) { error = "opal_util_keyval_parse_init"; goto return_error; } /* Setup the parameter system */ if (OPAL_SUCCESS != (ret = mca_base_var_init())) { error = "mca_base_var_init"; goto return_error; } /* register params for opal */ if (OPAL_SUCCESS != (ret = opal_register_params())) { error = "opal_register_params"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_net_init())) { error = "opal_net_init"; goto return_error; } /* pretty-print stack handlers */ if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers())) { error = "opal_util_register_stackhandlers"; goto return_error; } /* set system resource limits - internally protected against * doing so twice in cases where the launch agent did it for us */ if (OPAL_SUCCESS != (ret = opal_util_init_sys_limits(&error))) { opal_show_help("help-opal-runtime.txt", "opal_init:syslimit", false, error); return OPAL_ERR_SILENT; } /* initialize the arch string */ if (OPAL_SUCCESS != (ret = opal_arch_init ())) { error = "opal_arch_init"; goto return_error; } /* initialize the datatype engine */ if (OPAL_SUCCESS != (ret = opal_datatype_init ())) { error = "opal_datatype_init"; goto return_error; } /* Initialize the data storage service. */ if (OPAL_SUCCESS != (ret = opal_dss_open())) { error = "opal_dss_open"; goto return_error; } /* initialize the mca */ if (OPAL_SUCCESS != (ret = mca_base_open())) { error = "mca_base_open"; goto return_error; } return OPAL_SUCCESS; return_error: if (OPAL_ERR_SILENT != ret) { opal_show_help( "help-opal-runtime.txt", "opal_init:startup:internal-failure", true, error, ret ); } return ret; }
int opal_init_util(int* pargc, char*** pargv) { int ret; char *error = NULL; if( ++opal_util_initialized != 1 ) { if( opal_util_initialized < 1 ) { return OPAL_ERROR; } return OPAL_SUCCESS; } /* initialize the memory allocator */ opal_malloc_init(); /* initialize the output system */ opal_output_init(); /* initialize install dirs code */ if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_installdirs_base_framework, 0))) { fprintf(stderr, "opal_installdirs_base_open() failed -- process will likely abort (%s:%d, returned %d instead of OPAL_SUCCESS)\n", __FILE__, __LINE__, ret); return ret; } /* initialize the help system */ opal_show_help_init(); /* register handler for errnum -> string converstion */ if (OPAL_SUCCESS != (ret = opal_error_register("OPAL", OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { error = "opal_error_register"; goto return_error; } /* keyval lex-based parser */ if (OPAL_SUCCESS != (ret = opal_util_keyval_parse_init())) { error = "opal_util_keyval_parse_init"; goto return_error; } if (OPAL_SUCCESS != (ret = opal_net_init())) { error = "opal_net_init"; goto return_error; } /* Setup the parameter system */ if (OPAL_SUCCESS != (ret = mca_base_var_init())) { error = "mca_base_var_init"; goto return_error; } /* register params for opal */ if (OPAL_SUCCESS != (ret = opal_register_params())) { error = "opal_register_params"; goto return_error; } /* pretty-print stack handlers */ if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers())) { error = "opal_util_register_stackhandlers"; goto return_error; } /* set system resource limits - internally protected against * doing so twice in cases where the launch agent did it for us */ if (OPAL_SUCCESS != (ret = opal_util_init_sys_limits(&error))) { opal_show_help("help-opal-runtime.txt", "opal_init:syslimit", false, error); return OPAL_ERR_SILENT; } /* initialize the arch string */ if (OPAL_SUCCESS != (ret = opal_arch_init ())) { error = "opal_arch_init"; goto return_error; } /* initialize the datatype engine */ if (OPAL_SUCCESS != (ret = opal_datatype_init ())) { error = "opal_datatype_init"; goto return_error; } /* Initialize the data storage service. */ if (OPAL_SUCCESS != (ret = opal_dss_open())) { error = "opal_dss_open"; goto return_error; } return OPAL_SUCCESS; return_error: if (OPAL_ERR_SILENT != ret) { opal_show_help( "help-opal-runtime.txt", "opal_init:startup:internal-failure", true, error, 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 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, *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 orcm_init_util(void) { int ret, i; char *error; char *destdir, *tmp, *mcp, *new_mcp; /* Setup OPAL */ if( ORTE_SUCCESS != (ret = opal_init(NULL, NULL)) ) { error = "opal_init_util"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("OPENRCM", ORCM_ERR_BASE, ORCM_ERR_MAX, orcm_err2str); /* register where the OPENRCM show_help files are located */ if (NULL != (destdir = getenv("ORCM_DESTDIR"))) { asprintf(&tmp, "%s%s", destdir, ORCM_PKGHELPDIR); } else { tmp = strdup(ORCM_PKGHELPDIR); } if (ORTE_SUCCESS != (ret = opal_show_help_add_dir(tmp))) { error = "register show_help_dir"; goto error; } free(tmp); /* Add ORCM's component directory into the mca_base_param_component_path */ i = mca_base_param_find("mca", NULL, "component_path"); if (i < 0) { ret = ORCM_ERR_NOT_FOUND; error = "Could not find mca_component_path"; goto error; } mca_base_param_lookup_string(i, &mcp); if (NULL == mcp) { ret = ORCM_ERR_NOT_FOUND; error = "Could not find mca_component_path"; goto error; } if (NULL != destdir) { asprintf(&new_mcp, "%s%s:%s", destdir, ORCM_PKGLIBDIR, mcp); } else { asprintf(&new_mcp, "%s:%s", ORCM_PKGLIBDIR, mcp); } mca_base_param_set_string(i, new_mcp); free(new_mcp); free(mcp); orcm_util_initialized = true; return ORCM_SUCCESS; error: if (ORCM_ERR_SILENT != ret) { orte_show_help("help-openrcm-runtime.txt", "orcm_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }
int opal_init_util(int* pargc, char*** pargv) { int ret; char *error = NULL; char hostname[OPAL_MAXHOSTNAMELEN]; OPAL_TIMING_ENV_INIT(otmng); if( ++opal_util_initialized != 1 ) { if( opal_util_initialized < 1 ) { return OPAL_ERROR; } return OPAL_SUCCESS; } OBJ_CONSTRUCT(&opal_init_util_domain, opal_finalize_domain_t); (void) opal_finalize_domain_init (&opal_init_util_domain, "opal_init_util"); opal_finalize_set_domain (&opal_init_util_domain); opal_thread_set_main(); opal_init_called = true; /* register for */ opal_finalize_register_cleanup_arg (mca_base_framework_close_list, opal_init_util_frameworks); /* set the nodename right away so anyone who needs it has it. Note * that we don't bother with fqdn and prefix issues here - we let * the RTE later replace this with a modified name if the user * requests it */ gethostname(hostname, sizeof(hostname)); opal_process_info.nodename = strdup(hostname); /* initialize the memory allocator */ opal_malloc_init(); OPAL_TIMING_ENV_NEXT(otmng, "opal_malloc_init"); /* initialize the output system */ opal_output_init(); /* initialize install dirs code */ if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_installdirs_base_framework, 0))) { fprintf(stderr, "opal_installdirs_base_open() failed -- process will likely abort (%s:%d, returned %d instead of OPAL_SUCCESS)\n", __FILE__, __LINE__, ret); return ret; } /* initialize the help system */ opal_show_help_init(); OPAL_TIMING_ENV_NEXT(otmng, "opal_show_help_init"); /* register handler for errnum -> string converstion */ if (OPAL_SUCCESS != (ret = opal_error_register("OPAL", OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { return opal_init_error ("opal_error_register", ret); } /* keyval lex-based parser */ if (OPAL_SUCCESS != (ret = opal_util_keyval_parse_init())) { return opal_init_error ("opal_util_keyval_parse_init", ret); } // Disable PSM signal hijacking (see comment in function for more // details) opal_init_psm(); OPAL_TIMING_ENV_NEXT(otmng, "opal_init_psm"); /* Setup the parameter system */ if (OPAL_SUCCESS != (ret = mca_base_var_init())) { return opal_init_error ("mca_base_var_init", ret); } OPAL_TIMING_ENV_NEXT(otmng, "opal_var_init"); /* read any param files that were provided */ if (OPAL_SUCCESS != (ret = mca_base_var_cache_files(false))) { return opal_init_error ("failed to cache files", ret); } OPAL_TIMING_ENV_NEXT(otmng, "opal_var_cache"); /* register params for opal */ if (OPAL_SUCCESS != (ret = opal_register_params())) { return opal_init_error ("opal_register_params", ret); } if (OPAL_SUCCESS != (ret = opal_net_init())) { return opal_init_error ("opal_net_init", ret); } OPAL_TIMING_ENV_NEXT(otmng, "opal_net_init"); /* pretty-print stack handlers */ if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers())) { return opal_init_error ("opal_util_register_stackhandlers", ret); } /* set system resource limits - internally protected against * doing so twice in cases where the launch agent did it for us */ if (OPAL_SUCCESS != (ret = opal_util_init_sys_limits(&error))) { opal_show_help("help-opal-runtime.txt", "opal_init:syslimit", false, error); return OPAL_ERR_SILENT; } /* initialize the arch string */ if (OPAL_SUCCESS != (ret = opal_arch_init ())) { return opal_init_error ("opal_arch_init", ret); } OPAL_TIMING_ENV_NEXT(otmng, "opal_arch_init"); /* initialize the datatype engine */ if (OPAL_SUCCESS != (ret = opal_datatype_init ())) { return opal_init_error ("opal_datatype_init", ret); } OPAL_TIMING_ENV_NEXT(otmng, "opal_datatype_init"); /* Initialize the data storage service. */ if (OPAL_SUCCESS != (ret = opal_dss_open())) { return opal_init_error ("opal_dss_open", ret); } OPAL_TIMING_ENV_NEXT(otmng, "opal_dss_open"); /* initialize the mca */ if (OPAL_SUCCESS != (ret = mca_base_open())) { return opal_init_error ("mca_base_open", ret); } OPAL_TIMING_ENV_NEXT(otmng, "mca_base_open"); /* initialize if framework */ if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_if_base_framework, 0))) { fprintf(stderr, "opal_if_base_open() failed -- process will likely abort (%s:%d, returned %d instead of OPAL_SUCCESS)\n", __FILE__, __LINE__, ret); return ret; } OPAL_TIMING_ENV_NEXT(otmng, "opal_if_init"); return OPAL_SUCCESS; }
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; }