2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2007-03-29 04:50:56 +04:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 07:32:36 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2006-06-08 22:27:17 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2005-03-14 23:57:21 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-01-22 18:50:35 +03:00
|
|
|
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
|
2007-06-05 07:03:59 +04:00
|
|
|
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
2006-06-08 22:27:17 +04:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* Additional copyrights may follow
|
2006-06-08 22:27:17 +04:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* $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.
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
|
|
|
#include "orte/types.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
#include <sys/types.h>
|
2006-02-17 18:06:08 +03:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-08-25 20:38:42 +04:00
|
|
|
#include <unistd.h>
|
2006-02-17 18:06:08 +03:00
|
|
|
#endif
|
2005-08-25 20:38:42 +04:00
|
|
|
#include <signal.h>
|
2006-02-17 18:06:08 +03:00
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
2006-02-17 18:06:08 +03:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2007-04-21 04:15:05 +04:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "opal/util/argv.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "opal/util/opal_environ.h"
|
2005-08-25 20:38:42 +04:00
|
|
|
#include "opal/util/path.h"
|
2006-05-16 18:14:12 +04:00
|
|
|
#include "opal/util/basename.h"
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "orte/runtime/runtime.h"
|
2007-04-25 01:39:12 +04:00
|
|
|
#include "orte/runtime/orte_wait.h"
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2006-10-07 19:45:24 +04:00
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/plm/plm.h"
|
|
|
|
#include "orte/mca/plm/base/plm_private.h"
|
|
|
|
#include "plm_slurm.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_slurm_init(void);
|
|
|
|
static int plm_slurm_launch_job(orte_job_t *jdata);
|
|
|
|
static int plm_slurm_terminate_job(orte_jobid_t jobid);
|
|
|
|
static int plm_slurm_terminate_orteds(void);
|
|
|
|
static int plm_slurm_signal_job(orte_jobid_t jobid, int32_t signal);
|
|
|
|
static int plm_slurm_finalize(void);
|
|
|
|
|
|
|
|
static int plm_slurm_start_proc(int argc, char **argv, char **env,
|
2005-10-01 01:44:05 +04:00
|
|
|
char *prefix);
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_plm_base_module_1_0_0_t orte_plm_slurm_module = {
|
|
|
|
plm_slurm_init,
|
|
|
|
orte_plm_base_set_hnp_name,
|
|
|
|
plm_slurm_launch_job,
|
2008-04-14 22:26:08 +04:00
|
|
|
NULL,
|
2008-02-28 04:57:57 +03:00
|
|
|
plm_slurm_terminate_job,
|
|
|
|
plm_slurm_terminate_orteds,
|
|
|
|
plm_slurm_signal_job,
|
|
|
|
plm_slurm_finalize
|
2005-03-14 23:57:21 +03:00
|
|
|
};
|
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/*
|
2007-04-25 00:53:54 +04:00
|
|
|
* Local variables
|
2005-08-25 20:38:42 +04:00
|
|
|
*/
|
2009-03-03 19:39:13 +03:00
|
|
|
static pid_t primary_srun_pid = 0;
|
|
|
|
static bool primary_pid_set = false;
|
2007-04-25 00:53:54 +04:00
|
|
|
static orte_jobid_t active_job = ORTE_JOBID_INVALID;
|
2009-03-03 19:39:13 +03:00
|
|
|
static bool launching_daemons;
|
2009-02-09 23:44:44 +03:00
|
|
|
static bool local_launch_available = false;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/**
|
|
|
|
* Init the module
|
|
|
|
*/
|
|
|
|
static int plm_slurm_init(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_start())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
2009-02-09 23:44:44 +03:00
|
|
|
|
|
|
|
if (ORTE_SUCCESS == orte_plm_base_rsh_launch_agent_setup()) {
|
|
|
|
local_launch_available = true;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2007-04-25 00:53:54 +04: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_slurm_launch_job(orte_job_t *jdata)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_app_context_t **apps;
|
|
|
|
orte_node_t **nodes;
|
|
|
|
orte_std_cntr_t n;
|
|
|
|
orte_job_map_t *map;
|
2007-03-29 04:50:56 +04:00
|
|
|
char *jobid_string = NULL;
|
2007-04-10 18:23:32 +04:00
|
|
|
char *param;
|
2007-04-25 00:53:54 +04:00
|
|
|
char **argv = NULL;
|
2005-08-25 02:19:48 +04:00
|
|
|
int argc;
|
|
|
|
int rc;
|
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
|
|
|
char *tmp;
|
2007-03-29 04:50:56 +04:00
|
|
|
char** env = NULL;
|
2005-08-25 20:38:42 +04:00
|
|
|
char* var;
|
2005-08-26 02:29:23 +04:00
|
|
|
char *nodelist_flat;
|
|
|
|
char **nodelist_argv;
|
|
|
|
int nodelist_argc;
|
|
|
|
char *name_string;
|
2005-09-07 01:52:28 +04:00
|
|
|
char **custom_strings;
|
2005-10-01 01:44:05 +04:00
|
|
|
int num_args, i;
|
|
|
|
char *cur_prefix;
|
2008-02-28 04:57:57 +03:00
|
|
|
struct timeval launchstart, launchstop;
|
|
|
|
int proc_vpid_index;
|
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;
|
2009-03-03 19:39:13 +03:00
|
|
|
bool failed_launch=true;
|
|
|
|
|
2009-02-09 23:44:44 +03:00
|
|
|
if (jdata->controls & ORTE_JOB_CONTROL_LOCAL_SLAVE) {
|
|
|
|
/* if this is a request to launch a local slave,
|
|
|
|
* then we will not be launching an orted - we will
|
|
|
|
* directly ssh the slave process itself. No mapping
|
|
|
|
* is performed to support this - the caller must
|
|
|
|
* provide all the info required to launch the job,
|
|
|
|
* including the target hosts
|
|
|
|
*/
|
|
|
|
if (!local_launch_available) {
|
|
|
|
/* if we can't support this, then abort */
|
|
|
|
orte_show_help("help-plm-slurm.txt", "no-local-slave-support", true);
|
|
|
|
return ORTE_ERR_FAILED_TO_START;
|
|
|
|
}
|
|
|
|
return orte_plm_base_local_slave_launch(jdata);
|
|
|
|
}
|
|
|
|
|
2009-01-08 17:27:52 +03:00
|
|
|
/* if we are timing, record the start time */
|
|
|
|
if (orte_timing) {
|
|
|
|
gettimeofday(&orte_plm_globals.daemonlaunchstart, NULL);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* flag the daemons as failing by default */
|
|
|
|
failed_job = ORTE_PROC_MY_NAME->jobid;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
if (orte_timing) {
|
|
|
|
if (0 != gettimeofday(&launchstart, NULL)) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_slurm: could not obtain job start time");
|
2008-02-28 04:57:57 +03:00
|
|
|
launchstart.tv_sec = 0;
|
|
|
|
launchstart.tv_usec = 0;
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-13 00:53:50 +04:00
|
|
|
/* indicate the state of the launch */
|
2009-03-03 19:39:13 +03:00
|
|
|
launching_daemons = true;
|
2007-09-13 00:53:50 +04:00
|
|
|
|
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))) {
|
2006-11-16 18:11:45 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
2007-04-25 00:53:54 +04:00
|
|
|
goto cleanup;
|
2005-08-25 02:19:48 +04:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
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:slurm: launching job %s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME),
|
|
|
|
orte_util_print_jobids(jdata->jobid)));
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* setup the job */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_setup_job(jdata))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the active jobid */
|
|
|
|
active_job = jdata->jobid;
|
2006-11-16 18:11:45 +03:00
|
|
|
|
2008-02-28 04:57:57 +03: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;
|
|
|
|
|
|
|
|
if (0 == map->num_new_daemons) {
|
2007-07-12 23:53:18 +04:00
|
|
|
/* no new daemons required - just launch apps */
|
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:slurm: no new daemons to launch",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME)));
|
2007-07-12 23:53:18 +04:00
|
|
|
goto launch_apps;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
Bring in the generalized xcast communication system along with the correspondingly revised orted launch. I will send a message out to developers explaining the basic changes. In brief:
1. generalize orte_rml.xcast to become a general broadcast-like messaging system. Messages can now be sent to any tag on the daemons or processes. Note that any message sent via xcast will be delivered to ALL processes in the specified job - you don't get to pick and choose. At a later date, we will introduce an augmented capability that will use the daemons as relays, but will allow you to send to a specified array of process names.
2. extended orte_rml.xcast so it supports more scalable message routing methodologies. At the moment, we support three: (a) direct, which sends the message directly to all recipients; (b) linear, which sends the message to the local daemon on each node, which then relays it to its own local procs; and (b) binomial, which sends the message via a binomial algo across all the daemons, each of which then relays to its own local procs. The crossover points between the algos are adjustable via MCA param, or you can simply demand that a specific algo be used.
3. orteds no longer exhibit two types of behavior: bootproxy or VM. Orteds now always behave like they are part of a virtual machine - they simply launch a job if mpirun tells them to do so. This is another step towards creating an "orteboot" functionality, but also provided a clean system for supporting message relaying.
Note one major impact of this commit: multiple daemons on a node cannot be supported any longer! Only a single daemon/node is now allowed.
This commit is known to break support for the following environments: POE, Xgrid, Xcpu, Windows. It has been tested on rsh, SLURM, and Bproc. Modifications for TM support have been made but could not be verified due to machine problems at LANL. Modifications for SGE have been made but could not be verified. The developers for the non-verified environments will be separately notified along with suggestions on how to fix the problems.
This commit was SVN r15007.
2007-06-12 17:28:54 +04:00
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
/* need integer value for command line parameter */
|
2008-02-28 04:57:57 +03:00
|
|
|
asprintf(&jobid_string, "%lu", (unsigned long) jdata->jobid);
|
2005-08-25 02:19:48 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* start building argv array
|
|
|
|
*/
|
|
|
|
argv = NULL;
|
|
|
|
argc = 0;
|
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
/*
|
|
|
|
* SLURM srun OPTIONS
|
|
|
|
*/
|
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/* add the srun command */
|
|
|
|
opal_argv_append(&argc, &argv, "srun");
|
|
|
|
|
2005-09-07 01:52:28 +04:00
|
|
|
/* Append user defined arguments to srun */
|
2008-02-28 04:57:57 +03:00
|
|
|
if ( NULL != mca_plm_slurm_component.custom_args ) {
|
|
|
|
custom_strings = opal_argv_split(mca_plm_slurm_component.custom_args, ' ');
|
2005-09-07 01:52:28 +04: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);
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
asprintf(&tmp, "--nodes=%lu", (unsigned long) map->num_new_daemons);
|
2005-08-26 02:29:23 +04:00
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
asprintf(&tmp, "--ntasks=%lu", (unsigned long) map->num_new_daemons);
|
2005-08-25 20:38:42 +04:00
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
|
2008-05-29 16:26:58 +04:00
|
|
|
/* alert us if any orteds die during startup */
|
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
|
|
|
opal_argv_append(&argc, &argv, "--kill-on-bad-exit");
|
2008-05-29 16:26:58 +04:00
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
/* create nodelist */
|
|
|
|
nodelist_argv = NULL;
|
|
|
|
nodelist_argc = 0;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
for (n=0; n < map->num_nodes; n++ ) {
|
Bring in the generalized xcast communication system along with the correspondingly revised orted launch. I will send a message out to developers explaining the basic changes. In brief:
1. generalize orte_rml.xcast to become a general broadcast-like messaging system. Messages can now be sent to any tag on the daemons or processes. Note that any message sent via xcast will be delivered to ALL processes in the specified job - you don't get to pick and choose. At a later date, we will introduce an augmented capability that will use the daemons as relays, but will allow you to send to a specified array of process names.
2. extended orte_rml.xcast so it supports more scalable message routing methodologies. At the moment, we support three: (a) direct, which sends the message directly to all recipients; (b) linear, which sends the message to the local daemon on each node, which then relays it to its own local procs; and (b) binomial, which sends the message via a binomial algo across all the daemons, each of which then relays to its own local procs. The crossover points between the algos are adjustable via MCA param, or you can simply demand that a specific algo be used.
3. orteds no longer exhibit two types of behavior: bootproxy or VM. Orteds now always behave like they are part of a virtual machine - they simply launch a job if mpirun tells them to do so. This is another step towards creating an "orteboot" functionality, but also provided a clean system for supporting message relaying.
Note one major impact of this commit: multiple daemons on a node cannot be supported any longer! Only a single daemon/node is now allowed.
This commit is known to break support for the following environments: POE, Xgrid, Xcpu, Windows. It has been tested on rsh, SLURM, and Bproc. Modifications for TM support have been made but could not be verified due to machine problems at LANL. Modifications for SGE have been made but could not be verified. The developers for the non-verified environments will be separately notified along with suggestions on how to fix the problems.
This commit was SVN r15007.
2007-06-12 17:28:54 +04:00
|
|
|
/* if the daemon already exists on this node, then
|
|
|
|
* don't include it
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
if (nodes[n]->daemon_launched) {
|
Bring in the generalized xcast communication system along with the correspondingly revised orted launch. I will send a message out to developers explaining the basic changes. In brief:
1. generalize orte_rml.xcast to become a general broadcast-like messaging system. Messages can now be sent to any tag on the daemons or processes. Note that any message sent via xcast will be delivered to ALL processes in the specified job - you don't get to pick and choose. At a later date, we will introduce an augmented capability that will use the daemons as relays, but will allow you to send to a specified array of process names.
2. extended orte_rml.xcast so it supports more scalable message routing methodologies. At the moment, we support three: (a) direct, which sends the message directly to all recipients; (b) linear, which sends the message to the local daemon on each node, which then relays it to its own local procs; and (b) binomial, which sends the message via a binomial algo across all the daemons, each of which then relays to its own local procs. The crossover points between the algos are adjustable via MCA param, or you can simply demand that a specific algo be used.
3. orteds no longer exhibit two types of behavior: bootproxy or VM. Orteds now always behave like they are part of a virtual machine - they simply launch a job if mpirun tells them to do so. This is another step towards creating an "orteboot" functionality, but also provided a clean system for supporting message relaying.
Note one major impact of this commit: multiple daemons on a node cannot be supported any longer! Only a single daemon/node is now allowed.
This commit is known to break support for the following environments: POE, Xgrid, Xcpu, Windows. It has been tested on rsh, SLURM, and Bproc. Modifications for TM support have been made but could not be verified due to machine problems at LANL. Modifications for SGE have been made but could not be verified. The developers for the non-verified environments will be separately notified along with suggestions on how to fix the problems.
This commit was SVN r15007.
2007-06-12 17:28:54 +04: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[n]->name);
|
2005-08-26 02:29:23 +04:00
|
|
|
}
|
2007-07-12 23:53:18 +04: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-slurm.txt", "no-hosts-in-list", true);
|
2007-07-12 23:53:18 +04:00
|
|
|
rc = ORTE_ERR_FAILED_TO_START;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2005-08-26 02:29:23 +04:00
|
|
|
nodelist_flat = opal_argv_join(nodelist_argv, ',');
|
2007-03-29 04:50:56 +04:00
|
|
|
opal_argv_free(nodelist_argv);
|
2005-08-26 02:29:23 +04:00
|
|
|
asprintf(&tmp, "--nodelist=%s", nodelist_flat);
|
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_plm_globals.output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:slurm: launching on nodes %s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME), nodelist_flat));
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
/*
|
|
|
|
* ORTED OPTIONS
|
|
|
|
*/
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
/* 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);
|
2007-07-12 23:53:18 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* Add basic orted command line options, including debug flags */
|
|
|
|
orte_plm_base_orted_append_basic_args(&argc, &argv,
|
|
|
|
"slurm",
|
|
|
|
&proc_vpid_index,
|
2008-09-08 19:45:11 +04:00
|
|
|
false);
|
2005-08-26 02:29:23 +04:00
|
|
|
|
Bring in the generalized xcast communication system along with the correspondingly revised orted launch. I will send a message out to developers explaining the basic changes. In brief:
1. generalize orte_rml.xcast to become a general broadcast-like messaging system. Messages can now be sent to any tag on the daemons or processes. Note that any message sent via xcast will be delivered to ALL processes in the specified job - you don't get to pick and choose. At a later date, we will introduce an augmented capability that will use the daemons as relays, but will allow you to send to a specified array of process names.
2. extended orte_rml.xcast so it supports more scalable message routing methodologies. At the moment, we support three: (a) direct, which sends the message directly to all recipients; (b) linear, which sends the message to the local daemon on each node, which then relays it to its own local procs; and (b) binomial, which sends the message via a binomial algo across all the daemons, each of which then relays to its own local procs. The crossover points between the algos are adjustable via MCA param, or you can simply demand that a specific algo be used.
3. orteds no longer exhibit two types of behavior: bootproxy or VM. Orteds now always behave like they are part of a virtual machine - they simply launch a job if mpirun tells them to do so. This is another step towards creating an "orteboot" functionality, but also provided a clean system for supporting message relaying.
Note one major impact of this commit: multiple daemons on a node cannot be supported any longer! Only a single daemon/node is now allowed.
This commit is known to break support for the following environments: POE, Xgrid, Xcpu, Windows. It has been tested on rsh, SLURM, and Bproc. Modifications for TM support have been made but could not be verified due to machine problems at LANL. Modifications for SGE have been made but could not be verified. The developers for the non-verified environments will be separately notified along with suggestions on how to fix the problems.
This commit was SVN r15007.
2007-06-12 17:28:54 +04: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(&name_string, map->daemon_vpid_start);
|
2005-08-26 02:29:23 +04:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_slurm: unable to get daemon vpid as string");
|
2005-08-26 02:29:23 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2007-03-30 17:43:50 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
free(argv[proc_vpid_index]);
|
|
|
|
argv[proc_vpid_index] = strdup(name_string);
|
2005-08-26 02:29:23 +04:00
|
|
|
free(name_string);
|
2005-08-25 02:19:48 +04:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
if (0 < opal_output_get_verbosity(orte_plm_globals.output)) {
|
2005-08-25 02:19:48 +04:00
|
|
|
param = opal_argv_join(argv, ' ');
|
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:slurm: final top-level argv:\n\t%s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
(NULL == param) ? "NULL" : param));
|
|
|
|
if (NULL != param) free(param);
|
2005-08-25 02:19:48 +04:00
|
|
|
}
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* 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 04:57:57 +03:00
|
|
|
the SLURM plm) */
|
2005-10-01 01:44:05 +04:00
|
|
|
cur_prefix = NULL;
|
2008-02-28 04:57:57 +03:00
|
|
|
for (n=0; n < jdata->num_apps; n++) {
|
|
|
|
char * app_prefix_dir = apps[n]->prefix_dir;
|
2006-10-07 19:45:24 +04: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-slurm.txt", "multiple-prefixes",
|
2006-10-07 19:45:24 +04:00
|
|
|
true, cur_prefix, app_prefix_dir);
|
|
|
|
return ORTE_ERR_FATAL;
|
|
|
|
}
|
2005-10-01 01:44:05 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* If not yet set, copy it; iff set, then it's the
|
2009-02-09 23:44:44 +03:00
|
|
|
* same anyway
|
|
|
|
*/
|
2006-10-07 19:45:24 +04:00
|
|
|
if (NULL == cur_prefix) {
|
|
|
|
cur_prefix = strdup(app_prefix_dir);
|
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:slurm: Set prefix:%s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
cur_prefix));
|
2005-10-01 01:44:05 +04:00
|
|
|
}
|
|
|
|
}
|
2006-10-07 19:45:24 +04:00
|
|
|
}
|
2005-08-25 02:19:48 +04:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/* setup environment */
|
2008-06-24 02:39:36 +04:00
|
|
|
env = opal_argv_copy(orte_launch_environ);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2007-07-12 23:53:18 +04:00
|
|
|
/* add the nodelist */
|
2006-11-17 23:51:03 +03:00
|
|
|
var = mca_base_param_environ_variable("orte", "slurm", "nodelist");
|
|
|
|
opal_setenv(var, nodelist_flat, true, &env);
|
|
|
|
free(nodelist_flat);
|
2007-03-30 17:43:50 +04:00
|
|
|
free(var);
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2009-02-09 23:44:44 +03:00
|
|
|
/* enable local launch by the orteds */
|
|
|
|
var = mca_base_param_environ_variable("plm", NULL, NULL);
|
|
|
|
opal_setenv(var, "rsh", true, &env);
|
|
|
|
free(var);
|
|
|
|
|
Bring in the generalized xcast communication system along with the correspondingly revised orted launch. I will send a message out to developers explaining the basic changes. In brief:
1. generalize orte_rml.xcast to become a general broadcast-like messaging system. Messages can now be sent to any tag on the daemons or processes. Note that any message sent via xcast will be delivered to ALL processes in the specified job - you don't get to pick and choose. At a later date, we will introduce an augmented capability that will use the daemons as relays, but will allow you to send to a specified array of process names.
2. extended orte_rml.xcast so it supports more scalable message routing methodologies. At the moment, we support three: (a) direct, which sends the message directly to all recipients; (b) linear, which sends the message to the local daemon on each node, which then relays it to its own local procs; and (b) binomial, which sends the message via a binomial algo across all the daemons, each of which then relays to its own local procs. The crossover points between the algos are adjustable via MCA param, or you can simply demand that a specific algo be used.
3. orteds no longer exhibit two types of behavior: bootproxy or VM. Orteds now always behave like they are part of a virtual machine - they simply launch a job if mpirun tells them to do so. This is another step towards creating an "orteboot" functionality, but also provided a clean system for supporting message relaying.
Note one major impact of this commit: multiple daemons on a node cannot be supported any longer! Only a single daemon/node is now allowed.
This commit is known to break support for the following environments: POE, Xgrid, Xcpu, Windows. It has been tested on rsh, SLURM, and Bproc. Modifications for TM support have been made but could not be verified due to machine problems at LANL. Modifications for SGE have been made but could not be verified. The developers for the non-verified environments will be separately notified along with suggestions on how to fix the problems.
This commit was SVN r15007.
2007-06-12 17:28:54 +04:00
|
|
|
/* exec the daemon(s) */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = plm_slurm_start_proc(argc, argv, env, cur_prefix))) {
|
2007-04-25 00:53:54 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do NOT wait for srun to complete. Srun only completes when the processes
|
2007-07-12 23:53:18 +04:00
|
|
|
* it starts - in this case, the orteds - complete. Instead, we'll catch
|
2007-04-25 00:53:54 +04:00
|
|
|
* any srun failures and deal with them elsewhere
|
|
|
|
*/
|
|
|
|
|
2007-07-12 23:53:18 +04:00
|
|
|
/* 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-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:slurm: daemon launch failed for job %s on error %s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME),
|
|
|
|
orte_util_print_jobids(active_job), ORTE_ERROR_NAME(rc)));
|
2007-07-12 23:53:18 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
launch_apps:
|
2008-12-09 03:32:04 +03:00
|
|
|
/* get here if daemons launch okay - any failures now by apps */
|
2009-03-03 19:39:13 +03:00
|
|
|
launching_daemons = false;
|
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
|
|
|
failed_job = active_job;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_launch_apps(active_job))) {
|
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:slurm: launch of apps failed for job %s on error %s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME),
|
|
|
|
orte_util_print_jobids(active_job), ORTE_ERROR_NAME(rc)));
|
2007-07-12 23:53:18 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
/* declare the launch a success */
|
|
|
|
failed_launch = false;
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (orte_timing) {
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
if (0 != gettimeofday(&launchstop, NULL)) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_slurm: could not obtain stop time");
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
} else {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm_slurm: total job launch time is %ld usec",
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
(launchstop.tv_sec - launchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - launchstart.tv_usec));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:slurm: start_procs returned error %d", rc);
|
2005-08-25 20:38:42 +04:00
|
|
|
goto cleanup;
|
2005-08-25 02:19:48 +04:00
|
|
|
}
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
cleanup:
|
2007-04-25 00:53:54 +04:00
|
|
|
if (NULL != argv) {
|
|
|
|
opal_argv_free(argv);
|
|
|
|
}
|
|
|
|
if (NULL != env) {
|
|
|
|
opal_argv_free(env);
|
|
|
|
}
|
|
|
|
|
2007-03-29 04:50:56 +04:00
|
|
|
if(NULL != jobid_string) {
|
|
|
|
free(jobid_string);
|
|
|
|
}
|
2006-10-08 02:44:00 +04:00
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
/* check for failed launch - if so, force terminate */
|
|
|
|
if (failed_launch) {
|
2008-12-09 03:32:04 +03:00
|
|
|
orte_plm_base_launch_failed(failed_job, -1, ORTE_ERROR_DEFAULT_EXIT_CODE, ORTE_JOB_STATE_FAILED_TO_START);
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
return rc;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_slurm_terminate_job(orte_jobid_t jobid)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2006-09-15 01:29:51 +04: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))) {
|
2006-09-15 01:29:51 +04: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_slurm_terminate_orteds(void)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
int rc;
|
2009-03-03 19:39:13 +03:00
|
|
|
orte_job_t *jdata;
|
2007-04-25 00:53:54 +04:00
|
|
|
|
2009-03-03 19:39:13 +03:00
|
|
|
/* tell them to die without sending a reply - we will rely on the
|
|
|
|
* waitpid to tell us when they have exited!
|
When we can detect that a daemon has failed, then we would like to terminate the system without having it lock up. The "hang" is currently caused by the system attempting to send messages to the daemons (specifically, ordering them to kill their local procs and then terminate). Unfortunately, without some idea of which daemon has died, the system hangs while attempting to send a message to someone who is no longer alive.
This commit introduces the necessary logic to avoid that conflict. If a PLS component can identify that a daemon has failed, then we will set a flag indicating that fact. The xcast system will subsequently check that flag and, if it is set, will send all messages direct to the recipient. In the case of "kill local procs" and "terminate", the messages will go directly to each orted, thus bypassing any orted that has failed.
In addition, the xcast system will -not- wait for the messages to complete, but will return immediately (i.e., operate in non-blocking mode). Orterun will wait (via an event timer) for a period of time based on the number of daemons in the system to allow the messages to attempt to be delivered - at the end of that time, orterun will simply exit, alerting the user to the problem and -strongly- recommending they run orte-clean.
I could only test this on slurm for the case where all daemons unexpectedly died - srun apparently only executes its waitpid callback when all launched functions terminate. I have asked that Jeff integrate this capability into the OOB as he is working on it so that we execute it whenever a socket to an orted is unexpectedly closed. Meantime, the functionality will rarely get called, but at least the logic is available for anyone whose environment can support it.
This commit was SVN r16451.
2007-10-15 22:00:30 +04:00
|
|
|
*/
|
2009-03-03 19:39:13 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_exit(ORTE_DAEMON_EXIT_NO_REPLY_CMD))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
2009-03-03 19:39:13 +03:00
|
|
|
/* check to see if the primary pid is set. If not, this indicates
|
|
|
|
* that we never launched any additional daemons, so we cannot
|
|
|
|
* not wait for a waitpid to fire and tell us it's okay to
|
|
|
|
* exit. Instead, we simply trigger an exit for ourselves
|
|
|
|
*/
|
|
|
|
if (!primary_pid_set) {
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
|
|
|
"%s plm:slurm: primary daemons complete!",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME)));
|
2009-03-03 19:39:13 +03:00
|
|
|
jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
|
|
|
jdata->state = ORTE_JOB_STATE_TERMINATED;
|
|
|
|
/* need to set the #terminated value to avoid an incorrect error msg */
|
|
|
|
jdata->num_terminated = jdata->num_procs;
|
|
|
|
orte_trigger_event(&orteds_exit);
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
return rc;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-08 22:27:17 +04:00
|
|
|
/**
|
|
|
|
* Signal all the processes in the child srun by sending the signal directly to it
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_slurm_signal_job(orte_jobid_t jobid, int32_t signal)
|
2006-06-08 22:27:17 +04:00
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
int rc = ORTE_SUCCESS;
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* order them to pass this signal to their local procs */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_signal_local_procs(jobid, signal))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
return rc;
|
2006-06-08 22:27:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_slurm_finalize(void)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
2007-04-25 00:53:54 +04:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* cleanup any pending recvs */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_stop())) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
static void srun_wait_cb(pid_t pid, int status, void* cbdata){
|
2009-03-03 19:39:13 +03:00
|
|
|
orte_job_t *jdata;
|
2007-04-25 00:53:54 +04:00
|
|
|
|
2009-03-03 19:39:13 +03:00
|
|
|
/* According to the SLURM folks, srun always returns the highest exit
|
|
|
|
code of our remote processes. Thus, a non-zero exit status doesn't
|
|
|
|
necessarily mean that srun 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 srun 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
|
|
|
|
srun failed. Report the error and make sure that orterun
|
|
|
|
wakes up - otherwise, do nothing!
|
2008-05-29 17:38:27 +04:00
|
|
|
|
2009-03-03 19:39:13 +03:00
|
|
|
Unfortunately, the pid returned here is the srun pid, not the pid of
|
|
|
|
the proc that actually died! So, to avoid confusion, just use -1 as the
|
|
|
|
pid so nobody thinks this is real
|
|
|
|
*/
|
2007-04-25 00:53:54 +04:00
|
|
|
|
2009-03-03 19:39:13 +03:00
|
|
|
/* if we are in the launch phase, then any termination is bad */
|
|
|
|
if (launching_daemons) {
|
|
|
|
/* report that one or more daemons failed to launch so we can exit */
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
|
|
|
"%s plm:slurm: daemon failed during launch",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME)));
|
2009-03-03 19:39:13 +03:00
|
|
|
orte_plm_base_launch_failed(ORTE_PROC_MY_NAME->jobid, -1, status, ORTE_JOB_STATE_FAILED_TO_START);
|
|
|
|
} else {
|
|
|
|
/* if this is after launch, then we need to abort only if the status
|
|
|
|
* returned is non-zero - i.e., if the orteds exited with an error
|
|
|
|
*/
|
|
|
|
if (0 != status) {
|
When we can detect that a daemon has failed, then we would like to terminate the system without having it lock up. The "hang" is currently caused by the system attempting to send messages to the daemons (specifically, ordering them to kill their local procs and then terminate). Unfortunately, without some idea of which daemon has died, the system hangs while attempting to send a message to someone who is no longer alive.
This commit introduces the necessary logic to avoid that conflict. If a PLS component can identify that a daemon has failed, then we will set a flag indicating that fact. The xcast system will subsequently check that flag and, if it is set, will send all messages direct to the recipient. In the case of "kill local procs" and "terminate", the messages will go directly to each orted, thus bypassing any orted that has failed.
In addition, the xcast system will -not- wait for the messages to complete, but will return immediately (i.e., operate in non-blocking mode). Orterun will wait (via an event timer) for a period of time based on the number of daemons in the system to allow the messages to attempt to be delivered - at the end of that time, orterun will simply exit, alerting the user to the problem and -strongly- recommending they run orte-clean.
I could only test this on slurm for the case where all daemons unexpectedly died - srun apparently only executes its waitpid callback when all launched functions terminate. I have asked that Jeff integrate this capability into the OOB as he is working on it so that we execute it whenever a socket to an orted is unexpectedly closed. Meantime, the functionality will rarely get called, but at least the logic is available for anyone whose environment can support it.
This commit was SVN r16451.
2007-10-15 22:00:30 +04:00
|
|
|
/* an orted must have died unexpectedly after launch - report
|
|
|
|
* that the daemon has failed so we exit
|
|
|
|
*/
|
2009-03-03 19:39:13 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
|
|
|
"%s plm:slurm: daemon failed while running",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME)));
|
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, -1, status, ORTE_JOB_STATE_ABORTED);
|
2007-04-25 00:53:54 +04:00
|
|
|
}
|
2009-03-03 19:39:13 +03:00
|
|
|
/* otherwise, check to see if this is the primary pid */
|
|
|
|
if (primary_srun_pid == pid) {
|
|
|
|
/* in this case, we just want to fire the proper trigger so
|
|
|
|
* mpirun can exit
|
|
|
|
*/
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
|
|
|
|
"%s plm:slurm: primary daemons complete!",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME)));
|
2009-03-03 19:39:13 +03:00
|
|
|
jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
|
|
|
jdata->state = ORTE_JOB_STATE_TERMINATED;
|
|
|
|
/* need to set the #terminated value to avoid an incorrect error msg */
|
|
|
|
jdata->num_terminated = jdata->num_procs;
|
|
|
|
orte_trigger_event(&orteds_exit);
|
|
|
|
}
|
2007-04-25 00:53:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_slurm_start_proc(int argc, char **argv, char **env,
|
2005-10-01 01:44:05 +04:00
|
|
|
char *prefix)
|
2005-08-25 02:19:48 +04:00
|
|
|
{
|
2007-07-12 23:53:18 +04:00
|
|
|
int fd;
|
2009-03-03 19:39:13 +03:00
|
|
|
int srun_pid;
|
2005-08-25 20:38:42 +04:00
|
|
|
char *exec_argv = opal_path_findv(argv[0], 0, env, NULL);
|
2005-08-25 02:19:48 +04:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
if (NULL == exec_argv) {
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
srun_pid = fork();
|
|
|
|
if (-1 == srun_pid) {
|
2007-04-25 00:53:54 +04:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_CHILDREN);
|
2008-03-26 01:42:24 +03:00
|
|
|
free(exec_argv);
|
2007-04-25 00:53:54 +04:00
|
|
|
return ORTE_ERR_SYS_LIMITS_CHILDREN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == srun_pid) { /* child */
|
2006-05-16 18:14:12 +04:00
|
|
|
char *bin_base = NULL, *lib_base = NULL;
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2006-05-16 18:14:12 +04:00
|
|
|
/* 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
|
2006-05-16 18:14:12 +04:00
|
|
|
explaining all the rationale for how / why we're doing
|
|
|
|
this. */
|
|
|
|
|
2007-04-21 04:15:05 +04:00
|
|
|
lib_base = opal_basename(opal_install_dirs.libdir);
|
|
|
|
bin_base = opal_basename(opal_install_dirs.bindir);
|
2006-05-16 18:14:12 +04:00
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
/* If we have a prefix, then modify the PATH and
|
2007-01-22 18:50:35 +03:00
|
|
|
LD_LIBRARY_PATH environment variables. */
|
2005-10-01 01:44:05 +04:00
|
|
|
if (NULL != prefix) {
|
|
|
|
char *oldenv, *newenv;
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
/* Reset PATH */
|
|
|
|
oldenv = getenv("PATH");
|
|
|
|
if (NULL != oldenv) {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, bin_base, oldenv);
|
2005-10-01 01:44:05 +04:00
|
|
|
} else {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s", prefix, bin_base);
|
2005-10-01 01:44:05 +04:00
|
|
|
}
|
2007-01-22 18:50:35 +03:00
|
|
|
opal_setenv("PATH", newenv, true, &env);
|
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:slurm: reset PATH: %s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
newenv));
|
2005-10-01 01:44:05 +04:00
|
|
|
free(newenv);
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
/* Reset LD_LIBRARY_PATH */
|
|
|
|
oldenv = getenv("LD_LIBRARY_PATH");
|
|
|
|
if (NULL != oldenv) {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, lib_base, oldenv);
|
2005-10-01 01:44:05 +04:00
|
|
|
} else {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s", prefix, lib_base);
|
2005-10-01 01:44:05 +04:00
|
|
|
}
|
2007-01-22 18:50:35 +03:00
|
|
|
opal_setenv("LD_LIBRARY_PATH", newenv, true, &env);
|
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:slurm: reset LD_LIBRARY_PATH: %s",
|
2009-03-06 00:14:18 +03:00
|
|
|
orte_util_print_name_args(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
newenv));
|
2005-10-01 01:44:05 +04:00
|
|
|
free(newenv);
|
|
|
|
}
|
|
|
|
|
2007-08-17 00:49:27 +04:00
|
|
|
fd = open("/dev/null", O_CREAT|O_WRONLY|O_TRUNC, 0666);
|
|
|
|
if(fd > 0) {
|
|
|
|
dup2(fd, 0);
|
|
|
|
}
|
|
|
|
|
2006-10-24 17:05:13 +04:00
|
|
|
/* When not in debug mode and --debug-daemons was not passed,
|
2008-08-19 22:30:30 +04:00
|
|
|
* tie stdout/stderr to dev null so we don't see messages from orted
|
|
|
|
* EXCEPT if the user has requested that we leave sessions attached
|
|
|
|
*/
|
2008-06-09 18:53:58 +04:00
|
|
|
if (0 >= opal_output_get_verbosity(orte_plm_globals.output) &&
|
2008-08-19 22:30:30 +04:00
|
|
|
!orte_debug_daemons_flag && !orte_leave_session_attached) {
|
2006-02-17 18:06:08 +03:00
|
|
|
if (fd >= 0) {
|
|
|
|
if (fd != 1) {
|
|
|
|
dup2(fd,1);
|
|
|
|
}
|
|
|
|
if (fd != 2) {
|
|
|
|
dup2(fd,2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-16 23:40:23 +03:00
|
|
|
|
2007-08-17 00:49:27 +04:00
|
|
|
if (fd > 2) {
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
|
2005-08-27 21:08:48 +04:00
|
|
|
/* get the srun 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 srun */
|
|
|
|
setpgid(0, 0);
|
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
execve(exec_argv, argv, env);
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:slurm:start_proc: exec failed");
|
2005-08-27 21:08:48 +04:00
|
|
|
/* don't return - need to exit - returning would be bad -
|
|
|
|
we're not in the calling process anymore */
|
|
|
|
exit(1);
|
2007-04-25 00:53:54 +04:00
|
|
|
} else { /* parent */
|
|
|
|
/* just in case, make sure that the srun process is not in our
|
|
|
|
process group any more. Stevens says always do this on both
|
|
|
|
sides of the fork... */
|
|
|
|
setpgid(srun_pid, srun_pid);
|
|
|
|
|
2009-03-03 19:39:13 +03:00
|
|
|
/* if this is the primary launch - i.e., not a comm_spawn of a
|
|
|
|
* child job - then save the pid
|
|
|
|
*/
|
|
|
|
if (!primary_pid_set) {
|
|
|
|
primary_srun_pid = srun_pid;
|
|
|
|
primary_pid_set = true;
|
|
|
|
}
|
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
/* setup the waitpid so we can find out if srun succeeds! */
|
|
|
|
orte_wait_cb(srun_pid, srun_wait_cb, NULL);
|
|
|
|
free(exec_argv);
|
2005-08-25 20:38:42 +04:00
|
|
|
}
|
2005-08-25 02:19:48 +04:00
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|