Fix singletons - still working on singleton comm_spawn
Этот коммит содержится в:
родитель
f99e56d17b
Коммит
6294ed991b
@ -24,6 +24,7 @@
|
||||
#include "opal/mca/pmix/base/base.h"
|
||||
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
||||
#include "orte/mca/ess/ess.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)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* all APPS must use pmix */
|
||||
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;
|
||||
*module = (mca_base_module_t *)&orte_ess_pmi_module;
|
||||
return ORTE_SUCCESS;
|
||||
|
@ -106,18 +106,6 @@ static int rte_init(void)
|
||||
}
|
||||
#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 */
|
||||
|
||||
/**** THE FOLLOWING ARE REQUIRED VALUES ***/
|
||||
|
@ -25,7 +25,11 @@
|
||||
#include "orte_config.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/mca/errmgr/errmgr.h"
|
||||
|
||||
#include "orte/mca/ess/ess.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 ret;
|
||||
|
||||
/* if we are an HNP, daemon, or tool, then we
|
||||
* 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;
|
||||
}
|
||||
|
||||
/* 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,
|
||||
* but launched in "standalone" mode - i.e., directly
|
||||
* launched by an environment instead of via mpirun.
|
||||
|
@ -262,6 +262,12 @@ static int rte_finalize(void)
|
||||
{
|
||||
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 */
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user