2007-07-10 12:43:05 +00: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 01:57:57 +00:00
|
|
|
#include "orte/constants.h"
|
|
|
|
#include "orte/types.h"
|
2007-07-10 12:43:05 +00: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
|
|
|
|
|
2007-07-12 14:22:47 +00:00
|
|
|
#define SR1_PJOBS
|
|
|
|
#include <lsf/lsbatch.h>
|
|
|
|
|
2007-07-10 12:43:05 +00:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
|
|
|
#include "opal/util/argv.h"
|
2008-06-09 14:53:58 +00:00
|
|
|
#include "orte/util/show_help.h"
|
2007-07-10 12:43:05 +00: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"
|
|
|
|
|
|
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
#include "orte/runtime/orte_wakeup.h"
|
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
#include "orte/mca/rml/rml.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/mca/plm/plm.h"
|
|
|
|
#include "orte/mca/plm/base/base.h"
|
|
|
|
#include "orte/mca/plm/base/plm_private.h"
|
|
|
|
#include "plm_lsf.h"
|
2007-07-10 12:43:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_lsf_init(void);
|
|
|
|
static int plm_lsf_launch_job(orte_job_t *jdata);
|
|
|
|
static int plm_lsf_terminate_job(orte_jobid_t jobid);
|
|
|
|
static int plm_lsf_terminate_orteds(void);
|
|
|
|
static int plm_lsf_signal_job(orte_jobid_t jobid, int32_t signal);
|
|
|
|
static int plm_lsf_finalize(void);
|
2007-07-10 12:43:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_plm_base_module_1_3_0_t orte_plm_lsf_module = {
|
|
|
|
plm_lsf_init,
|
|
|
|
orte_plm_base_set_hnp_name,
|
|
|
|
plm_lsf_launch_job,
|
2008-04-14 19:36:13 +00:00
|
|
|
NULL,
|
2008-02-28 01:57:57 +00:00
|
|
|
plm_lsf_terminate_job,
|
|
|
|
plm_lsf_terminate_orteds,
|
|
|
|
plm_lsf_signal_job,
|
|
|
|
plm_lsf_finalize
|
2007-07-10 12:43:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables
|
|
|
|
*/
|
|
|
|
static orte_jobid_t active_job = ORTE_JOBID_INVALID;
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
/**
|
|
|
|
* Init the module
|
|
|
|
*/
|
|
|
|
int plm_lsf_init(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_start())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
2007-07-10 12:43:05 +00: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 01:57:57 +00:00
|
|
|
static int plm_lsf_launch_job(orte_job_t *jdata)
|
2007-07-10 12:43:05 +00:00
|
|
|
{
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_job_map_t *map;
|
2007-07-10 12:43:05 +00:00
|
|
|
size_t num_nodes;
|
|
|
|
char *param;
|
|
|
|
char **argv = NULL;
|
|
|
|
int argc;
|
|
|
|
int rc;
|
|
|
|
char** env = NULL;
|
|
|
|
char* var;
|
|
|
|
char **nodelist_argv;
|
|
|
|
int nodelist_argc;
|
2008-02-28 01:57:57 +00:00
|
|
|
char *vpid_string;
|
2007-07-13 11:57:17 +00:00
|
|
|
int i;
|
2007-07-10 12:43:05 +00:00
|
|
|
char *cur_prefix;
|
|
|
|
struct timeval joblaunchstart, launchstart, launchstop;
|
2008-02-28 01:57:57 +00:00
|
|
|
int proc_vpid_index = 0;
|
2007-07-10 12:43:05 +00:00
|
|
|
bool failed_launch = true;
|
2008-02-28 01:57:57 +00:00
|
|
|
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 19:36:27 +00:00
|
|
|
orte_jobid_t failed_job;
|
2008-02-28 01:57:57 +00:00
|
|
|
|
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 19:36:27 +00:00
|
|
|
/* default to declaring the daemons failed*/
|
|
|
|
failed_job = ORTE_PROC_MY_NAME->jobid;
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
if (mca_plm_lsf_component.timing) {
|
2007-07-10 12:43:05 +00:00
|
|
|
if (0 != gettimeofday(&joblaunchstart, NULL)) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_lsf: could not obtain job start time");
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
/* create a jobid for this job */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_create_jobid(&jdata->jobid))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2007-07-10 12:43:05 +00:00
|
|
|
|
2008-06-09 14:53:58 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:lsf: 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))) {
|
2007-07-10 12:43:05 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
/* save the active jobid */
|
2008-03-05 04:54:57 +00:00
|
|
|
active_job = jdata->jobid;
|
2007-07-23 18:38:36 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
/* 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;
|
2007-07-23 18:38:36 +00:00
|
|
|
|
2007-07-10 12:43:05 +00:00
|
|
|
num_nodes = map->num_new_daemons;
|
|
|
|
if (num_nodes == 0) {
|
2008-02-28 01:57:57 +00:00
|
|
|
/* have all the daemons we need - launch app */
|
2008-06-09 14:53:58 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:lsf: no new daemons to launch",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2007-07-20 19:49:27 +00:00
|
|
|
goto launch_apps;
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* create nodelist */
|
|
|
|
nodelist_argv = NULL;
|
|
|
|
nodelist_argc = 0;
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
for (nnode=0; nnode < map->num_nodes; nnode++) {
|
2007-07-10 12:43:05 +00:00
|
|
|
/* if the daemon already exists on this node, then
|
|
|
|
* don't include it
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
if (nodes[nnode]->daemon_launched) {
|
2007-07-10 12:43:05 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* otherwise, add it to the list of nodes upon which
|
|
|
|
* we need to launch a daemon
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
opal_argv_append(&nodelist_argc, &nodelist_argv, nodes[nnode]->name);
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* start building argv array
|
|
|
|
*/
|
|
|
|
argv = NULL;
|
|
|
|
argc = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ORTED OPTIONS
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* add the daemon command (as specified by user) */
|
2008-02-28 01:57:57 +00:00
|
|
|
opal_argv_append(&argc, &argv, mca_plm_lsf_component.orted);
|
2007-07-10 12:43:05 +00:00
|
|
|
|
|
|
|
/* Add basic orted command line options */
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_plm_base_orted_append_basic_args(&argc, &argv,
|
|
|
|
"lsf",
|
|
|
|
&proc_vpid_index,
|
2008-06-02 21:46:34 +00:00
|
|
|
NULL, false);
|
2007-07-10 12:43:05 +00: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 01:57:57 +00:00
|
|
|
rc = orte_util_convert_vpid_to_string(&vpid_string, map->daemon_vpid_start);
|
2007-07-10 12:43:05 +00:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_lsf: unable to get daemon vpid as string");
|
2007-07-10 12:43:05 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2008-02-28 01:57:57 +00:00
|
|
|
free(argv[proc_vpid_index]);
|
|
|
|
argv[proc_vpid_index] = strdup(vpid_string);
|
|
|
|
free(vpid_string);
|
2007-07-10 12:43:05 +00:00
|
|
|
|
2008-06-09 14:53:58 +00:00
|
|
|
if (0 < opal_output_get_verbosity(orte_plm_globals.output)) {
|
2007-07-10 12:43:05 +00:00
|
|
|
param = opal_argv_join(argv, ' ');
|
|
|
|
if (NULL != param) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm:lsf: final top-level argv:");
|
|
|
|
opal_output(0, "plm:lsf: %s", param);
|
2007-07-10 12:43:05 +00: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 slurm run -- we
|
|
|
|
don't support different --prefix'es for different nodes in
|
2008-02-28 01:57:57 +00:00
|
|
|
the SLURM plm) */
|
2007-07-10 12:43:05 +00:00
|
|
|
cur_prefix = NULL;
|
|
|
|
for (i=0; i < map->num_apps; i++) {
|
|
|
|
char * app_prefix_dir = map->apps[i]->prefix_dir;
|
|
|
|
/* 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-13 20:00:55 +00:00
|
|
|
orte_show_help("help-plm-lsf.txt", "multiple-prefixes",
|
2007-07-10 12:43:05 +00:00
|
|
|
true, cur_prefix, app_prefix_dir);
|
2008-02-28 01:57:57 +00:00
|
|
|
rc = ORTE_ERR_FAILED_TO_START;
|
|
|
|
goto cleanup;
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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-06-09 14:53:58 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:lsf: Set prefix:%s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), cur_prefix));
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup environment */
|
2008-06-23 22:39:36 +00:00
|
|
|
env = opal_argv_copy(orte_launch_environ);
|
2007-07-10 12:43:05 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
if (mca_plm_lsf_component.timing) {
|
2007-07-10 12:43:05 +00:00
|
|
|
if (0 != gettimeofday(&launchstart, NULL)) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_lsf: could not obtain start time");
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-12 14:41:09 +00:00
|
|
|
/* exec the daemon(s). Do NOT wait for lsb_launch to complete as
|
|
|
|
* it only completes when the processes it starts - in this case,
|
|
|
|
* the orteds - complete. We need to go ahead and return so
|
|
|
|
* orterun can do the rest of its stuff. Instead, we'll catch any
|
|
|
|
* failures and deal with them elsewhere
|
2007-07-10 12:43:05 +00:00
|
|
|
*/
|
2007-07-13 11:57:17 +00:00
|
|
|
if (lsb_launch(nodelist_argv, argv, LSF_DJOB_NOWAIT, env) < 0) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_FAILED_TO_START);
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "lsb_launch failed: %d", rc);
|
2007-07-13 11:57:17 +00:00
|
|
|
rc = ORTE_ERR_FAILED_TO_START;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2007-07-20 19:49:27 +00:00
|
|
|
|
|
|
|
/* wait for daemons to callback */
|
|
|
|
if (ORTE_SUCCESS !=
|
2008-02-28 01:57:57 +00:00
|
|
|
(rc = orte_plm_base_daemon_callback(map->num_new_daemons))) {
|
2007-07-20 19:49:27 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2007-07-13 11:57:17 +00:00
|
|
|
|
2007-07-20 19:49:27 +00:00
|
|
|
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 19:36:27 +00:00
|
|
|
/* daemons succeeded - any failure now would be from apps */
|
|
|
|
failed_job = active_job;
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_launch_apps(active_job))) {
|
2007-07-20 19:49:27 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
2007-07-10 12:43:05 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* declare the launch a success */
|
|
|
|
failed_launch = false;
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
if (mca_plm_lsf_component.timing) {
|
2007-07-10 12:43:05 +00:00
|
|
|
if (0 != gettimeofday(&launchstop, NULL)) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_lsf: could not obtain stop time");
|
2007-07-10 12:43:05 +00:00
|
|
|
} else {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_lsf: daemon block launch time is %ld usec",
|
2007-07-10 12:43:05 +00:00
|
|
|
(launchstop.tv_sec - launchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - launchstart.tv_usec));
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_lsf: total job launch time is %ld usec",
|
2007-07-10 12:43:05 +00:00
|
|
|
(launchstop.tv_sec - joblaunchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - joblaunchstart.tv_usec));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm:lsf: start_procs returned error %d", rc);
|
2007-07-10 12:43:05 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
if (NULL != map) {
|
|
|
|
OBJ_RELEASE(map);
|
|
|
|
}
|
|
|
|
if (NULL != argv) {
|
|
|
|
opal_argv_free(argv);
|
|
|
|
}
|
|
|
|
if (NULL != env) {
|
|
|
|
opal_argv_free(env);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 19:36:27 +00:00
|
|
|
orte_plm_base_launch_failed(failed_job, -1, ORTE_ERROR_DEFAULT_EXIT_CODE, ORTE_JOB_STATE_FAILED_TO_START);
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
2007-07-20 19:49:27 +00:00
|
|
|
|
2007-07-10 12:43:05 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_lsf_terminate_job(orte_jobid_t jobid)
|
2007-07-10 12:43:05 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* order them to kill their local procs for this job */
|
2007-07-13 11:57:17 +00:00
|
|
|
if (ORTE_SUCCESS !=
|
2008-02-28 01:57:57 +00:00
|
|
|
(rc = orte_plm_base_orted_kill_local_procs(jobid))) {
|
2007-07-10 12:43:05 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Terminate the orteds for a given job
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_lsf_terminate_orteds(void)
|
2007-07-10 12:43:05 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* tell them to die! */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_exit())) {
|
2007-07-10 12:43:05 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-02-28 01:57:57 +00:00
|
|
|
* Signal all the processes in the job
|
2007-07-10 12:43:05 +00:00
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_lsf_signal_job(orte_jobid_t jobid, int32_t signal)
|
2007-07-10 12:43:05 +00:00
|
|
|
{
|
2007-09-13 18:09:14 +00:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* order the orteds to pass this signal to their local procs */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_signal_local_procs(jobid, signal))) {
|
2007-09-13 18:09:14 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
return rc;
|
2007-07-10 12:43:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_lsf_finalize(void)
|
2007-07-10 12:43:05 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* cleanup any pending recvs */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_stop())) {
|
2007-07-10 12:43:05 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|