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.
|
2008-02-28 08:32:23 +03:00
|
|
|
* Copyright (c) 2004-2008 The University of Tennessee and The University
|
2008-02-28 04:57:57 +03:00
|
|
|
* 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
|
|
|
|
|
|
|
|
#include "opal/event/event.h"
|
|
|
|
#include "opal/runtime/opal.h"
|
|
|
|
#include "opal/runtime/opal_cr.h"
|
|
|
|
|
|
|
|
#include "opal/util/os_path.h"
|
|
|
|
#include "opal/util/malloc.h"
|
|
|
|
|
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/rml/base/base.h"
|
|
|
|
#include "orte/mca/rml/base/rml_contact.h"
|
|
|
|
#include "orte/mca/routed/base/base.h"
|
|
|
|
#include "orte/mca/routed/routed.h"
|
|
|
|
#include "orte/mca/errmgr/base/base.h"
|
|
|
|
#include "orte/mca/grpcomm/base/base.h"
|
|
|
|
#include "orte/mca/iof/base/base.h"
|
|
|
|
#include "orte/mca/ras/base/base.h"
|
|
|
|
#include "orte/mca/plm/base/base.h"
|
|
|
|
#include "orte/mca/odls/base/base.h"
|
|
|
|
|
|
|
|
#include "orte/mca/rmaps/base/base.h"
|
|
|
|
#if OPAL_ENABLE_FT == 1
|
|
|
|
#include "orte/mca/snapc/base/base.h"
|
|
|
|
#endif
|
|
|
|
#include "orte/mca/filem/base/base.h"
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "orte/util/session_dir.h"
|
|
|
|
#include "orte/util/hnp_contact.h"
|
|
|
|
#include "orte/util/name_fns.h"
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
|
|
|
|
#include "orte/runtime/orte_cr.h"
|
|
|
|
#include "orte/mca/ess/ess.h"
|
|
|
|
#include "orte/mca/ess/base/base.h"
|
|
|
|
#include "orte/mca/ess/hnp/ess_hnp.h"
|
|
|
|
|
|
|
|
static int rte_init(char flags);
|
|
|
|
static int rte_finalize(void);
|
|
|
|
static void rte_abort(int status, bool report) __opal_attribute_noreturn__;
|
|
|
|
|
|
|
|
|
|
|
|
orte_ess_base_module_t orte_ess_hnp_module = {
|
|
|
|
rte_init,
|
|
|
|
rte_finalize,
|
2008-03-05 07:57:23 +03:00
|
|
|
rte_abort,
|
2008-04-30 23:49:53 +04:00
|
|
|
NULL, /* don't need a proc_is_local fn */
|
|
|
|
NULL, /* don't need a proc_get_hostname fn */
|
|
|
|
NULL, /* don't need a proc_get_arch fn */
|
|
|
|
NULL, /* don't need a proc_get_local_rank fn */
|
|
|
|
NULL, /* don't need a proc_get_node_rank fn */
|
2008-03-05 07:57:23 +03:00
|
|
|
NULL /* ft_event */
|
2008-02-28 04:57:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int rte_init(char flags)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char *error = NULL;
|
|
|
|
char *jobid_str, *procid_str, *contact_path;
|
|
|
|
orte_job_t *jdata;
|
|
|
|
orte_node_t *node;
|
|
|
|
orte_proc_t *proc;
|
|
|
|
|
|
|
|
/* Since we are the HNP, 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 anyway
|
|
|
|
*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup the communication infrastructure */
|
|
|
|
/*
|
|
|
|
* Runtime Messaging Layer
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_rml_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_rml_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_rml_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_rml_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Routed system
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_routed_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_routed_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_routed_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_routed_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Group communications
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_grpcomm_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_grpcomm_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_grpcomm_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_grpcomm_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now provide a chance for the PLM
|
|
|
|
* to perform any module-specific init functions. This
|
|
|
|
* needs to occur AFTER the communications are setup
|
|
|
|
* as it may involve starting a non-blocking recv
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_plm.init())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_plm_init";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup the remaining resource
|
|
|
|
* management and errmgr frameworks - application procs
|
|
|
|
* and daemons do not open these frameworks as they only use
|
|
|
|
* the hnp proxy support in the PLM framework.
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ras_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ras_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ras_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ras_base_find_available";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_rmaps_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_rmaps_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_rmaps_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_rmaps_base_find_available";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_errmgr_base_open())) {
|
|
|
|
error = "orte_errmgr_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_errmgr_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_errmgr_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open/select the odls */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_odls_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_odls_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_odls_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_odls_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* enable communication with the rml */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_rml.enable_comm())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_rml.enable_comm";
|
|
|
|
goto 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
|
|
|
#if ORTE_DISABLE_FULL_SUPPORT
|
|
|
|
#else
|
2008-06-09 18:53:58 +04:00
|
|
|
/* setup the orte_show_help system to recv remote output */
|
|
|
|
ret = orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, ORTE_RML_TAG_SHOW_HELP,
|
|
|
|
ORTE_RML_NON_PERSISTENT, orte_show_help_recv, NULL);
|
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
|
|
|
if (ret != ORTE_SUCCESS && ret != ORTE_ERR_NOT_IMPLEMENTED) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
2008-06-09 18:53:58 +04:00
|
|
|
error = "setup receive for orte_show_help";
|
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
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* setup my session directory */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_util_convert_jobid_to_string(&jobid_str, ORTE_PROC_MY_NAME->jobid))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_convert_jobid_to_string";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_util_convert_vpid_to_string(&procid_str, ORTE_PROC_MY_NAME->vpid))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_convert_vpid_to_string";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_debug_output,
|
2008-03-24 02:10:15 +03:00
|
|
|
"%s setting up session dir with\n\ttmpdir: %s\n\thost %s\n\tjobid %s\n\tprocid %s",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
(NULL == orte_process_info.tmpdir_base) ? "UNDEF" : orte_process_info.tmpdir_base,
|
2008-03-24 02:10:15 +03:00
|
|
|
orte_process_info.nodename, jobid_str, procid_str));
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_session_dir(true,
|
|
|
|
orte_process_info.tmpdir_base,
|
2008-03-24 02:10:15 +03:00
|
|
|
orte_process_info.nodename, NULL,
|
2008-02-28 04:57:57 +03:00
|
|
|
jobid_str, procid_str))) {
|
|
|
|
if (jobid_str != NULL) free(jobid_str);
|
|
|
|
if (procid_str != NULL) free(procid_str);
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_session_dir";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (NULL != jobid_str) {
|
|
|
|
free(jobid_str);
|
|
|
|
}
|
|
|
|
if (NULL != procid_str) {
|
|
|
|
free(procid_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Once the session directory location has been established, set
|
2008-06-09 18:53:58 +04:00
|
|
|
the opal_output hnp file location to be in the
|
2008-02-28 04:57:57 +03:00
|
|
|
proc-specific session directory. */
|
|
|
|
opal_output_set_output_file_info(orte_process_info.proc_session_dir,
|
|
|
|
"output-", NULL, NULL);
|
|
|
|
|
|
|
|
/* save my contact info in a file for others to find */
|
|
|
|
contact_path = opal_os_path(false, orte_process_info.job_session_dir,
|
|
|
|
"contact.txt", NULL);
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_debug_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s writing contact file %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
contact_path));
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_write_hnp_contact_file(contact_path))) {
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_debug_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s writing contact file failed with error %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_ERROR_NAME(ret)));
|
|
|
|
} else {
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_debug_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s wrote contact file",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
}
|
|
|
|
free(contact_path);
|
|
|
|
|
|
|
|
/* Setup the job data object for the daemons */
|
|
|
|
/* create and store the job data object */
|
|
|
|
jdata = OBJ_NEW(orte_job_t);
|
|
|
|
jdata->jobid = ORTE_PROC_MY_NAME->jobid;
|
2008-02-28 08:32:23 +03:00
|
|
|
opal_pointer_array_add(orte_job_data, jdata);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* create and store a node object where we are */
|
|
|
|
node = OBJ_NEW(orte_node_t);
|
2008-03-24 02:10:15 +03:00
|
|
|
node->name = strdup(orte_process_info.nodename);
|
2008-04-30 23:49:53 +04:00
|
|
|
node->arch = orte_process_info.arch;
|
2008-02-28 08:32:23 +03:00
|
|
|
node->index = opal_pointer_array_add(orte_node_pool, node);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* create and store a proc object for us */
|
|
|
|
proc = OBJ_NEW(orte_proc_t);
|
|
|
|
proc->name.jobid = ORTE_PROC_MY_NAME->jobid;
|
|
|
|
proc->name.vpid = ORTE_PROC_MY_NAME->vpid;
|
|
|
|
proc->pid = orte_process_info.pid;
|
|
|
|
proc->rml_uri = orte_rml.get_contact_info();
|
|
|
|
proc->state = ORTE_PROC_STATE_RUNNING;
|
|
|
|
OBJ_RETAIN(node); /* keep accounting straight */
|
|
|
|
proc->node = node;
|
2008-04-30 23:49:53 +04:00
|
|
|
proc->nodename = node->name;
|
2008-02-28 08:32:23 +03:00
|
|
|
opal_pointer_array_add(jdata->procs, proc);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* record that the daemon (i.e., us) is on this node
|
|
|
|
* NOTE: we do not add the proc object to the node's
|
|
|
|
* proc array because we are not an application proc.
|
|
|
|
* Instead, we record it in the daemon field of the
|
|
|
|
* node object
|
|
|
|
*/
|
|
|
|
OBJ_RETAIN(proc); /* keep accounting straight */
|
|
|
|
node->daemon = proc;
|
|
|
|
node->daemon_launched = true;
|
|
|
|
node->state = ORTE_NODE_STATE_UP;
|
|
|
|
|
|
|
|
/* record that the daemon job is running */
|
|
|
|
jdata->num_procs = 1;
|
|
|
|
jdata->state = ORTE_JOB_STATE_RUNNING;
|
|
|
|
|
|
|
|
/* setup the routed info - the selected routed component
|
|
|
|
* will know what to do.
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_routed.init_routes(ORTE_PROC_MY_NAME->jobid, NULL))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_routed.init_routes";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* setup I/O forwarding system - must come after we init routes */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_iof_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_iof_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_iof_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_iof_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup the FileM */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_filem_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_filem_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_filem_base_select())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_filem_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if OPAL_ENABLE_FT == 1
|
|
|
|
/*
|
|
|
|
* Setup the SnapC
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_snapc_base_open())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_snapc_base_open";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_snapc_base_select(orte_process_info.hnp, !orte_process_info.daemon))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_snapc_base_select";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For HNP, ORTE doesn't need the OPAL CR stuff */
|
|
|
|
opal_cr_set_enabled(false);
|
|
|
|
#else
|
|
|
|
opal_cr_set_enabled(false);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initalize the CR setup
|
|
|
|
* Note: Always do this, even in non-FT builds.
|
|
|
|
* If we don't some user level tools may hang.
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_cr_init())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_cr_init";
|
|
|
|
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-orte-runtime.txt",
|
2008-02-28 04:57:57 +03:00
|
|
|
"orte_init:startup:internal-failure",
|
|
|
|
true, error, ORTE_ERROR_NAME(ret), ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rte_finalize(void)
|
|
|
|
{
|
|
|
|
char *contact_path;
|
|
|
|
|
|
|
|
/* remove my contact info file */
|
|
|
|
contact_path = opal_os_path(false, orte_process_info.top_session_dir,
|
|
|
|
"contact.txt", NULL);
|
|
|
|
unlink(contact_path);
|
|
|
|
free(contact_path);
|
|
|
|
|
|
|
|
orte_cr_finalize();
|
|
|
|
|
|
|
|
#if OPAL_ENABLE_FT == 1
|
|
|
|
orte_snapc_base_close();
|
|
|
|
#endif
|
|
|
|
orte_filem_base_close();
|
|
|
|
|
|
|
|
orte_odls_base_close();
|
|
|
|
|
|
|
|
orte_wait_finalize();
|
|
|
|
orte_iof_base_close();
|
|
|
|
|
|
|
|
/* finalize selected modules so they can de-register
|
|
|
|
* any receives
|
|
|
|
*/
|
|
|
|
orte_ras_base_close();
|
|
|
|
orte_rmaps_base_close();
|
|
|
|
orte_plm_base_close();
|
|
|
|
orte_errmgr_base_close();
|
|
|
|
|
|
|
|
/* now can close the rml and its friendly group comm */
|
|
|
|
orte_grpcomm_base_close();
|
|
|
|
orte_routed_base_close();
|
|
|
|
orte_rml_base_close();
|
|
|
|
|
|
|
|
orte_session_dir_finalize(ORTE_PROC_MY_NAME);
|
|
|
|
|
|
|
|
/* clean out the global structures */
|
|
|
|
orte_proc_info_finalize();
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For application procs, we do NOT call the regular
|
|
|
|
* C-library "abort" function, even though that would have
|
|
|
|
* alerted us to the fact that this is an abnormal termination,
|
|
|
|
* because it would automatically cause a core file to be
|
|
|
|
* generated. On large systems, that can be overwhelming
|
|
|
|
* (imagine a few thousand Gbyte-sized files hitting
|
|
|
|
* a shared file system simultaneously...ouch!).
|
|
|
|
*
|
|
|
|
* However, the HNP is only ONE process, so we can do it
|
|
|
|
* here as the core file might prove useful.
|
|
|
|
*/
|
|
|
|
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();
|
|
|
|
|
|
|
|
/* Now abort */
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|