diff --git a/opal/mca/sysinfo/base/base.h b/opal/mca/sysinfo/base/base.h index 8cda9fec3f..06b88d8e44 100644 --- a/opal/mca/sysinfo/base/base.h +++ b/opal/mca/sysinfo/base/base.h @@ -64,6 +64,7 @@ OPAL_DECLSPEC int opal_sysinfo_base_select(void); OPAL_DECLSPEC extern int opal_sysinfo_base_output; OPAL_DECLSPEC extern opal_list_t opal_sysinfo_base_components_opened; OPAL_DECLSPEC extern opal_list_t opal_sysinfo_avail_modules; +OPAL_DECLSPEC extern bool opal_sysinfo_initialized; END_C_DECLS diff --git a/opal/mca/sysinfo/base/sysinfo_base_open.c b/opal/mca/sysinfo/base/sysinfo_base_open.c index 82c4884a7c..0b9c0794a9 100644 --- a/opal/mca/sysinfo/base/sysinfo_base_open.c +++ b/opal/mca/sysinfo/base/sysinfo_base_open.c @@ -36,6 +36,7 @@ static int opal_sysinfo_base_query(char **keys, opal_list_t *values); int opal_sysinfo_base_output = -1; opal_list_t opal_sysinfo_base_components_opened; opal_list_t opal_sysinfo_avail_modules; +bool opal_sysinfo_initialized=false; opal_sysinfo_API_module_t opal_sysinfo = { opal_sysinfo_base_query @@ -48,6 +49,11 @@ opal_sysinfo_API_module_t opal_sysinfo = { */ int opal_sysinfo_base_open(void) { + if (opal_sysinfo_initialized) { + return OPAL_SUCCESS; + } + opal_sysinfo_initialized = true; + opal_sysinfo_base_output = opal_output_open(NULL); /* init the list of available modules */ diff --git a/opal/mca/sysinfo/base/sysinfo_base_select.c b/opal/mca/sysinfo/base/sysinfo_base_select.c index d1077a375b..478e090988 100644 --- a/opal/mca/sysinfo/base/sysinfo_base_select.c +++ b/opal/mca/sysinfo/base/sysinfo_base_select.c @@ -33,6 +33,10 @@ int opal_sysinfo_base_select(void) mca_base_component_t *component; opal_list_item_t *item; + if (opal_sysinfo_initialized) { + return OPAL_SUCCESS; + } + /* * Select all available components */ diff --git a/orte/mca/ess/cm/ess_cm_module.c b/orte/mca/ess/cm/ess_cm_module.c index 6eb5eda7e3..1f07ff3e92 100644 --- a/orte/mca/ess/cm/ess_cm_module.c +++ b/orte/mca/ess/cm/ess_cm_module.c @@ -29,6 +29,7 @@ #include "opal/mca/paffinity/paffinity.h" #if ORTE_ENABLE_BOOTSTRAP #include "opal/mca/sysinfo/sysinfo.h" +#include "opal/mca/sysinfo/base/base.h" #endif #include "orte/mca/rmcast/base/base.h" @@ -108,12 +109,33 @@ static int rte_init(void) error = "orte_rmcast_base_select"; goto error; } - + +#if ORTE_ENABLE_BOOTSTRAP + /* open and setup the local resource discovery framework */ + if (ORTE_SUCCESS != (ret = opal_sysinfo_base_open())) { + ORTE_ERROR_LOG(ret); + error = "opal_sysinfo_base_open"; + goto error; + } + if (ORTE_SUCCESS != (ret = opal_sysinfo_base_select())) { + ORTE_ERROR_LOG(ret); + error = "opal_sysinfo_base_select"; + goto error; + } +#endif + /* get a name for ourselves */ if (ORTE_SUCCESS != (ret = cm_set_name())) { error = "set_name"; goto error; } + } else { + /* if we were given an HNP, then we must have also + * been given a vpid - we can get the jobid from + * the HNP's name + */ + ORTE_PROC_MY_NAME->jobid = orte_process_info.my_hnp.jobid; + } /* get the list of nodes used for this job */ @@ -500,7 +522,7 @@ static int cm_set_name(void) /* add them to the buffer */ while (NULL != (item = opal_list_remove_first(&resources))) { info = (opal_sysinfo_value_t*)item; - opal_dss.pack(&buf, &info, 1, OPAL_STRING); + opal_dss.pack(&buf, &info->key, 1, OPAL_STRING); opal_dss.pack(&buf, &info->type, 1, OPAL_DATA_TYPE_T); if (OPAL_INT64 == info->type) { opal_dss.pack(&buf, &(info->data.i64), 1, OPAL_INT64);