1
1

Fix singletons - still working on singleton comm_spawn

Этот коммит содержится в:
Ralph Castain 2014-12-02 14:12:24 -08:00
родитель f99e56d17b
Коммит 6294ed991b
4 изменённых файлов: 64 добавлений и 12 удалений

Просмотреть файл

@ -24,6 +24,7 @@
#include "opal/mca/pmix/base/base.h" #include "opal/mca/pmix/base/base.h"
#include "orte/util/proc_info.h" #include "orte/util/proc_info.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ess/ess.h" #include "orte/mca/ess/ess.h"
#include "orte/mca/ess/pmi/ess_pmi.h" #include "orte/mca/ess/pmi/ess_pmi.h"
@ -66,8 +67,35 @@ static int pmi_component_open(void)
static int pmi_component_query(mca_base_module_t **module, int *priority) static int pmi_component_query(mca_base_module_t **module, int *priority)
{ {
int ret;
/* all APPS must use pmix */ /* all APPS must use pmix */
if (ORTE_PROC_IS_APP) { if (ORTE_PROC_IS_APP) {
/* open and setup pmix */
if (NULL == opal_pmix.initialized) {
if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_pmix_base_framework, 0))) {
ORTE_ERROR_LOG(ret);
*priority = -1;
*module = NULL;
return ret;
}
if (OPAL_SUCCESS != (ret = opal_pmix_base_select())) {
ORTE_ERROR_LOG(ret);
*priority = -1;
*module = NULL;
(void) mca_base_framework_close(&opal_pmix_base_framework);
return ret;
}
}
if (!opal_pmix.initialized()) {
/* we may have everything setup, but we are not
* in a PMI environment and so we need to disqualify
* ourselves - we are likely a singleton and will
* pick things up from there */
*priority = -1;
*module = NULL;
return ORTE_ERROR;
}
*priority = 35; *priority = 35;
*module = (mca_base_module_t *)&orte_ess_pmi_module; *module = (mca_base_module_t *)&orte_ess_pmi_module;
return ORTE_SUCCESS; return ORTE_SUCCESS;

Просмотреть файл

@ -106,18 +106,6 @@ static int rte_init(void)
} }
#endif #endif
/* open and setup pmix */
if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_pmix_base_framework, 0))) {
ORTE_ERROR_LOG(ret);
error = "opal_pmix_base_open";
goto error;
}
if (OPAL_SUCCESS != (ret = opal_pmix_base_select())) {
ORTE_ERROR_LOG(ret);
error = "opal_pmix_base_select";
goto error;
}
/* we don't have to call pmix.init because the pmix select did it */ /* we don't have to call pmix.init because the pmix select did it */
/**** THE FOLLOWING ARE REQUIRED VALUES ***/ /**** THE FOLLOWING ARE REQUIRED VALUES ***/

Просмотреть файл

@ -25,7 +25,11 @@
#include "orte_config.h" #include "orte_config.h"
#include "orte/constants.h" #include "orte/constants.h"
#include "opal/mca/pmix/pmix.h"
#include "opal/mca/pmix/base/base.h"
#include "orte/util/proc_info.h" #include "orte/util/proc_info.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ess/ess.h" #include "orte/mca/ess/ess.h"
#include "orte/mca/ess/singleton/ess_singleton.h" #include "orte/mca/ess/singleton/ess_singleton.h"
@ -91,6 +95,8 @@ orte_ess_singleton_component_open(void)
int orte_ess_singleton_component_query(mca_base_module_t **module, int *priority) int orte_ess_singleton_component_query(mca_base_module_t **module, int *priority)
{ {
int ret;
/* if we are an HNP, daemon, or tool, then we /* if we are an HNP, daemon, or tool, then we
* are definitely not a singleton! * are definitely not a singleton!
*/ */
@ -111,6 +117,30 @@ int orte_ess_singleton_component_query(mca_base_module_t **module, int *priority
return ORTE_ERROR; return ORTE_ERROR;
} }
/* open and setup pmix */
if (NULL == opal_pmix.initialized) {
if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_pmix_base_framework, 0))) {
ORTE_ERROR_LOG(ret);
*priority = -1;
*module = NULL;
return ret;
}
if (OPAL_SUCCESS != (ret = opal_pmix_base_select())) {
ORTE_ERROR_LOG(ret);
*priority = -1;
*module = NULL;
(void) mca_base_framework_close(&opal_pmix_base_framework);
return ret;
}
}
if (opal_pmix.initialized()) {
/* we are in a PMI environment and are therefore
* not a singleton */
*priority = -1;
*module = NULL;
return ORTE_ERROR;
}
/* okay, we could still be an application process, /* okay, we could still be an application process,
* but launched in "standalone" mode - i.e., directly * but launched in "standalone" mode - i.e., directly
* launched by an environment instead of via mpirun. * launched by an environment instead of via mpirun.

Просмотреть файл

@ -262,6 +262,12 @@ static int rte_finalize(void)
{ {
int ret; int ret;
/* mark us as finalized */
if (NULL != opal_pmix.finalize) {
opal_pmix.finalize();
(void) mca_base_framework_close(&opal_pmix_base_framework);
}
/* use the default procedure to finish */ /* use the default procedure to finish */
if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);