2007-12-21 09:02:00 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2004-01-30 06:54:52 +03:00
|
|
|
/*
|
2007-02-21 19:18:43 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-12-21 09:02:00 +03:00
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-30 06:54:52 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-30 06:54:52 +03:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2005-09-13 00:22:59 +04:00
|
|
|
#include "opal/runtime/opal_progress.h"
|
2005-09-14 13:37:20 +04:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
2008-12-10 02:49:02 +03:00
|
|
|
#include "opal/runtime/opal.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
2005-09-14 13:37:20 +04:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/pml/base/base.h"
|
2007-02-09 19:38:16 +03:00
|
|
|
#include "ompi/proc/proc.h"
|
2007-07-09 21:16:34 +04:00
|
|
|
#include "ompi/runtime/ompi_module_exchange.h"
|
2004-01-30 06:54:52 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef struct opened_component_t {
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t super;
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_pml_base_component_t *om_component;
|
|
|
|
} opened_component_t;
|
2004-01-30 06:54:52 +03:00
|
|
|
|
2008-06-26 17:22:48 +04:00
|
|
|
static bool modex_reqd=false;
|
|
|
|
|
2004-01-30 06:54:52 +03:00
|
|
|
/**
|
2004-08-02 04:24:22 +04:00
|
|
|
* Function for selecting one component from all those that are
|
2004-01-30 06:54:52 +03:00
|
|
|
* available.
|
|
|
|
*
|
2004-08-02 04:24:22 +04:00
|
|
|
* Call the init function on all available components and get their
|
|
|
|
* priorities. Select the component with the highest priority. All
|
|
|
|
* other components will be closed and unloaded. The selected component
|
2004-01-31 02:00:48 +03:00
|
|
|
* will have all of its function pointers saved and returned to the
|
|
|
|
* caller.
|
2004-01-30 06:54:52 +03:00
|
|
|
*/
|
2005-03-27 17:05:23 +04:00
|
|
|
int mca_pml_base_select(bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads)
|
2004-01-30 06:54:52 +03:00
|
|
|
{
|
2008-06-26 17:22:48 +04:00
|
|
|
int i, priority = 0, best_priority = 0, num_pml = 0;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item = NULL;
|
2005-06-20 20:40:12 +04:00
|
|
|
mca_base_component_list_item_t *cli = NULL;
|
|
|
|
mca_pml_base_component_t *component = NULL, *best_component = NULL;
|
|
|
|
mca_pml_base_module_t *module = NULL, *best_module = NULL;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t opened;
|
2005-06-20 20:40:12 +04:00
|
|
|
opened_component_t *om = NULL;
|
2007-02-03 05:32:00 +03:00
|
|
|
bool found_pml;
|
2007-04-24 21:08:48 +04:00
|
|
|
#if OPAL_ENABLE_FT == 1
|
|
|
|
mca_pml_base_component_t *wrapper_component = NULL;
|
|
|
|
mca_pml_base_module_t *wrapper_module = NULL;
|
|
|
|
int wrapper_priority = -1;
|
|
|
|
#endif
|
2007-02-21 19:18:43 +03:00
|
|
|
|
2005-06-20 20:40:12 +04:00
|
|
|
/* Traverse the list of available components; call their init
|
|
|
|
functions. */
|
|
|
|
|
|
|
|
best_priority = -1;
|
|
|
|
best_component = NULL;
|
|
|
|
module = NULL;
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&opened, opal_list_t);
|
|
|
|
for (item = opal_list_get_first(&mca_pml_base_components_available);
|
|
|
|
opal_list_get_end(&mca_pml_base_components_available) != item;
|
2005-07-12 09:40:56 +04:00
|
|
|
item = opal_list_get_next(item) ) {
|
2005-06-20 20:40:12 +04:00
|
|
|
cli = (mca_base_component_list_item_t *) item;
|
|
|
|
component = (mca_pml_base_component_t *) cli->cli_component;
|
2007-02-21 19:18:43 +03:00
|
|
|
|
2005-06-20 20:40:12 +04:00
|
|
|
/* if there is an include list - item must be in the list to be included */
|
2007-02-03 05:32:00 +03:00
|
|
|
found_pml = false;
|
2007-12-21 09:02:00 +03:00
|
|
|
for( i = 0; i < opal_pointer_array_get_size(&mca_pml_base_pml); i++) {
|
2007-02-21 19:18:43 +03:00
|
|
|
char * tmp_val = NULL;
|
2007-12-21 09:02:00 +03:00
|
|
|
tmp_val = (char *) opal_pointer_array_get_item(&mca_pml_base_pml, i);
|
2007-02-21 19:18:43 +03:00
|
|
|
if( NULL == tmp_val) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(0 == strncmp(component->pmlm_version.mca_component_name,
|
|
|
|
tmp_val, strlen(component->pmlm_version.mca_component_name)) ) {
|
2007-02-03 05:32:00 +03:00
|
|
|
found_pml = true;
|
2007-04-05 17:52:05 +04:00
|
|
|
break;
|
2007-02-03 05:01:18 +03:00
|
|
|
}
|
|
|
|
}
|
2007-02-21 19:18:43 +03:00
|
|
|
|
2007-12-21 09:02:00 +03:00
|
|
|
if(!found_pml && opal_pointer_array_get_size(&mca_pml_base_pml)) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2007-02-03 05:32:00 +03:00
|
|
|
"select: component %s not in the include list",
|
|
|
|
component->pmlm_version.mca_component_name );
|
|
|
|
|
2005-06-20 20:40:12 +04:00
|
|
|
continue;
|
2005-07-12 09:40:56 +04:00
|
|
|
}
|
2007-02-21 19:18:43 +03:00
|
|
|
|
|
|
|
/* if there is no init function - ignore it */
|
2005-06-20 20:40:12 +04:00
|
|
|
if (NULL == component->pmlm_init) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2005-07-12 09:40:56 +04:00
|
|
|
"select: no init function; ignoring component %s",
|
|
|
|
component->pmlm_version.mca_component_name );
|
|
|
|
continue;
|
2004-01-30 06:54:52 +03:00
|
|
|
}
|
2007-02-21 19:18:43 +03:00
|
|
|
|
2008-06-26 17:22:48 +04:00
|
|
|
/* this is a pml that could be considered */
|
|
|
|
num_pml++;
|
|
|
|
|
2007-02-21 19:18:43 +03:00
|
|
|
/* Init component to get its priority */
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2005-07-12 09:40:56 +04:00
|
|
|
"select: initializing %s component %s",
|
|
|
|
component->pmlm_version.mca_type_name,
|
|
|
|
component->pmlm_version.mca_component_name );
|
2007-02-03 05:01:18 +03:00
|
|
|
priority = best_priority;
|
2005-07-12 09:40:56 +04:00
|
|
|
module = component->pmlm_init(&priority, enable_progress_threads,
|
|
|
|
enable_mpi_threads);
|
|
|
|
if (NULL == module) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2005-07-12 09:40:56 +04:00
|
|
|
"select: init returned failure for component %s",
|
|
|
|
component->pmlm_version.mca_component_name );
|
|
|
|
continue;
|
|
|
|
}
|
2007-02-21 19:18:43 +03:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2005-07-12 09:40:56 +04:00
|
|
|
"select: init returned priority %d", priority );
|
2007-04-24 21:08:48 +04:00
|
|
|
#if OPAL_ENABLE_FT == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
/* Determine if this is the wrapper component */
|
|
|
|
if( priority <= PML_SELECT_WRAPPER_PRIORITY) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2007-03-17 02:11:45 +03:00
|
|
|
"pml:select: Wrapper Component: Component %s was determined to be a Wrapper PML with priority %d",
|
|
|
|
component->pmlm_version.mca_component_name, priority );
|
|
|
|
wrapper_priority = priority;
|
|
|
|
wrapper_component = component;
|
|
|
|
wrapper_module = module;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* Otherwise determine if this is the best component */
|
2007-04-24 21:08:48 +04:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (priority > best_priority) {
|
2005-07-12 09:40:56 +04:00
|
|
|
best_priority = priority;
|
|
|
|
best_component = component;
|
|
|
|
best_module = module;
|
|
|
|
}
|
|
|
|
|
2006-08-24 20:38:08 +04:00
|
|
|
om = (opened_component_t*)malloc(sizeof(opened_component_t));
|
2005-07-12 09:40:56 +04:00
|
|
|
if (NULL == om) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
OBJ_CONSTRUCT(om, opal_list_item_t);
|
|
|
|
om->om_component = component;
|
|
|
|
opal_list_append(&opened, (opal_list_item_t*) om);
|
2004-01-30 06:54:52 +03:00
|
|
|
}
|
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
/* Finished querying all components. Check for the bozo case. */
|
2007-02-03 05:01:18 +03:00
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
if( NULL == best_component ) {
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-mca-base.txt", "find-available:none-found", true, "pml");
|
2007-12-21 09:02:00 +03:00
|
|
|
for( i = 0; i < opal_pointer_array_get_size(&mca_pml_base_pml); i++) {
|
2007-02-21 19:18:43 +03:00
|
|
|
char * tmp_val = NULL;
|
2007-12-21 09:02:00 +03:00
|
|
|
tmp_val = (char *) opal_pointer_array_get_item(&mca_pml_base_pml, i);
|
2007-02-21 19:18:43 +03:00
|
|
|
if( NULL == tmp_val) {
|
|
|
|
continue;
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_errmgr.abort(1, "PML %s cannot be selected", tmp_val);
|
2007-02-03 05:01:18 +03:00
|
|
|
}
|
|
|
|
if(0 == i) {
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_errmgr.abort(2, "No pml component available. This shouldn't happen.");
|
2005-07-12 23:30:51 +04:00
|
|
|
}
|
2005-07-12 09:40:56 +04:00
|
|
|
}
|
2007-02-03 05:01:18 +03:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2007-02-03 05:01:18 +03:00
|
|
|
"selected %s best priority %d\n",
|
|
|
|
best_component->pmlm_version.mca_component_name, best_priority);
|
|
|
|
|
2008-06-26 17:22:48 +04:00
|
|
|
/* if more than one PML could be considered, then we still need the
|
|
|
|
* modex since we cannot know which one will be selected on all procs
|
|
|
|
*/
|
|
|
|
if (1 < num_pml) {
|
|
|
|
modex_reqd = true;
|
|
|
|
}
|
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
/* Finalize all non-selected components */
|
2004-01-30 06:54:52 +03:00
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
for (item = opal_list_remove_first(&opened);
|
|
|
|
NULL != item;
|
|
|
|
item = opal_list_remove_first(&opened)) {
|
|
|
|
om = (opened_component_t *) item;
|
2007-04-24 21:08:48 +04:00
|
|
|
|
|
|
|
if (om->om_component != best_component
|
|
|
|
#if OPAL_ENABLE_FT == 1
|
|
|
|
&& om->om_component != wrapper_component
|
|
|
|
#endif
|
|
|
|
) {
|
2007-03-17 19:33:43 +03:00
|
|
|
/* Finalize */
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2007-03-17 19:33:43 +03:00
|
|
|
if (NULL != om->om_component->pmlm_finalize) {
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2007-03-17 19:33:43 +03:00
|
|
|
/* Blatently ignore the return code (what would we do to
|
|
|
|
recover, anyway? This component is going away, so errors
|
|
|
|
don't matter anymore) */
|
|
|
|
|
|
|
|
om->om_component->pmlm_finalize();
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose(10, mca_pml_base_output,
|
2007-03-17 19:33:43 +03:00
|
|
|
"select: component %s not selected / finalized",
|
|
|
|
om->om_component->pmlm_version.mca_component_name);
|
2005-07-12 09:40:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT( om );
|
|
|
|
free(om);
|
2004-01-30 06:54:52 +03:00
|
|
|
}
|
2005-07-12 09:40:56 +04:00
|
|
|
OBJ_DESTRUCT( &opened );
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2007-04-24 21:08:48 +04:00
|
|
|
#if OPAL_ENABLE_FT == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
/* Remove the wrapper component from the mca_pml_base_components_available list
|
|
|
|
* so we don't unload it prematurely in the next call
|
|
|
|
*/
|
|
|
|
if( NULL != wrapper_component ) {
|
|
|
|
for (item = opal_list_get_first(&mca_pml_base_components_available);
|
|
|
|
item != opal_list_get_end(&mca_pml_base_components_available);
|
|
|
|
item = opal_list_get_next(item) ) {
|
|
|
|
cli = (mca_base_component_list_item_t *) item;
|
|
|
|
component = (mca_pml_base_component_t *) cli->cli_component;
|
|
|
|
|
|
|
|
if( component == wrapper_component ) {
|
|
|
|
opal_list_remove_item(&mca_pml_base_components_available, item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-04-24 21:08:48 +04:00
|
|
|
#endif
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
/* Save the winner */
|
|
|
|
|
|
|
|
mca_pml_base_selected_component = *best_component;
|
|
|
|
mca_pml = *best_module;
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2005-07-12 09:40:56 +04:00
|
|
|
"select: component %s selected",
|
2007-08-16 09:46:11 +04:00
|
|
|
mca_pml_base_selected_component.pmlm_version.mca_component_name );
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2008-12-10 02:49:02 +03:00
|
|
|
if (opal_profile) {
|
|
|
|
opal_output(0, "pml:%s", mca_pml_base_selected_component.pmlm_version.mca_component_name );
|
|
|
|
}
|
|
|
|
|
2007-08-03 06:23:24 +04:00
|
|
|
/* This base function closes, unloads, and removes from the
|
|
|
|
available list all unselected components. The available list will
|
|
|
|
contain only the selected component. */
|
|
|
|
|
|
|
|
mca_base_components_close(mca_pml_base_output,
|
|
|
|
&mca_pml_base_components_available,
|
|
|
|
(mca_base_component_t *) best_component);
|
|
|
|
|
2007-04-24 21:08:48 +04:00
|
|
|
#if OPAL_ENABLE_FT == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
/* If we have a wrapper then initalize it */
|
|
|
|
if( NULL != wrapper_component ) {
|
|
|
|
priority = PML_SELECT_WRAPPER_PRIORITY;
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
2007-03-17 02:11:45 +03:00
|
|
|
"pml:select: Wrapping: Component %s [%d] is being wrapped by component %s [%d]",
|
|
|
|
mca_pml_base_selected_component.pmlm_version.mca_component_name,
|
|
|
|
best_priority,
|
|
|
|
wrapper_component->pmlm_version.mca_component_name,
|
|
|
|
wrapper_priority );
|
|
|
|
|
|
|
|
/* Ask the wrapper commponent to wrap around the currently
|
|
|
|
* selected component. Indicated by the priority value provided
|
|
|
|
* this will cause the wrapper to do something different this time around
|
|
|
|
*/
|
|
|
|
module = wrapper_component->pmlm_init(&priority,
|
|
|
|
enable_progress_threads,
|
|
|
|
enable_mpi_threads);
|
|
|
|
/* Replace with the wrapper */
|
|
|
|
best_component = wrapper_component;
|
|
|
|
mca_pml_base_selected_component = *best_component;
|
|
|
|
best_module = module;
|
|
|
|
mca_pml = *best_module;
|
|
|
|
}
|
2007-04-24 21:08:48 +04:00
|
|
|
#endif
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
/* register the winner's callback */
|
2007-10-10 03:28:53 +04:00
|
|
|
if( NULL != mca_pml.pml_progress ) {
|
|
|
|
opal_progress_register(mca_pml.pml_progress);
|
|
|
|
}
|
2007-02-09 19:38:16 +03:00
|
|
|
|
|
|
|
/* register winner in the modex */
|
2008-06-26 17:22:48 +04:00
|
|
|
if (modex_reqd && 0 == ORTE_PROC_MY_NAME->vpid) {
|
|
|
|
mca_pml_base_pml_selected(best_component->pmlm_version.mca_component_name);
|
|
|
|
}
|
2007-02-09 19:38:16 +03:00
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
2004-01-30 06:54:52 +03:00
|
|
|
}
|
2007-02-09 19:38:16 +03:00
|
|
|
|
|
|
|
/* need a "commonly" named PML structure so everything ends up in the
|
|
|
|
same modex field */
|
|
|
|
static mca_base_component_t pml_base_component = {
|
2008-07-29 02:40:57 +04:00
|
|
|
MCA_BASE_VERSION_2_0_0,
|
2007-02-09 19:38:16 +03:00
|
|
|
"pml",
|
2008-07-29 02:40:57 +04:00
|
|
|
MCA_BASE_VERSION_2_0_0,
|
2007-02-09 19:38:16 +03:00
|
|
|
"base",
|
2008-07-29 02:40:57 +04:00
|
|
|
MCA_BASE_VERSION_2_0_0,
|
2007-02-09 19:38:16 +03:00
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_base_pml_selected(const char *name)
|
|
|
|
{
|
2007-07-09 21:16:34 +04:00
|
|
|
return ompi_modex_send(&pml_base_component, name, strlen(name) + 1);
|
2007-02-09 19:38:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_base_pml_check_selected(const char *my_pml,
|
|
|
|
ompi_proc_t **procs,
|
|
|
|
size_t nprocs)
|
|
|
|
{
|
2008-06-26 17:22:48 +04:00
|
|
|
size_t size;
|
2007-02-09 19:38:16 +03:00
|
|
|
int ret;
|
|
|
|
char *remote_pml;
|
|
|
|
|
2008-06-26 17:22:48 +04:00
|
|
|
/* if no modex was required by the PML, then
|
|
|
|
* we can assume success
|
|
|
|
*/
|
|
|
|
if (!modex_reqd) {
|
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
|
|
|
"check:select: modex not reqd");
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we are rank=0, then we can also assume success */
|
|
|
|
if (0 == ORTE_PROC_MY_NAME->vpid) {
|
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
|
|
|
"check:select: rank=0");
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the name of the PML module selected by rank=0 */
|
|
|
|
ret = ompi_modex_recv(&pml_base_component,
|
|
|
|
procs[0],
|
|
|
|
(void**) &remote_pml, &size);
|
|
|
|
|
|
|
|
/* if modex isn't implemented, then just assume all is well... */
|
|
|
|
if (OMPI_ERR_NOT_IMPLEMENTED == ret) {
|
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
|
|
|
"check:select: modex not implemented");
|
|
|
|
return OMPI_SUCCESS;
|
2007-02-09 19:38:16 +03:00
|
|
|
}
|
|
|
|
|
2008-06-26 18:08:36 +04:00
|
|
|
/* the remote pml returned should never be NULL if an error
|
|
|
|
* wasn't returned, but just to be safe, and since the check
|
|
|
|
* is fast...let's be sure
|
|
|
|
*/
|
|
|
|
if (NULL == remote_pml) {
|
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
|
|
|
"check:select: got a NULL pml from rank=0");
|
|
|
|
return OMPI_ERR_UNREACH;
|
|
|
|
}
|
|
|
|
|
2008-06-26 17:22:48 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_base_output,
|
|
|
|
"check:select: checking my pml %s against rank=0 pml %s",
|
|
|
|
my_pml, remote_pml);
|
|
|
|
|
|
|
|
/* if that module doesn't match my own, return an error */
|
|
|
|
if ((size != strlen(my_pml) + 1) ||
|
|
|
|
(0 != strcmp(my_pml, remote_pml))) {
|
|
|
|
if (procs[0]->proc_hostname) {
|
|
|
|
opal_output(0, "%s selected pml %s, but peer %s on %s selected pml %s",
|
|
|
|
ORTE_NAME_PRINT(&ompi_proc_local()->proc_name),
|
|
|
|
my_pml, ORTE_NAME_PRINT(&procs[0]->proc_name),
|
|
|
|
procs[0]->proc_hostname,
|
2008-06-26 18:08:36 +04:00
|
|
|
remote_pml);
|
2008-06-26 17:22:48 +04:00
|
|
|
} else {
|
|
|
|
opal_output(0, "%s selected pml %s, but peer %s selected pml %s",
|
|
|
|
ORTE_NAME_PRINT(&ompi_proc_local()->proc_name),
|
|
|
|
my_pml, ORTE_NAME_PRINT(&procs[0]->proc_name),
|
2008-06-26 18:08:36 +04:00
|
|
|
remote_pml);
|
2008-06-26 17:22:48 +04:00
|
|
|
}
|
2008-06-26 17:31:36 +04:00
|
|
|
free(remote_pml); /* cleanup before returning */
|
2008-06-26 17:22:48 +04:00
|
|
|
return OMPI_ERR_UNREACH;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(remote_pml);
|
2007-02-09 19:38:16 +03:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|