1
1

Provide a mechanism by which a tool can request async progress thread support for ORTE

Этот коммит содержится в:
Ralph Castain 2015-12-04 08:26:57 -08:00
родитель ad35a363fa
Коммит 8823069fe9
4 изменённых файлов: 66 добавлений и 24 удалений

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

@ -37,7 +37,6 @@
#include "opal/mca/event/event.h" #include "opal/mca/event/event.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
#include "opal/runtime/opal_cr.h" #include "opal/runtime/opal_cr.h"
#include "opal/runtime/opal_progress_threads.h"
#include "opal/util/arch.h" #include "opal/util/arch.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
@ -64,7 +63,6 @@
#include "orte/mca/ess/base/base.h" #include "orte/mca/ess/base/base.h"
static bool progress_thread_running = false;
int orte_ess_base_tool_setup(void) int orte_ess_base_tool_setup(void)
{ {
@ -275,10 +273,5 @@ int orte_ess_base_tool_finalize(void)
(void) mca_base_framework_close(&orte_schizo_base_framework); (void) mca_base_framework_close(&orte_schizo_base_framework);
(void) mca_base_framework_close(&orte_errmgr_base_framework); (void) mca_base_framework_close(&orte_errmgr_base_framework);
/* release the event base */
if (progress_thread_running) {
opal_progress_thread_finalize("orte");
progress_thread_running = false;
}
return ORTE_SUCCESS; return ORTE_SUCCESS;
} }

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

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -28,8 +29,12 @@ int orte_ess_tool_component_open(void);
int orte_ess_tool_component_close(void); int orte_ess_tool_component_close(void);
int orte_ess_tool_component_query(mca_base_module_t **module, int *priority); int orte_ess_tool_component_query(mca_base_module_t **module, int *priority);
typedef struct {
orte_ess_base_component_t super;
bool async;
} orte_ess_tool_component_t;
ORTE_MODULE_DECLSPEC extern orte_ess_base_component_t mca_ess_tool_component; ORTE_MODULE_DECLSPEC extern orte_ess_tool_component_t mca_ess_tool_component;
END_C_DECLS END_C_DECLS

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

@ -12,6 +12,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -35,30 +36,48 @@
extern orte_ess_base_module_t orte_ess_tool_module; extern orte_ess_base_module_t orte_ess_tool_module;
static int tool_component_register(void);
/* /*
* Instantiate the public struct with all of our public information * Instantiate the public struct with all of our public information
* and pointers to our public functions in it * and pointers to our public functions in it
*/ */
orte_ess_base_component_t mca_ess_tool_component = { orte_ess_tool_component_t mca_ess_tool_component = {
.base_version = { {
ORTE_ESS_BASE_VERSION_3_0_0, .base_version = {
ORTE_ESS_BASE_VERSION_3_0_0,
/* Component name and version */ /* Component name and version */
.mca_component_name = "tool", .mca_component_name = "tool",
MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION), ORTE_RELEASE_VERSION),
/* Component open and close functions */ /* Component open and close functions */
.mca_open_component = orte_ess_tool_component_open, .mca_open_component = orte_ess_tool_component_open,
.mca_close_component = orte_ess_tool_component_close, .mca_close_component = orte_ess_tool_component_close,
.mca_query_component = orte_ess_tool_component_query, .mca_query_component = orte_ess_tool_component_query,
}, .mca_register_component_params = tool_component_register,
.base_data = { },
/* The component is checkpoint ready */ .base_data = {
MCA_BASE_METADATA_PARAM_CHECKPOINT /* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
}, },
.async = false
}; };
static int tool_component_register(void)
{
mca_base_component_t *c = &mca_ess_tool_component.super.base_version;
mca_ess_tool_component.async = false;
(void) mca_base_component_var_register (c, "async_progress", "Setup an async progress thread",
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
OPAL_INFO_LVL_2,
MCA_BASE_VAR_SCOPE_READONLY,
&mca_ess_tool_component.async);
return ORTE_SUCCESS;
}
int int
orte_ess_tool_component_open(void) orte_ess_tool_component_open(void)

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

@ -31,6 +31,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "opal/runtime/opal_progress_threads.h"
#include "orte/util/show_help.h" #include "orte/util/show_help.h"
#include "orte/mca/plm/base/base.h" #include "orte/mca/plm/base/base.h"
#include "orte/mca/plm/base/plm_private.h" #include "orte/mca/plm/base/plm_private.h"
@ -45,15 +47,17 @@
static int rte_init(void); static int rte_init(void);
static void rte_abort(int status, bool report) __opal_attribute_noreturn__; static void rte_abort(int status, bool report) __opal_attribute_noreturn__;
static int rte_finalize(void);
orte_ess_base_module_t orte_ess_tool_module = { orte_ess_base_module_t orte_ess_tool_module = {
rte_init, rte_init,
orte_ess_base_tool_finalize, rte_finalize,
rte_abort, rte_abort,
NULL /* ft_event */ NULL /* ft_event */
}; };
static bool progress_thread_running = false;
static int rte_init(void) static int rte_init(void)
{ {
@ -103,6 +107,14 @@ static int rte_init(void)
ORTE_PROC_MY_NAME->vpid = 0; ORTE_PROC_MY_NAME->vpid = 0;
} }
/* if requested, get an async event base - we use the
* opal_async one so we don't startup extra threads if
* not needed */
if (mca_ess_tool_component.async) {
orte_event_base = opal_progress_thread_init(NULL);
progress_thread_running = true;
}
/* do the rest of the standard tool init */ /* do the rest of the standard tool init */
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) { if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
@ -122,6 +134,19 @@ static int rte_init(void)
return ret; return ret;
} }
static int rte_finalize(void)
{
/* use the std finalize routing */
orte_ess_base_tool_finalize();
/* release the event base */
if (progress_thread_running) {
opal_progress_thread_finalize(NULL);
progress_thread_running = false;
}
return ORTE_SUCCESS;
}
/* /*
* If we are a tool-without-name, then we look just like the HNP. * If we are a tool-without-name, then we look just like the HNP.
* In that scenario, it could be beneficial to get a core file, so * In that scenario, it could be beneficial to get a core file, so