2007-12-21 09:02:00 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2004-01-29 05:43:58 +03:00
|
|
|
/*
|
2010-03-13 02:57:50 +03:00
|
|
|
* Copyright (c) 2004-2010 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.
|
2007-01-30 09:34:38 +03:00
|
|
|
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
* 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.
|
2009-02-13 06:45:11 +03:00
|
|
|
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
2013-03-28 01:17:31 +04:00
|
|
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-29 05:43:58 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2004-10-22 20:06:05 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-29 05:43:58 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2009-03-13 05:10:32 +03:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
2007-04-01 20:16:54 +04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif /* HAVE_UNIST_H */
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/mca/mca.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/mca/base/base.h"
|
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
|
|
|
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/pml/base/base.h"
|
2007-07-11 03:45:23 +04:00
|
|
|
#include "ompi/mca/pml/base/pml_base_request.h"
|
2004-01-29 05:43:58 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The following file was created by configure. It contains extern
|
|
|
|
* statements and the definition of an array of pointers to each
|
2004-08-02 04:24:22 +04:00
|
|
|
* component's public mca_base_component_t struct.
|
2004-01-29 05:43:58 +03:00
|
|
|
*/
|
|
|
|
|
2005-07-04 22:24:58 +04:00
|
|
|
#include "ompi/mca/pml/base/static-components.h"
|
2004-01-29 05:43:58 +03:00
|
|
|
|
2005-01-13 18:30:49 +03:00
|
|
|
int mca_pml_base_progress(void)
|
2004-08-28 05:15:19 +04:00
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-07-15 01:33:26 +04:00
|
|
|
#define xstringify(pml) #pml
|
|
|
|
#define stringify(pml) xstringify(pml)
|
2004-01-29 05:43:58 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Global variables
|
|
|
|
*/
|
2006-08-24 20:38:08 +04:00
|
|
|
mca_pml_base_module_t mca_pml = {
|
2004-10-12 19:50:01 +04:00
|
|
|
NULL, /* pml_add_procs */
|
|
|
|
NULL, /* pml_del_procs */
|
2007-01-30 09:34:38 +03:00
|
|
|
NULL, /* pml_enable */
|
2004-10-12 19:50:01 +04:00
|
|
|
mca_pml_base_progress, /* pml_progress */
|
|
|
|
NULL, /* pml_add_comm */
|
|
|
|
NULL, /* pml_del_comm */
|
|
|
|
NULL, /* pml_irecv_init */
|
|
|
|
NULL, /* pml_irecv */
|
|
|
|
NULL, /* pml_recv */
|
|
|
|
NULL, /* pml_isend_init */
|
|
|
|
NULL, /* pml_isend */
|
|
|
|
NULL, /* pml_send */
|
|
|
|
NULL, /* pml_iprobe */
|
|
|
|
NULL, /* pml_probe */
|
2007-01-30 09:34:38 +03:00
|
|
|
NULL, /* pml_start */
|
|
|
|
NULL, /* pml_dump */
|
2007-03-17 02:11:45 +03:00
|
|
|
NULL, /* pml_ft_event */
|
2007-01-30 09:34:38 +03:00
|
|
|
0, /* pml_max_contextid */
|
|
|
|
0 /* pml_max_tag */
|
2004-08-28 05:15:19 +04:00
|
|
|
};
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_pml_base_component_t mca_pml_base_selected_component;
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_t mca_pml_base_pml;
|
2013-03-28 01:09:41 +04:00
|
|
|
char *ompi_pml_base_bsend_allocator_name;
|
|
|
|
|
|
|
|
#if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1
|
|
|
|
static char *ompi_pml_base_wrapper = NULL;
|
|
|
|
#endif
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
static int mca_pml_base_register(mca_base_register_flag_t flags)
|
2013-03-28 01:09:41 +04:00
|
|
|
{
|
|
|
|
#if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1
|
|
|
|
int var_id;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ompi_pml_base_bsend_allocator_name = "basic";
|
|
|
|
(void) mca_base_var_register("ompi", "pml", "base", "bsend_allocator", NULL,
|
|
|
|
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&ompi_pml_base_bsend_allocator_name);
|
|
|
|
|
|
|
|
#if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1
|
|
|
|
ompi_pml_base_wrapper = NULL;
|
|
|
|
var_id = mca_base_var_register("ompi", "pml", "base", "wrapper",
|
|
|
|
"Use a Wrapper component around the selected PML component",
|
|
|
|
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&ompi_pml_base_wrapper);
|
|
|
|
(void) mca_base_var_register_synonym(var_id, "ompi", "pml", NULL, "wrapper", 0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2004-01-29 05:43:58 +03:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
int mca_pml_base_finalize(void) {
|
|
|
|
if (NULL != mca_pml_base_selected_component.pmlm_finalize) {
|
|
|
|
return mca_pml_base_selected_component.pmlm_finalize();
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int mca_pml_base_close(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
/* turn off the progress code for the pml */
|
|
|
|
if( NULL != mca_pml.pml_progress ) {
|
|
|
|
opal_progress_unregister(mca_pml.pml_progress);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Blatently ignore the return code (what would we do to recover,
|
|
|
|
anyway? This module is going away, so errors don't matter
|
|
|
|
anymore) */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destruct the send and receive queues. The ompi_free_list_t destructor
|
|
|
|
* will return the memory to the mpool, so this has to be done before the
|
|
|
|
* mpool get released by the PML close function.
|
|
|
|
*/
|
|
|
|
OBJ_DESTRUCT(&mca_pml_base_send_requests);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_base_recv_requests);
|
|
|
|
|
|
|
|
mca_pml.pml_progress = mca_pml_base_progress;
|
|
|
|
|
|
|
|
/* Free all the strings in the array */
|
|
|
|
j = opal_pointer_array_get_size(&mca_pml_base_pml);
|
|
|
|
for (i = 0; i < j; ++i) {
|
|
|
|
char *str;
|
|
|
|
str = (char*) opal_pointer_array_get_item(&mca_pml_base_pml, i);
|
|
|
|
free(str);
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&mca_pml_base_pml);
|
|
|
|
|
|
|
|
/* Close all remaining available components */
|
|
|
|
return mca_base_framework_components_close(&ompi_pml_base_framework, NULL);
|
|
|
|
}
|
|
|
|
|
2004-01-29 05:43:58 +03:00
|
|
|
/**
|
2004-08-02 04:24:22 +04:00
|
|
|
* Function for finding and opening either all MCA components, or the one
|
2004-01-29 05:43:58 +03:00
|
|
|
* that was specifically requested via a MCA parameter.
|
|
|
|
*/
|
2013-03-28 01:17:31 +04:00
|
|
|
static int mca_pml_base_open(mca_base_open_flag_t flags)
|
2004-01-29 05:43:58 +03:00
|
|
|
{
|
2009-08-03 20:45:18 +04:00
|
|
|
/**
|
|
|
|
* Construct the send and receive request queues. There are 2 reasons to do it
|
|
|
|
* here. First, as they are globals it's better to construct them in one common
|
|
|
|
* place. Second, in order to be able to allow the external debuggers to show
|
|
|
|
* their content, they should get constructed as soon as possible once the MPI
|
|
|
|
* process is started.
|
|
|
|
*/
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_base_send_requests, ompi_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_base_recv_requests, ompi_free_list_t);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&mca_pml_base_pml, opal_pointer_array_t);
|
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
/* Open up all available components */
|
2004-01-29 05:43:58 +03:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
if (OPAL_SUCCESS !=
|
|
|
|
mca_base_framework_components_open(&ompi_pml_base_framework, flags)) {
|
2005-07-12 09:40:56 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2004-01-31 01:56:36 +03:00
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
/* Set a sentinel in case we don't select any components (e.g.,
|
|
|
|
ompi_info) */
|
2004-01-31 01:56:36 +03:00
|
|
|
|
2005-07-12 09:40:56 +04:00
|
|
|
mca_pml_base_selected_component.pmlm_finalize = NULL;
|
2005-06-20 20:40:12 +04:00
|
|
|
|
2006-11-10 07:53:00 +03:00
|
|
|
/**
|
|
|
|
* Right now our selection of BTLs is completely broken. If we have
|
2007-02-03 05:01:18 +03:00
|
|
|
* multiple PMLs that use BTLs than we will open all BTLs several times, leading to
|
2006-11-10 07:53:00 +03:00
|
|
|
* undefined behaviors. The simplest solution, at least until we
|
2007-02-03 05:01:18 +03:00
|
|
|
* figure out the correct way to do it, is to force a default PML that
|
|
|
|
* uses BTLs and any other PMLs that do not in the mca_pml_base_pml array.
|
2006-11-10 07:53:00 +03:00
|
|
|
*/
|
2007-02-03 05:01:18 +03:00
|
|
|
|
2010-09-18 03:04:06 +04:00
|
|
|
#if MCA_ompi_pml_DIRECT_CALL
|
2010-04-12 23:54:07 +04:00
|
|
|
opal_pointer_array_add(&mca_pml_base_pml,
|
2012-05-02 03:12:41 +04:00
|
|
|
strdup(stringify(MCA_ompi_pml_DIRECT_CALL_COMPONENT)));
|
2006-11-10 07:53:00 +03:00
|
|
|
#else
|
2007-10-18 17:48:56 +04:00
|
|
|
{
|
2013-03-28 01:09:41 +04:00
|
|
|
const char **default_pml = NULL;
|
|
|
|
int var_id;
|
2007-10-18 17:48:56 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
var_id = mca_base_var_find("ompi", "pml", NULL, NULL);
|
|
|
|
mca_base_var_get_value(var_id, &default_pml, NULL, NULL);
|
2010-04-12 23:54:07 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
if( (NULL == default_pml || NULL == default_pml[0] ||
|
|
|
|
0 == strlen(default_pml[0])) || (default_pml[0][0] == '^') ) {
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_add(&mca_pml_base_pml, strdup("ob1"));
|
2014-12-01 14:05:47 +03:00
|
|
|
opal_pointer_array_add(&mca_pml_base_pml, strdup("yalla"));
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_add(&mca_pml_base_pml, strdup("cm"));
|
2010-04-12 23:54:07 +04:00
|
|
|
} else {
|
2013-03-28 01:09:41 +04:00
|
|
|
opal_pointer_array_add(&mca_pml_base_pml, strdup(default_pml[0]));
|
2007-10-18 17:48:56 +04:00
|
|
|
}
|
2007-02-03 05:01:18 +03:00
|
|
|
}
|
2010-03-13 02:57:50 +03:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
2007-03-17 02:11:45 +03:00
|
|
|
/*
|
|
|
|
* Which PML Wrapper component to use, if any
|
|
|
|
* - NULL or "" = No wrapper
|
|
|
|
* - ow. select that specific wrapper component
|
|
|
|
*/
|
2013-03-28 01:09:41 +04:00
|
|
|
if( NULL != ompi_pml_base_wrapper) {
|
|
|
|
opal_pointer_array_add(&mca_pml_base_pml, ompi_pml_base_wrapper);
|
2007-03-17 02:11:45 +03:00
|
|
|
}
|
2007-04-24 21:08:48 +04:00
|
|
|
#endif
|
|
|
|
|
2006-11-10 07:53:00 +03:00
|
|
|
#endif
|
|
|
|
|
2006-02-23 08:24:58 +03:00
|
|
|
return OMPI_SUCCESS;
|
2007-02-03 05:01:18 +03:00
|
|
|
|
2004-01-29 05:43:58 +03:00
|
|
|
}
|
2013-03-28 01:17:31 +04:00
|
|
|
|
|
|
|
MCA_BASE_FRAMEWORK_DECLARE(ompi, pml, "OMPI PML", mca_pml_base_register,
|
|
|
|
mca_pml_base_open, mca_pml_base_close,
|
|
|
|
mca_pml_base_static_components, 0);
|