2008-02-28 04:57:57 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
|
|
|
#include "orte/constants.h"
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/plm/base/base.h"
|
|
|
|
#include "orte/mca/plm/plm.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "orte/runtime/orte_cr.h"
|
|
|
|
|
|
|
|
#include "orte/mca/ess/ess.h"
|
|
|
|
#include "orte/mca/ess/base/base.h"
|
|
|
|
#include "orte/mca/ess/tool/ess_tool.h"
|
|
|
|
|
2009-05-04 15:07:40 +04:00
|
|
|
static int rte_init(void);
|
2008-02-28 04:57:57 +03:00
|
|
|
static void rte_abort(int status, bool report) __opal_attribute_noreturn__;
|
2008-11-01 00:10:00 +03:00
|
|
|
static orte_vpid_t proc_get_daemon(orte_process_name_t *proc);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
|
|
|
|
orte_ess_base_module_t orte_ess_tool_module = {
|
|
|
|
rte_init,
|
|
|
|
orte_ess_base_tool_finalize,
|
2008-03-05 07:57:23 +03:00
|
|
|
rte_abort,
|
2008-04-30 23:49:53 +04:00
|
|
|
NULL, /* don't need a local procs fn */
|
2008-11-01 00:10:00 +03:00
|
|
|
proc_get_daemon,
|
2008-04-30 23:49:53 +04:00
|
|
|
NULL, /* don't need a proc_get_hostname fn */
|
|
|
|
NULL, /* don't need a proc_get_local_rank fn */
|
|
|
|
NULL, /* don't need a proc_get_node_rank fn */
|
2008-11-18 18:35:50 +03:00
|
|
|
NULL, /* don't need to update_pidmap */
|
2008-11-01 00:10:00 +03:00
|
|
|
NULL, /* don't need to update_nidmap */
|
2008-03-05 07:57:23 +03:00
|
|
|
NULL /* ft_event */
|
2008-02-28 04:57:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-05-04 15:07:40 +04:00
|
|
|
static int rte_init(void)
|
2008-02-28 04:57:57 +03:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char *error = NULL;
|
|
|
|
|
2008-06-18 07:15:56 +04:00
|
|
|
/* run the prolog */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
|
|
|
|
error = "orte_ess_base_std_prolog";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* If we are a tool with no name, then responsibility for
|
|
|
|
* defining the name falls to the PLM component for our
|
|
|
|
* respective environment - hence, we have to open the PLM
|
|
|
|
* first and select that component. Note that ONLY the
|
|
|
|
* HNP ever uses a PLM component, so we ONLY use the PLM
|
|
|
|
* here to set our name and then close it
|
|
|
|
*
|
|
|
|
* NOTE: Tools with names - i.e., tools consisting of a
|
|
|
|
* distributed set of processes - will select and use
|
|
|
|
* the appropriate enviro-specific module and -not- this one!
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_plm_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_plm_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_plm_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_plm_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_plm.set_hnp_name())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_plm_set_hnp_name";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
/* close the plm since we opened it to set our
|
|
|
|
* name, but have no further use for it
|
|
|
|
*/
|
|
|
|
orte_plm_base_close();
|
|
|
|
|
|
|
|
/* do the rest of the standard tool init */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ess_base_tool_setup";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
|
|
|
|
error:
|
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-ess-tool.txt",
|
2008-02-28 04:57:57 +03:00
|
|
|
"tool:rte_init:startup:internal-failure",
|
|
|
|
true, error, ORTE_ERROR_NAME(ret), ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* we call abort.
|
|
|
|
*/
|
|
|
|
static void rte_abort(int status, bool report)
|
|
|
|
{
|
|
|
|
/* do NOT do a normal finalize as this will very likely
|
|
|
|
* hang the process. We are aborting due to an abnormal condition
|
|
|
|
* that precludes normal cleanup
|
|
|
|
*
|
|
|
|
* We do need to do the following bits to make sure we leave a
|
|
|
|
* clean environment. Taken from orte_finalize():
|
|
|
|
* - Assume errmgr cleans up child processes before we exit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* CRS cleanup since it may have a named pipe and thread active */
|
|
|
|
orte_cr_finalize();
|
|
|
|
|
|
|
|
/* - Clean out the global structures
|
|
|
|
* (not really necessary, but good practice)
|
|
|
|
*/
|
|
|
|
orte_proc_info_finalize();
|
|
|
|
|
2008-12-21 02:24:36 +03:00
|
|
|
/* Now just exit */
|
|
|
|
exit(0);
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
|
2008-11-01 00:10:00 +03:00
|
|
|
static orte_vpid_t proc_get_daemon(orte_process_name_t *proc)
|
|
|
|
{
|
|
|
|
return ORTE_VPID_INVALID;
|
|
|
|
}
|