2007-07-21 01:36:11 +04:00
|
|
|
/*
|
2007-07-26 02:28:04 +04:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
|
2007-07-21 01:36:11 +04:00
|
|
|
* All rights reserved.
|
2010-09-18 03:04:06 +04:00
|
|
|
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
2007-07-21 01:36:11 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
2007-07-26 02:28:04 +04:00
|
|
|
|
2007-07-21 01:36:11 +04:00
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_component_repository.h"
|
2007-08-16 09:52:30 +04:00
|
|
|
#include "ompi/constants.h"
|
2007-07-21 01:36:11 +04:00
|
|
|
#include "ompi/mca/pml/base/base.h"
|
2010-09-18 03:04:06 +04:00
|
|
|
#include "ompi/mca/vprotocol/vprotocol.h"
|
|
|
|
#include "ompi/mca/vprotocol/base/base.h"
|
2008-06-10 00:38:44 +04:00
|
|
|
#include "pml_v_output.h"
|
2007-07-21 01:36:11 +04:00
|
|
|
#include "pml_v.h"
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
static int mca_pml_v_component_register(void);
|
2007-07-21 01:36:11 +04:00
|
|
|
static int mca_pml_v_component_open(void);
|
|
|
|
static int mca_pml_v_component_close(void);
|
|
|
|
static int mca_pml_v_component_parasite_close(void);
|
|
|
|
|
2011-03-19 00:36:35 +03:00
|
|
|
static mca_pml_base_module_t *mca_pml_v_component_init(int* priority, bool enable_progress_threads, bool enable_mpi_thread_multiple);
|
2007-07-21 01:36:11 +04:00
|
|
|
static int mca_pml_v_component_finalize(void);
|
|
|
|
static int mca_pml_v_component_parasite_finalize(void);
|
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
static int mca_pml_v_enable(bool enable);
|
|
|
|
|
2008-07-29 02:40:57 +04:00
|
|
|
mca_pml_base_component_2_0_0_t mca_pml_v_component =
|
2007-07-21 01:36:11 +04:00
|
|
|
{
|
|
|
|
/* First, the mca_base_component_t struct containing meta
|
|
|
|
* information about the component itself */
|
|
|
|
{
|
2008-07-29 02:40:57 +04:00
|
|
|
MCA_PML_BASE_VERSION_2_0_0,
|
2007-07-21 01:36:11 +04:00
|
|
|
"v", /* MCA component name */
|
2008-07-23 01:10:51 +04:00
|
|
|
OMPI_MAJOR_VERSION, /* MCA component major version */
|
|
|
|
OMPI_MINOR_VERSION, /* MCA component minor version */
|
|
|
|
OMPI_RELEASE_VERSION, /* MCA component release version */
|
2007-07-21 01:36:11 +04:00
|
|
|
mca_pml_v_component_open,
|
2013-03-28 01:09:41 +04:00
|
|
|
mca_pml_v_component_close,
|
|
|
|
NULL,
|
|
|
|
mca_pml_v_component_register
|
2007-07-21 01:36:11 +04:00
|
|
|
},
|
|
|
|
{
|
2008-07-29 02:40:57 +04:00
|
|
|
MCA_BASE_METADATA_PARAM_NONE /* Component is not checkpointable */
|
2007-07-21 01:36:11 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
mca_pml_v_component_init, /* component init */
|
|
|
|
mca_pml_v_component_finalize /* component finalize */
|
|
|
|
};
|
|
|
|
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
static bool pml_v_enable_progress_treads = OMPI_ENABLE_PROGRESS_THREADS;
|
2011-03-19 00:36:35 +03:00
|
|
|
static bool pml_v_enable_mpi_thread_multiple = OMPI_ENABLE_THREAD_MULTIPLE;
|
2007-08-16 09:52:30 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
static char *ompi_pml_vprotocol_include_list;
|
|
|
|
static char *ompi_pml_v_output;
|
|
|
|
static int ompi_pml_v_verbose;
|
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
* MCA level functions - parasite setup
|
2007-07-28 03:11:00 +04:00
|
|
|
*/
|
2013-03-28 01:09:41 +04:00
|
|
|
static int mca_pml_v_component_register(void)
|
|
|
|
{
|
|
|
|
int var_id;
|
|
|
|
|
|
|
|
ompi_pml_v_output = "stderr";
|
|
|
|
(void) mca_base_component_var_register(&mca_pml_v_component.pmlm_version,
|
|
|
|
"output", NULL, MCA_BASE_VAR_TYPE_STRING,
|
|
|
|
NULL, 0, 0, OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&ompi_pml_v_output);
|
|
|
|
|
|
|
|
ompi_pml_v_verbose = 0;
|
|
|
|
(void) mca_base_component_var_register(&mca_pml_v_component.pmlm_version,
|
|
|
|
"verbose", "Verbosity of the pml v component",
|
|
|
|
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
|
2013-03-28 01:17:31 +04:00
|
|
|
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
|
2013-03-28 01:09:41 +04:00
|
|
|
&ompi_pml_v_verbose);
|
|
|
|
|
|
|
|
ompi_pml_vprotocol_include_list = "";
|
|
|
|
/* This parameter needs to go away if pml/v is unloaded so register it with a pml/v name */
|
|
|
|
var_id = mca_base_component_var_register(&mca_pml_v_component.pmlm_version,
|
|
|
|
"vprotocol", "Specify a specific vprotocol to use",
|
|
|
|
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
2013-03-28 01:17:31 +04:00
|
|
|
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
|
2013-03-28 01:09:41 +04:00
|
|
|
&ompi_pml_vprotocol_include_list);
|
|
|
|
(void) mca_base_var_register_synonym(var_id, "ompi", "vprotocol", NULL, NULL, 0);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-07-21 01:36:11 +04:00
|
|
|
static int mca_pml_v_component_open(void)
|
|
|
|
{
|
2013-03-28 01:09:41 +04:00
|
|
|
pml_v_output_open(ompi_pml_v_output, ompi_pml_v_verbose);
|
2007-08-16 09:52:30 +04:00
|
|
|
|
2007-07-31 23:33:39 +04:00
|
|
|
V_OUTPUT_VERBOSE(500, "loaded");
|
2007-09-13 00:47:17 +04:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
mca_vprotocol_base_set_include_list(ompi_pml_vprotocol_include_list);
|
2012-11-06 22:57:46 +04:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
return mca_base_framework_open(&ompi_vprotocol_base_framework, 0);
|
2007-07-28 03:11:00 +04:00
|
|
|
}
|
|
|
|
|
2007-07-21 01:36:11 +04:00
|
|
|
static int mca_pml_v_component_close(void)
|
2007-08-16 09:52:30 +04:00
|
|
|
{
|
|
|
|
/* Save original PML before making any changes */
|
2007-07-21 01:36:11 +04:00
|
|
|
mca_pml_v.host_pml_component = mca_pml_base_selected_component;
|
2007-08-16 09:52:30 +04:00
|
|
|
mca_pml_v.host_pml = mca_pml;
|
2007-12-07 11:21:25 +03:00
|
|
|
mca_pml_v.host_request_fns = ompi_request_functions;
|
2007-09-13 00:47:17 +04:00
|
|
|
|
|
|
|
/* Do not load anything if no FT protocol is selected */
|
2010-10-24 23:24:44 +04:00
|
|
|
if (NULL != mca_vprotocol_base_include_list && !mca_vprotocol_base_include_list[0]) {
|
2007-09-13 00:47:17 +04:00
|
|
|
return mca_pml_v_component_parasite_close();
|
2007-07-21 01:36:11 +04:00
|
|
|
}
|
2012-11-06 23:09:26 +04:00
|
|
|
|
|
|
|
/* Make sure to close out output even if vprotocol isn't in use */
|
|
|
|
pml_v_output_close ();
|
2010-09-18 03:04:06 +04:00
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
/* Mark that we have changed something */
|
|
|
|
snprintf(mca_pml_base_selected_component.pmlm_version.mca_component_name,
|
|
|
|
MCA_BASE_MAX_TYPE_NAME_LEN, "%s]v%s",
|
|
|
|
mca_pml_v.host_pml_component.pmlm_version.mca_component_name,
|
|
|
|
mca_vprotocol_component.pmlm_version.mca_component_name);
|
|
|
|
|
|
|
|
/* Replace finalize */
|
|
|
|
mca_pml_base_selected_component.pmlm_finalize =
|
|
|
|
mca_pml_v_component_parasite_finalize;
|
|
|
|
|
|
|
|
/* Make sure we get initialized if some Vprotocol is enabled */
|
|
|
|
mca_pml.pml_enable = mca_pml_v_enable;
|
|
|
|
|
2007-07-21 01:36:11 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
* Parasite cleanup
|
|
|
|
*/
|
|
|
|
static int mca_pml_v_component_parasite_finalize(void)
|
|
|
|
{
|
|
|
|
mca_base_component_list_item_t *cli = NULL;
|
|
|
|
|
|
|
|
V_OUTPUT_VERBOSE(500, "parasite_finalize");
|
|
|
|
|
|
|
|
/* Make sure we'll get closed again with the true close function */
|
|
|
|
mca_pml_v_component.pmlm_version.mca_close_component =
|
|
|
|
mca_pml_v_component_parasite_close;
|
|
|
|
cli = OBJ_NEW(mca_base_component_list_item_t);
|
|
|
|
cli->cli_component = (mca_base_component_t *) &mca_pml_v_component;
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_list_prepend(&ompi_pml_base_framework.framework_components,
|
2007-08-16 09:52:30 +04:00
|
|
|
(opal_list_item_t *) cli);
|
|
|
|
|
|
|
|
/* finalize vprotocol component */
|
|
|
|
if(mca_vprotocol_base_selected())
|
|
|
|
mca_vprotocol_component.pmlm_finalize();
|
|
|
|
|
|
|
|
if(mca_pml_v.host_pml_component.pmlm_finalize != NULL)
|
|
|
|
return mca_pml_v.host_pml_component.pmlm_finalize();
|
|
|
|
else
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-07-21 01:36:11 +04:00
|
|
|
static int mca_pml_v_component_parasite_close(void)
|
|
|
|
{
|
2007-09-13 00:47:17 +04:00
|
|
|
V_OUTPUT_VERBOSE(500, "parasite_close: Ok, I accept to die and let %s component finish",
|
2007-07-30 23:11:15 +04:00
|
|
|
mca_pml_v.host_pml_component.pmlm_version.mca_component_name);
|
|
|
|
mca_pml_base_selected_component = mca_pml_v.host_pml_component;
|
2007-07-21 01:36:11 +04:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
(void) mca_base_framework_close(&ompi_vprotocol_base_framework);
|
2007-08-16 09:52:30 +04:00
|
|
|
pml_v_output_close();
|
2007-07-21 01:36:11 +04:00
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
mca_pml.pml_enable = mca_pml_v.host_pml.pml_enable;
|
|
|
|
/* don't need to call the host component's close: pml_base will do it */
|
|
|
|
return OMPI_SUCCESS; /* ignore any errors as we are leaving anyway */
|
2007-07-21 01:36:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
* Init/finalize for MCA PML components
|
|
|
|
*/
|
2007-07-21 01:36:11 +04:00
|
|
|
static mca_pml_base_module_t *mca_pml_v_component_init(int *priority,
|
|
|
|
bool enable_progress_threads,
|
2011-03-19 00:36:35 +03:00
|
|
|
bool enable_mpi_thread_multiple)
|
2007-07-21 01:36:11 +04:00
|
|
|
{
|
2007-08-16 09:52:30 +04:00
|
|
|
V_OUTPUT_VERBOSE(1, "init: I'm not supposed to be here until BTL loading stuff gets fixed!? That's strange...");
|
|
|
|
|
|
|
|
pml_v_enable_progress_treads = enable_progress_threads;
|
2011-03-19 00:36:35 +03:00
|
|
|
pml_v_enable_mpi_thread_multiple = enable_mpi_thread_multiple;
|
2007-08-16 09:52:30 +04:00
|
|
|
|
|
|
|
/* I NEVER want to be the selected PML, so I report less than possible
|
|
|
|
* priority and a NULL module
|
|
|
|
*/
|
|
|
|
*priority = -1;
|
|
|
|
return NULL;
|
2007-07-21 01:36:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int mca_pml_v_component_finalize(void)
|
|
|
|
{
|
2007-08-16 09:52:30 +04:00
|
|
|
V_OUTPUT_VERBOSE(1, "finalize: I'm not supposed to be here until BTL loading stuff gets fixed!? That's strange...");
|
|
|
|
/* Nothing to do here. We are not sure we need to be unloaded or not at
|
|
|
|
* this stage
|
|
|
|
*/
|
|
|
|
return OMPI_SUCCESS;
|
2007-07-21 01:36:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-16 09:52:30 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
* Enable the PML V (and initialize the Vprotocol)
|
|
|
|
*/
|
|
|
|
static int mca_pml_v_enable(bool enable)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Enable the real PML (no threading issues there as threads are started
|
2007-09-21 01:57:21 +04:00
|
|
|
* later)
|
2007-08-16 09:52:30 +04:00
|
|
|
*/
|
|
|
|
ret = mca_pml_v.host_pml.pml_enable(enable);
|
|
|
|
if(OMPI_SUCCESS != ret) return ret;
|
|
|
|
|
|
|
|
if(enable) {
|
2007-09-21 01:57:21 +04:00
|
|
|
/* Check if a protocol have been selected during init */
|
|
|
|
if(! mca_vprotocol_base_selected())
|
|
|
|
mca_vprotocol_base_select(pml_v_enable_progress_treads,
|
2011-03-19 00:36:35 +03:00
|
|
|
pml_v_enable_mpi_thread_multiple);
|
2007-08-16 09:52:30 +04:00
|
|
|
|
2007-09-21 01:57:21 +04:00
|
|
|
/* Check if we succeeded selecting a protocol */
|
2007-08-16 09:52:30 +04:00
|
|
|
if(mca_vprotocol_base_selected()) {
|
|
|
|
V_OUTPUT_VERBOSE(1, "I don't want to die: I will parasite %s host component %s with %s %s",
|
|
|
|
mca_pml_base_selected_component.pmlm_version.mca_type_name,
|
|
|
|
mca_pml_base_selected_component.pmlm_version.mca_component_name,
|
|
|
|
mca_vprotocol_component.pmlm_version.mca_type_name,
|
|
|
|
mca_vprotocol_component.pmlm_version.mca_component_name);
|
|
|
|
|
|
|
|
ret = mca_vprotocol_base_parasite();
|
|
|
|
if(OMPI_SUCCESS != ret) return ret;
|
|
|
|
if(mca_vprotocol.enable)
|
|
|
|
return mca_vprotocol.enable(enable);
|
|
|
|
else
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
V_OUTPUT_VERBOSE(1, "No fault tolerant protocol selected. All are unloaded");
|
|
|
|
}
|
|
|
|
/* Disable */
|
|
|
|
mca_pml = mca_pml_v.host_pml;
|
|
|
|
mca_pml.pml_enable = mca_pml_v_enable;
|
2007-12-07 11:21:25 +03:00
|
|
|
/* /!\ This is incorrect if another component also changed the requests */
|
|
|
|
ompi_request_functions = mca_pml_v.host_request_fns;
|
2007-07-21 01:36:11 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|