2008-02-17 22:29:06 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2006 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 (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
|
|
|
|
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*
|
|
|
|
* These symbols are in a file by themselves to provide nice linker
|
|
|
|
* semantics. Since linkers generally pull in symbols by object
|
|
|
|
* files, keeping these symbols as the only symbols in this file
|
|
|
|
* prevents utility programs such as "ompi_info" from having to import
|
|
|
|
* entire components just to query their version and parameters.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
|
|
|
#include "orte/types.h"
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <signal.h>
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
|
|
|
#include "opal/util/argv.h"
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2008-02-17 22:29:06 +03:00
|
|
|
#include "opal/util/opal_environ.h"
|
|
|
|
#include "opal/util/path.h"
|
|
|
|
#include "opal/util/basename.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
#include "orte/util/name_fns.h"
|
2008-02-17 22:29:06 +03:00
|
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/plm/plm.h"
|
|
|
|
#include "orte/mca/plm/base/base.h"
|
|
|
|
#include "orte/mca/plm/base/plm_private.h"
|
|
|
|
#include "plm_alps.h"
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_alps_init(void);
|
|
|
|
static int plm_alps_launch_job(orte_job_t *jdata);
|
|
|
|
static int plm_alps_terminate_job(orte_jobid_t jobid);
|
|
|
|
static int plm_alps_terminate_orteds(void);
|
|
|
|
static int plm_alps_signal_job(orte_jobid_t jobid, int32_t signal);
|
|
|
|
static int plm_alps_finalize(void);
|
|
|
|
|
|
|
|
static int plm_alps_start_proc(int argc, char **argv, char **env,
|
2008-02-17 22:29:06 +03:00
|
|
|
char *prefix);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_plm_base_module_t orte_plm_alps_module = {
|
|
|
|
plm_alps_init,
|
|
|
|
orte_plm_base_set_hnp_name,
|
|
|
|
plm_alps_launch_job,
|
2008-04-14 23:36:13 +04:00
|
|
|
NULL,
|
2008-02-28 04:57:57 +03:00
|
|
|
plm_alps_terminate_job,
|
|
|
|
plm_alps_terminate_orteds,
|
|
|
|
plm_alps_signal_job,
|
|
|
|
plm_alps_finalize
|
2008-02-17 22:29:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables
|
|
|
|
*/
|
|
|
|
static pid_t alps_pid = 0;
|
|
|
|
static orte_jobid_t active_job = ORTE_JOBID_INVALID;
|
|
|
|
static bool failed_launch;
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/**
|
|
|
|
* Init the module
|
|
|
|
*/
|
|
|
|
static int plm_alps_init(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_start())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-17 22:29:06 +03:00
|
|
|
/* When working in this function, ALWAYS jump to "cleanup" if
|
|
|
|
* you encounter an error so that orterun will be woken up and
|
|
|
|
* the job can cleanly terminate
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_alps_launch_job(orte_job_t *jdata)
|
2008-02-17 22:29:06 +03:00
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_job_map_t *map;
|
2008-02-17 22:29:06 +03:00
|
|
|
char *jobid_string = NULL;
|
|
|
|
char *param;
|
|
|
|
char **argv = NULL;
|
|
|
|
int argc;
|
|
|
|
int rc;
|
|
|
|
char *tmp;
|
|
|
|
char** env = NULL;
|
|
|
|
char* var;
|
|
|
|
char *nodelist_flat;
|
|
|
|
char **nodelist_argv;
|
|
|
|
int nodelist_argc;
|
2008-02-28 04:57:57 +03:00
|
|
|
char *vpid_string;
|
2008-02-17 22:29:06 +03:00
|
|
|
char **custom_strings;
|
|
|
|
int num_args, i;
|
|
|
|
char *cur_prefix;
|
|
|
|
struct timeval joblaunchstart, launchstart, launchstop;
|
2008-02-28 04:57:57 +03:00
|
|
|
int proc_vpid_index;
|
|
|
|
orte_app_context_t **apps;
|
|
|
|
orte_node_t **nodes;
|
|
|
|
orte_std_cntr_t nnode;
|
Fix a potential, albeit perhaps esoteric, race condition that can occur for fast HNP's, slow orteds, and fast apps. Under those conditions, it is possible for the orted to be caught in its original send of contact info back to the HNP, and thus for the progress stack never to recover back to a high level. In those circumstances, the orted can "hang" when trying to exit.
Add a new function to opal_progress that tells us our recursion depth to support that solution.
Yes, I know this sounds picky, but good ol' Jeff managed to make it happen by driving his cluster near to death...
Also ensure that we declare "failed" for the daemon job when daemons fail instead of the application job. This is important so that orte knows that it cannot use xcast to tell daemons to "exit", nor should it expect all daemons to respond. Otherwise, it is possible to hang.
After lots of testing, decide to default (again) to slurm detecting failed orteds. This proved necessary to avoid rather annoying hangs that were difficult to recover from. There are conditions where slurm will fail to launch all daemons (slurm folks are working on it), and yet again, good ol' Jeff managed to find both of them.
Thanks you Jeff! :-/
This commit was SVN r18611.
2008-06-06 23:36:27 +04:00
|
|
|
orte_jobid_t failed_job;
|
|
|
|
|
|
|
|
/* default to declaring the daemon launch failed */
|
|
|
|
failed_job = ORTE_PROC_MY_NAME->jobid;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
if (mca_plm_alps_component.timing) {
|
2008-02-17 22:29:06 +03:00
|
|
|
if (0 != gettimeofday(&joblaunchstart, NULL)) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_alps: could not obtain job start time");
|
2008-02-17 22:29:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* indicate the state of the launch */
|
|
|
|
failed_launch = true;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* create a jobid for this job */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_create_jobid(&jdata->jobid))) {
|
2008-02-17 22:29:06 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:alps: launching job %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_JOBID_PRINT(jdata->jobid)));
|
|
|
|
|
|
|
|
/* setup the job */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_setup_job(jdata))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* save the active jobid */
|
|
|
|
active_job = jdata->jobid;
|
|
|
|
|
|
|
|
/* Get the map for this job */
|
|
|
|
if (NULL == (map = orte_rmaps.get_job_map(active_job))) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
rc = ORTE_ERR_NOT_FOUND;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
apps = (orte_app_context_t**)jdata->apps->addr;
|
|
|
|
nodes = (orte_node_t**)map->nodes->addr;
|
|
|
|
|
|
|
|
if (0 == map->num_new_daemons) {
|
|
|
|
/* have all the daemons we need - launch app */
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:alps: no new daemons to launch",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2008-02-17 22:29:06 +03:00
|
|
|
goto launch_apps;
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2008-02-17 22:29:06 +03:00
|
|
|
/* need integer value for command line parameter */
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_util_convert_jobid_to_string(&jobid_string, jdata->jobid);
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* start building argv array
|
|
|
|
*/
|
|
|
|
argv = NULL;
|
|
|
|
argc = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ALPS aprun OPTIONS
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* add the aprun command */
|
|
|
|
opal_argv_append(&argc, &argv, "aprun");
|
|
|
|
|
|
|
|
/* Append user defined arguments to aprun */
|
2008-02-28 04:57:57 +03:00
|
|
|
if ( NULL != mca_plm_alps_component.custom_args ) {
|
|
|
|
custom_strings = opal_argv_split(mca_plm_alps_component.custom_args, ' ');
|
2008-02-17 22:29:06 +03:00
|
|
|
num_args = opal_argv_count(custom_strings);
|
|
|
|
for (i = 0; i < num_args; ++i) {
|
|
|
|
opal_argv_append(&argc, &argv, custom_strings[i]);
|
|
|
|
}
|
|
|
|
opal_argv_free(custom_strings);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* number of processors needed */
|
2008-02-28 04:57:57 +03:00
|
|
|
asprintf(&tmp, "-n %lu", (unsigned long) map->num_new_daemons);
|
2008-02-17 22:29:06 +03:00
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
opal_argv_append(&argc, &argv, "-N 1");
|
|
|
|
|
|
|
|
/* create nodelist */
|
|
|
|
nodelist_argv = NULL;
|
|
|
|
nodelist_argc = 0;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
for (nnode=0; nnode < map->num_nodes; nnode++) {
|
2008-02-17 22:29:06 +03:00
|
|
|
/* if the daemon already exists on this node, then
|
|
|
|
* don't include it
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
if (nodes[nnode]->daemon_launched) {
|
2008-02-17 22:29:06 +03:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* otherwise, add it to the list of nodes upon which
|
|
|
|
* we need to launch a daemon
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_argv_append(&nodelist_argc, &nodelist_argv, nodes[nnode]->name);
|
2008-02-17 22:29:06 +03:00
|
|
|
}
|
|
|
|
if (0 == opal_argv_count(nodelist_argv)) {
|
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-plm-alps.txt", "no-hosts-in-list", true);
|
2008-02-17 22:29:06 +03:00
|
|
|
rc = ORTE_ERR_FAILED_TO_START;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
nodelist_flat = opal_argv_join(nodelist_argv, ',');
|
|
|
|
opal_argv_free(nodelist_argv);
|
|
|
|
asprintf(&tmp, "-L %s", nodelist_flat);
|
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ORTED OPTIONS
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* add the daemon command (as specified by user) */
|
Per the July technical meeting:
Standardize the handling of the orte launch agent option across PLMs. This has been a consistent complaint I have received - each PLM would register its own MCA param to get input on the launch agent for remote nodes (in fact, one or two didn't, but most did). This would then get handled in various and contradictory ways.
Some PLMs would accept only a one-word input. Others accepted multi-word args such as "valgrind orted", but then some would error by putting any prefix specified on the cmd line in front of the incorrect argument.
For example, while using the rsh launcher, if you specified "valgrind orted" as your launch agent and had "--prefix foo" on you cmd line, you would attempt to execute "ssh foo/valgrind orted" - which obviously wouldn't work.
This was all -very- confusing to users, who had to know which PLM was being used so they could even set the right mca param in the first place! And since we don't warn about non-recognized or non-used mca params, half of the time they would wind up not doing what they thought they were telling us to do.
To solve this problem, we did the following:
1. removed all mca params from the individual plms for the launch agent
2. added a new mca param "orte_launch_agent" for this purpose. To further simplify for users, this comes with a new cmd line option "--launch-agent" that can take a multi-word string argument. The value of the param defaults to "orted".
3. added a PLM base function that processes the orte_launch_agent value and adds the contents to a provided argv array. This can subsequently be harvested at-will to handle multi-word values
4. modified the PLMs to use this new function. All the PLMs except for the rsh PLM required very minor change - just called the function and moved on. The rsh PLM required much larger changes as - because of the rsh/ssh cmd line limitations - we had to correctly prepend any provided prefix to the correct argv entry.
5. added a new opal_argv_join_range function that allows the caller to "join" argv entries between two specified indices
Please let me know of any problems. I tried to make this as clean as possible, but cannot compile all PLMs to ensure all is correct.
This commit was SVN r19097.
2008-07-30 22:26:24 +04:00
|
|
|
orte_plm_base_setup_orted_cmd(&argc, &argv);
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
/* Add basic orted command line options, including debug flags */
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_plm_base_orted_append_basic_args(&argc, &argv,
|
|
|
|
"alps",
|
|
|
|
&proc_vpid_index,
|
2008-06-03 01:46:34 +04:00
|
|
|
NULL, false);
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
/* tell the new daemons the base of the name list so they can compute
|
|
|
|
* their own name on the other end
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
rc = orte_util_convert_vpid_to_string(&vpid_string, map->daemon_vpid_start);
|
2008-02-17 22:29:06 +03:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_alps: unable to create process name");
|
2008-02-17 22:29:06 +03:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
free(argv[proc_vpid_index]);
|
|
|
|
argv[proc_vpid_index] = strdup(vpid_string);
|
|
|
|
free(vpid_string);
|
2008-02-17 22:29:06 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-02-17 22:29:06 +03:00
|
|
|
param = opal_argv_join(argv, ' ');
|
|
|
|
if (NULL != param) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:alps: final top-level argv:");
|
|
|
|
opal_output(0, "plm:alps: %s", param);
|
2008-02-17 22:29:06 +03:00
|
|
|
free(param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the prefix-directory specified in the
|
|
|
|
corresponding app_context. If there are multiple,
|
|
|
|
different prefix's in the app context, complain (i.e., only
|
|
|
|
allow one --prefix option for the entire alps run -- we
|
|
|
|
don't support different --prefix'es for different nodes in
|
2008-02-28 04:57:57 +03:00
|
|
|
the ALPS plm) */
|
2008-02-17 22:29:06 +03:00
|
|
|
cur_prefix = NULL;
|
2008-02-28 04:57:57 +03:00
|
|
|
for (i=0; i < jdata->num_apps; i++) {
|
|
|
|
char * app_prefix_dir = apps[i]->prefix_dir;
|
2008-02-17 22:29:06 +03:00
|
|
|
/* Check for already set cur_prefix_dir -- if different,
|
|
|
|
complain */
|
|
|
|
if (NULL != app_prefix_dir) {
|
|
|
|
if (NULL != cur_prefix &&
|
|
|
|
0 != strcmp (cur_prefix, app_prefix_dir)) {
|
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-plm-alps.txt", "multiple-prefixes",
|
2008-02-17 22:29:06 +03:00
|
|
|
true, cur_prefix, app_prefix_dir);
|
|
|
|
return ORTE_ERR_FATAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If not yet set, copy it; iff set, then it's the
|
|
|
|
same anyway */
|
|
|
|
if (NULL == cur_prefix) {
|
|
|
|
cur_prefix = strdup(app_prefix_dir);
|
2008-02-28 04:57:57 +03:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output (0, "plm:alps: Set prefix:%s",
|
2008-02-17 22:29:06 +03:00
|
|
|
cur_prefix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup environment */
|
2008-06-24 02:39:36 +04:00
|
|
|
env = opal_argv_copy(orte_launch_environ);
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
/* add the nodelist */
|
|
|
|
var = mca_base_param_environ_variable("orte", "alps", "nodelist");
|
|
|
|
opal_setenv(var, nodelist_flat, true, &env);
|
|
|
|
free(nodelist_flat);
|
|
|
|
free(var);
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (mca_plm_alps_component.timing) {
|
2008-02-17 22:29:06 +03:00
|
|
|
if (0 != gettimeofday(&launchstart, NULL)) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_alps: could not obtain start time");
|
2008-02-17 22:29:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exec the daemon(s) */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = plm_alps_start_proc(argc, argv, env, cur_prefix))) {
|
2008-02-17 22:29:06 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do NOT wait for alps to complete. Alps only completes when the processes
|
|
|
|
* it starts - in this case, the orteds - complete. Instead, we'll catch
|
|
|
|
* any alps failures and deal with them elsewhere
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* wait for daemons to callback */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_daemon_callback(map->num_new_daemons))) {
|
2008-02-17 22:29:06 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
launch_apps:
|
Fix a potential, albeit perhaps esoteric, race condition that can occur for fast HNP's, slow orteds, and fast apps. Under those conditions, it is possible for the orted to be caught in its original send of contact info back to the HNP, and thus for the progress stack never to recover back to a high level. In those circumstances, the orted can "hang" when trying to exit.
Add a new function to opal_progress that tells us our recursion depth to support that solution.
Yes, I know this sounds picky, but good ol' Jeff managed to make it happen by driving his cluster near to death...
Also ensure that we declare "failed" for the daemon job when daemons fail instead of the application job. This is important so that orte knows that it cannot use xcast to tell daemons to "exit", nor should it expect all daemons to respond. Otherwise, it is possible to hang.
After lots of testing, decide to default (again) to slurm detecting failed orteds. This proved necessary to avoid rather annoying hangs that were difficult to recover from. There are conditions where slurm will fail to launch all daemons (slurm folks are working on it), and yet again, good ol' Jeff managed to find both of them.
Thanks you Jeff! :-/
This commit was SVN r18611.
2008-06-06 23:36:27 +04:00
|
|
|
/* if we get here, then daemons launched - change to declaring apps failed */
|
|
|
|
failed_job = active_job;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_launch_apps(active_job))) {
|
2008-02-17 22:29:06 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* declare the launch a success */
|
|
|
|
failed_launch = false;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (mca_plm_alps_component.timing) {
|
2008-02-17 22:29:06 +03:00
|
|
|
if (0 != gettimeofday(&launchstop, NULL)) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_alps: could not obtain stop time");
|
2008-02-17 22:29:06 +03:00
|
|
|
} else {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_alps: daemon block launch time is %ld usec",
|
2008-02-17 22:29:06 +03:00
|
|
|
(launchstop.tv_sec - launchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - launchstart.tv_usec));
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_alps: total job launch time is %ld usec",
|
2008-02-17 22:29:06 +03:00
|
|
|
(launchstop.tv_sec - joblaunchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - joblaunchstart.tv_usec));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:alps: start_procs returned error %d", rc);
|
2008-02-17 22:29:06 +03:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JMS: short we stash the alps pid in the gpr somewhere for cleanup? */
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
if (NULL != argv) {
|
|
|
|
opal_argv_free(argv);
|
|
|
|
}
|
|
|
|
if (NULL != env) {
|
|
|
|
opal_argv_free(env);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(NULL != jobid_string) {
|
|
|
|
free(jobid_string);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for failed launch - if so, force terminate */
|
|
|
|
if (failed_launch) {
|
Fix a potential, albeit perhaps esoteric, race condition that can occur for fast HNP's, slow orteds, and fast apps. Under those conditions, it is possible for the orted to be caught in its original send of contact info back to the HNP, and thus for the progress stack never to recover back to a high level. In those circumstances, the orted can "hang" when trying to exit.
Add a new function to opal_progress that tells us our recursion depth to support that solution.
Yes, I know this sounds picky, but good ol' Jeff managed to make it happen by driving his cluster near to death...
Also ensure that we declare "failed" for the daemon job when daemons fail instead of the application job. This is important so that orte knows that it cannot use xcast to tell daemons to "exit", nor should it expect all daemons to respond. Otherwise, it is possible to hang.
After lots of testing, decide to default (again) to slurm detecting failed orteds. This proved necessary to avoid rather annoying hangs that were difficult to recover from. There are conditions where slurm will fail to launch all daemons (slurm folks are working on it), and yet again, good ol' Jeff managed to find both of them.
Thanks you Jeff! :-/
This commit was SVN r18611.
2008-06-06 23:36:27 +04:00
|
|
|
orte_plm_base_launch_failed(failed_job, -1, ORTE_ERROR_DEFAULT_EXIT_CODE, ORTE_JOB_STATE_FAILED_TO_START);
|
2008-02-17 22:29:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_alps_terminate_job(orte_jobid_t jobid)
|
2008-02-17 22:29:06 +03:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* order them to kill their local procs for this job */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_kill_local_procs(jobid))) {
|
2008-02-17 22:29:06 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Terminate the orteds for a given job
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_alps_terminate_orteds(void)
|
2008-02-17 22:29:06 +03:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* deregister the waitpid callback to ensure we don't make it look like
|
|
|
|
* alps failed when it didn't. Since the alps may have already completed,
|
|
|
|
* do NOT ERROR_LOG any return code to avoid confusing, duplicate error
|
|
|
|
* messages
|
|
|
|
*/
|
|
|
|
orte_wait_cb_cancel(alps_pid);
|
|
|
|
|
|
|
|
/* tell them to die! */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_exit())) {
|
2008-02-17 22:29:06 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signal all the processes in the child alps by sending the signal directly to it
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_alps_signal_job(orte_jobid_t jobid, int32_t signal)
|
2008-02-17 22:29:06 +03:00
|
|
|
{
|
|
|
|
if (0 != alps_pid) {
|
|
|
|
kill(alps_pid, (int)signal);
|
|
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_alps_finalize(void)
|
2008-02-17 22:29:06 +03:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* cleanup any pending recvs */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_stop())) {
|
2008-02-17 22:29:06 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void alps_wait_cb(pid_t pid, int status, void* cbdata){
|
|
|
|
/* According to the ALPS folks, alps always returns the highest exit
|
|
|
|
code of our remote processes. Thus, a non-zero exit status doesn't
|
|
|
|
necessarily mean that alps failed - it could be that an orted returned
|
|
|
|
a non-zero exit status. Of course, that means the orted failed(!), so
|
|
|
|
the end result is the same - the job didn't start.
|
|
|
|
|
|
|
|
As a result, we really can't do much with the exit status itself - it
|
|
|
|
could be something in errno (if alps itself failed), or it could be
|
|
|
|
something returned by an orted, or it could be something returned by
|
|
|
|
the OS (e.g., couldn't find the orted binary). Somebody is welcome
|
|
|
|
to sort out all the options and pretty-print a better error message. For
|
|
|
|
now, though, the only thing that really matters is that
|
|
|
|
alps failed. Report the error and make sure that orterun
|
|
|
|
wakes up - otherwise, do nothing!
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (0 != status) {
|
|
|
|
if (failed_launch) {
|
|
|
|
/* we have a problem during launch */
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "ERROR: alps failed to start the required daemons.");
|
|
|
|
opal_output(0, "ERROR: This could be due to an inability to find the orted binary");
|
|
|
|
opal_output(0, "ERROR: on one or more remote nodes, lack of authority to execute");
|
|
|
|
opal_output(0, "ERROR: on one or more specified nodes, or other factors.");
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
/* report that the daemon has failed so we break out of the daemon
|
|
|
|
* callback receive and exit
|
|
|
|
*/
|
Fix a potential, albeit perhaps esoteric, race condition that can occur for fast HNP's, slow orteds, and fast apps. Under those conditions, it is possible for the orted to be caught in its original send of contact info back to the HNP, and thus for the progress stack never to recover back to a high level. In those circumstances, the orted can "hang" when trying to exit.
Add a new function to opal_progress that tells us our recursion depth to support that solution.
Yes, I know this sounds picky, but good ol' Jeff managed to make it happen by driving his cluster near to death...
Also ensure that we declare "failed" for the daemon job when daemons fail instead of the application job. This is important so that orte knows that it cannot use xcast to tell daemons to "exit", nor should it expect all daemons to respond. Otherwise, it is possible to hang.
After lots of testing, decide to default (again) to slurm detecting failed orteds. This proved necessary to avoid rather annoying hangs that were difficult to recover from. There are conditions where slurm will fail to launch all daemons (slurm folks are working on it), and yet again, good ol' Jeff managed to find both of them.
Thanks you Jeff! :-/
This commit was SVN r18611.
2008-06-06 23:36:27 +04:00
|
|
|
orte_plm_base_launch_failed(ORTE_PROC_MY_NAME->jobid, pid, status, ORTE_JOB_STATE_FAILED_TO_START);
|
2008-02-17 22:29:06 +03:00
|
|
|
|
|
|
|
} else {
|
|
|
|
/* an orted must have died unexpectedly after launch - report
|
|
|
|
* that the daemon has failed so we exit
|
|
|
|
*/
|
Fix a potential, albeit perhaps esoteric, race condition that can occur for fast HNP's, slow orteds, and fast apps. Under those conditions, it is possible for the orted to be caught in its original send of contact info back to the HNP, and thus for the progress stack never to recover back to a high level. In those circumstances, the orted can "hang" when trying to exit.
Add a new function to opal_progress that tells us our recursion depth to support that solution.
Yes, I know this sounds picky, but good ol' Jeff managed to make it happen by driving his cluster near to death...
Also ensure that we declare "failed" for the daemon job when daemons fail instead of the application job. This is important so that orte knows that it cannot use xcast to tell daemons to "exit", nor should it expect all daemons to respond. Otherwise, it is possible to hang.
After lots of testing, decide to default (again) to slurm detecting failed orteds. This proved necessary to avoid rather annoying hangs that were difficult to recover from. There are conditions where slurm will fail to launch all daemons (slurm folks are working on it), and yet again, good ol' Jeff managed to find both of them.
Thanks you Jeff! :-/
This commit was SVN r18611.
2008-06-06 23:36:27 +04:00
|
|
|
orte_plm_base_launch_failed(ORTE_PROC_MY_NAME->jobid, pid, status, ORTE_JOB_STATE_ABORTED);
|
2008-02-17 22:29:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_alps_start_proc(int argc, char **argv, char **env,
|
2008-02-17 22:29:06 +03:00
|
|
|
char *prefix)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
char *exec_argv = opal_path_findv(argv[0], 0, env, NULL);
|
|
|
|
|
|
|
|
if (NULL == exec_argv) {
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
alps_pid = fork();
|
|
|
|
if (-1 == alps_pid) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_CHILDREN);
|
|
|
|
return ORTE_ERR_SYS_LIMITS_CHILDREN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == alps_pid) { /* child */
|
|
|
|
char *bin_base = NULL, *lib_base = NULL;
|
|
|
|
|
|
|
|
/* Figure out the basenames for the libdir and bindir. There
|
2008-02-28 04:57:57 +03:00
|
|
|
is a lengthy comment about this in plm_rsh_module.c
|
2008-02-17 22:29:06 +03:00
|
|
|
explaining all the rationale for how / why we're doing
|
|
|
|
this. */
|
|
|
|
|
|
|
|
lib_base = opal_basename(opal_install_dirs.libdir);
|
|
|
|
bin_base = opal_basename(opal_install_dirs.bindir);
|
|
|
|
|
|
|
|
/* If we have a prefix, then modify the PATH and
|
|
|
|
LD_LIBRARY_PATH environment variables. */
|
|
|
|
if (NULL != prefix) {
|
|
|
|
char *oldenv, *newenv;
|
|
|
|
|
|
|
|
/* Reset PATH */
|
|
|
|
oldenv = getenv("PATH");
|
|
|
|
if (NULL != oldenv) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, bin_base, oldenv);
|
|
|
|
} else {
|
|
|
|
asprintf(&newenv, "%s/%s", prefix, bin_base);
|
|
|
|
}
|
|
|
|
opal_setenv("PATH", newenv, true, &env);
|
2008-02-28 04:57:57 +03:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:alps: reset PATH: %s", newenv);
|
2008-02-17 22:29:06 +03:00
|
|
|
}
|
|
|
|
free(newenv);
|
|
|
|
|
|
|
|
/* Reset LD_LIBRARY_PATH */
|
|
|
|
oldenv = getenv("LD_LIBRARY_PATH");
|
|
|
|
if (NULL != oldenv) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, lib_base, oldenv);
|
|
|
|
} else {
|
|
|
|
asprintf(&newenv, "%s/%s", prefix, lib_base);
|
|
|
|
}
|
|
|
|
opal_setenv("LD_LIBRARY_PATH", newenv, true, &env);
|
2008-02-28 04:57:57 +03:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:alps: reset LD_LIBRARY_PATH: %s",
|
2008-02-17 22:29:06 +03:00
|
|
|
newenv);
|
|
|
|
}
|
|
|
|
free(newenv);
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = open("/dev/null", O_CREAT|O_WRONLY|O_TRUNC, 0666);
|
|
|
|
if(fd > 0) {
|
|
|
|
dup2(fd, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* When not in debug mode and --debug-daemons was not passed,
|
|
|
|
* tie stdout/stderr to dev null so we don't see messages from orted */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (0 == mca_plm_alps_component.debug && !orte_debug_daemons_flag) {
|
2008-02-17 22:29:06 +03:00
|
|
|
if (fd >= 0) {
|
|
|
|
if (fd != 1) {
|
|
|
|
dup2(fd,1);
|
|
|
|
}
|
|
|
|
if (fd != 2) {
|
|
|
|
dup2(fd,2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fd > 2) {
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the alps process out of orterun's process group so that
|
|
|
|
signals sent from the shell (like those resulting from
|
|
|
|
cntl-c) don't get sent to alps */
|
|
|
|
setpgid(0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
execve(exec_argv, argv, env);
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:alps:start_proc: exec failed");
|
2008-02-17 22:29:06 +03:00
|
|
|
/* don't return - need to exit - returning would be bad -
|
|
|
|
we're not in the calling process anymore */
|
|
|
|
exit(1);
|
|
|
|
} else { /* parent */
|
|
|
|
/* just in case, make sure that the alps process is not in our
|
|
|
|
process group any more. Stevens says always do this on both
|
|
|
|
sides of the fork... */
|
|
|
|
setpgid(alps_pid, alps_pid);
|
|
|
|
|
|
|
|
/* setup the waitpid so we can find out if alps succeeds! */
|
|
|
|
orte_wait_cb(alps_pid, alps_wait_cb, NULL);
|
|
|
|
free(exec_argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|