2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* 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.
|
2005-03-14 23:57:21 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* 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.
|
2006-05-16 18:14:12 +04:00
|
|
|
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
2012-04-06 18:23:13 +04:00
|
|
|
* Copyright (c) 2007-2012 Los Alamos National Security, LLC. All rights
|
2007-06-05 07:03:59 +04:00
|
|
|
* reserved.
|
2014-03-05 08:38:17 +04:00
|
|
|
* Copyright (c) 2014 Intel Corporation. All rights reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*
|
|
|
|
* These symbols are in a file by themselves to provide nice linker
|
|
|
|
* semantics. Since linkers generally pull in symbols by object
|
|
|
|
* files, keeping these symbols as the only symbols in this file
|
|
|
|
* prevents utility programs such as "ompi_info" from having to import
|
|
|
|
* entire components just to query their version and parameters.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
|
|
|
#include "orte/types.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2009-04-29 04:49:23 +04:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
2009-07-16 22:27:33 +04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-03-14 23:57:21 +03:00
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <signal.h>
|
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_TYPES_H
|
2005-03-18 06:43:59 +03:00
|
|
|
#include <sys/types.h>
|
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
|
|
|
#endif
|
2007-08-14 22:44:52 +04:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.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_WAIT_H
|
2005-03-18 06:43:59 +03:00
|
|
|
#include <sys/wait.h>
|
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
|
|
|
#endif
|
2005-08-19 20:49:59 +04:00
|
|
|
#ifdef HAVE_SCHED_H
|
|
|
|
#include <sched.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
|
2005-08-19 20:49:59 +04:00
|
|
|
#include <errno.h>
|
|
|
|
#include <tm.h>
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2007-04-21 04:15:05 +04:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#include "opal/mca/event/event.h"
|
2005-07-04 04:13:44 +04:00
|
|
|
#include "opal/util/argv.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2005-07-04 05:36:20 +04:00
|
|
|
#include "opal/util/opal_environ.h"
|
2006-05-16 18:14:12 +04:00
|
|
|
#include "opal/util/basename.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
2005-08-25 02:20:51 +04:00
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2006-10-07 19:45:24 +04:00
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
2012-04-06 18:23:13 +04:00
|
|
|
#include "orte/mca/state/state.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_tm.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
|
2006-07-05 00:12:35 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2012-04-06 18:23:13 +04:00
|
|
|
* API functions
|
2005-03-14 23:57:21 +03:00
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_tm_init(void);
|
|
|
|
static int plm_tm_launch_job(orte_job_t *jdata);
|
|
|
|
static int plm_tm_terminate_orteds(void);
|
|
|
|
static int plm_tm_signal_job(orte_jobid_t jobid, int32_t signal);
|
|
|
|
static int plm_tm_finalize(void);
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2008-06-03 01:46:34 +04:00
|
|
|
/*
|
|
|
|
* Local "global" variables
|
|
|
|
*/
|
2012-04-06 18:23:13 +04:00
|
|
|
static orte_std_cntr_t launched = 0;
|
|
|
|
static bool connected = false;
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_plm_base_module_t orte_plm_tm_module = {
|
|
|
|
plm_tm_init,
|
|
|
|
orte_plm_base_set_hnp_name,
|
|
|
|
plm_tm_launch_job,
|
2008-04-14 23:36:13 +04:00
|
|
|
NULL,
|
2009-07-13 06:29:17 +04:00
|
|
|
orte_plm_base_orted_terminate_job,
|
2008-02-28 04:57:57 +03:00
|
|
|
plm_tm_terminate_orteds,
|
2009-07-13 06:29:17 +04:00
|
|
|
orte_plm_base_orted_kill_local_procs,
|
2008-02-28 04:57:57 +03:00
|
|
|
plm_tm_signal_job,
|
|
|
|
plm_tm_finalize
|
2005-03-14 23:57:21 +03:00
|
|
|
};
|
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
/* Local functions */
|
|
|
|
static int plm_tm_connect(void);
|
|
|
|
static void failed_start(int fd, short event, void *arg);
|
|
|
|
static void launch_daemons(int fd, short args, void *cbdata);
|
|
|
|
static void poll_spawns(int fd, short args, void *cbdata);
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/**
|
|
|
|
* Init the module
|
|
|
|
*/
|
|
|
|
static int plm_tm_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
|
|
|
|
Although we never really thought about it, we made an unconscious assumption in the mapper system - we assumed that the daemons would be placed on nodes in the order that the nodes appear in the allocation. In other words, we assumed that the launch environment would map processes in node order.
Turns out, this isn't necessarily true. The Cray, for example, launches processes in a toroidal pattern, thus causing the daemons to wind up somewhere other than what we thought. Other environments (e.g., slurm) are also capable of such behavior, depending upon the default mapping algorithm they are told to use.
Resolve this problem by making the daemon-to-node assignment in the affected environments when the daemon calls back and tells us what node it is on. Order the nodes in the mapping list so they are in daemon-vpid order as opposed to the order in which they show in the allocation. For environments that don't exhibit this mapping behavior (e.g., rsh), this won't have any impact.
Also, clean up the vm launch procedure a little bit so it more closely aligns with the state machine implementation that is coming, and remove some lingering "slave" code.
This commit was SVN r25551.
2011-11-30 23:58:24 +04:00
|
|
|
/* we assign daemon nodes at launch */
|
|
|
|
orte_plm_globals.daemon_nodes_assigned_at_launch = true;
|
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
/* point to our launch command */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_state.add_job_state(ORTE_JOB_STATE_LAUNCH_DAEMONS,
|
|
|
|
launch_daemons, ORTE_SYS_PRI))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* overwrite the daemons_launched state to point to
|
|
|
|
* our own local function
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_state.set_job_state_callback(ORTE_JOB_STATE_DAEMONS_LAUNCHED,
|
|
|
|
poll_spawns))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
static int plm_tm_launch_job(orte_job_t *jdata)
|
|
|
|
{
|
|
|
|
if (ORTE_JOB_CONTROL_RESTART & jdata->controls) {
|
|
|
|
/* this is a restart situation - skip to the mapping stage */
|
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_MAP);
|
|
|
|
} else {
|
|
|
|
/* new job - set it up */
|
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_INIT);
|
|
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
*/
|
2012-04-06 18:23:13 +04:00
|
|
|
static void launch_daemons(int fd, short args, void *cbdata)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2007-04-25 00:53:54 +04:00
|
|
|
orte_job_map_t *map = NULL;
|
2010-06-09 06:16:05 +04:00
|
|
|
orte_app_context_t *app;
|
|
|
|
orte_node_t *node;
|
2008-02-28 04:57:57 +03:00
|
|
|
int proc_vpid_index;
|
2007-05-08 17:21:18 +04:00
|
|
|
char *param;
|
2007-04-25 00:53:54 +04:00
|
|
|
char **env = NULL;
|
2006-10-07 19:45:24 +04:00
|
|
|
char *var;
|
2007-04-25 00:53:54 +04:00
|
|
|
char **argv = NULL;
|
2009-05-16 08:15:55 +04:00
|
|
|
char **nodeargv;
|
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
|
|
|
int argc = 0;
|
2005-08-19 20:49:59 +04:00
|
|
|
int rc;
|
2012-04-06 18:23:13 +04:00
|
|
|
orte_std_cntr_t i;
|
2006-05-16 18:14:12 +04:00
|
|
|
char *bin_base = NULL, *lib_base = NULL;
|
2008-12-09 03:32:04 +03:00
|
|
|
tm_event_t *tm_events = NULL;
|
|
|
|
tm_task_id *tm_task_ids = NULL;
|
2007-04-25 00:53:54 +04:00
|
|
|
bool failed_launch = true;
|
2007-08-14 22:44:52 +04:00
|
|
|
mode_t current_umask;
|
2009-05-16 08:15:55 +04:00
|
|
|
char *nodelist;
|
2010-06-09 06:16:05 +04:00
|
|
|
char* vpid_string;
|
2012-04-06 18:23:13 +04:00
|
|
|
orte_job_t *daemons, *jdata;
|
|
|
|
orte_state_caddy_t *state = (orte_state_caddy_t*)cbdata;
|
|
|
|
|
|
|
|
jdata = state->jdata;
|
2010-06-09 06:16:05 +04:00
|
|
|
|
2012-01-18 04:19:49 +04:00
|
|
|
/* if we are launching debugger daemons, then just go
|
|
|
|
* do it - no new daemons will be launched
|
|
|
|
*/
|
|
|
|
if (ORTE_JOB_CONTROL_DEBUGGER_DAEMON & jdata->controls) {
|
2012-05-03 01:00:22 +04:00
|
|
|
jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2012-04-06 18:23:13 +04:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DAEMONS_REPORTED);
|
|
|
|
OBJ_RELEASE(state);
|
|
|
|
return;
|
2012-01-18 04:19:49 +04:00
|
|
|
}
|
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
/* setup the virtual machine */
|
2011-12-06 02:01:08 +04:00
|
|
|
daemons = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
2011-12-15 00:01:15 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_setup_virtual_machine(jdata))) {
|
2011-12-06 02:01:08 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
Although we never really thought about it, we made an unconscious assumption in the mapper system - we assumed that the daemons would be placed on nodes in the order that the nodes appear in the allocation. In other words, we assumed that the launch environment would map processes in node order.
Turns out, this isn't necessarily true. The Cray, for example, launches processes in a toroidal pattern, thus causing the daemons to wind up somewhere other than what we thought. Other environments (e.g., slurm) are also capable of such behavior, depending upon the default mapping algorithm they are told to use.
Resolve this problem by making the daemon-to-node assignment in the affected environments when the daemon calls back and tells us what node it is on. Order the nodes in the mapping list so they are in daemon-vpid order as opposed to the order in which they show in the allocation. For environments that don't exhibit this mapping behavior (e.g., rsh), this won't have any impact.
Also, clean up the vm launch procedure a little bit so it more closely aligns with the state machine implementation that is coming, and remove some lingering "slave" code.
This commit was SVN r25551.
2011-11-30 23:58:24 +04:00
|
|
|
/* if we don't want to launch, then don't attempt to
|
|
|
|
* launch the daemons - the user really wants to just
|
|
|
|
* look at the proposed process map
|
|
|
|
*/
|
|
|
|
if (orte_do_not_launch) {
|
2012-04-06 18:23:13 +04:00
|
|
|
/* set the state to indicate the daemons reported - this
|
|
|
|
* will trigger the daemons_reported event and cause the
|
|
|
|
* job to move to the following step
|
|
|
|
*/
|
|
|
|
jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2012-05-03 01:00:22 +04:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DAEMONS_REPORTED);
|
2012-04-06 18:23:13 +04:00
|
|
|
OBJ_RELEASE(state);
|
|
|
|
return;
|
Although we never really thought about it, we made an unconscious assumption in the mapper system - we assumed that the daemons would be placed on nodes in the order that the nodes appear in the allocation. In other words, we assumed that the launch environment would map processes in node order.
Turns out, this isn't necessarily true. The Cray, for example, launches processes in a toroidal pattern, thus causing the daemons to wind up somewhere other than what we thought. Other environments (e.g., slurm) are also capable of such behavior, depending upon the default mapping algorithm they are told to use.
Resolve this problem by making the daemon-to-node assignment in the affected environments when the daemon calls back and tells us what node it is on. Order the nodes in the mapping list so they are in daemon-vpid order as opposed to the order in which they show in the allocation. For environments that don't exhibit this mapping behavior (e.g., rsh), this won't have any impact.
Also, clean up the vm launch procedure a little bit so it more closely aligns with the state machine implementation that is coming, and remove some lingering "slave" code.
This commit was SVN r25551.
2011-11-30 23:58:24 +04:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* Get the map for this job */
|
Although we never really thought about it, we made an unconscious assumption in the mapper system - we assumed that the daemons would be placed on nodes in the order that the nodes appear in the allocation. In other words, we assumed that the launch environment would map processes in node order.
Turns out, this isn't necessarily true. The Cray, for example, launches processes in a toroidal pattern, thus causing the daemons to wind up somewhere other than what we thought. Other environments (e.g., slurm) are also capable of such behavior, depending upon the default mapping algorithm they are told to use.
Resolve this problem by making the daemon-to-node assignment in the affected environments when the daemon calls back and tells us what node it is on. Order the nodes in the mapping list so they are in daemon-vpid order as opposed to the order in which they show in the allocation. For environments that don't exhibit this mapping behavior (e.g., rsh), this won't have any impact.
Also, clean up the vm launch procedure a little bit so it more closely aligns with the state machine implementation that is coming, and remove some lingering "slave" code.
This commit was SVN r25551.
2011-11-30 23:58:24 +04:00
|
|
|
if (NULL == (map = daemons->map)) {
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
rc = ORTE_ERR_NOT_FOUND;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (0 == map->num_new_daemons) {
|
2012-04-06 18:23:13 +04:00
|
|
|
/* set the state to indicate the daemons reported - this
|
|
|
|
* will trigger the daemons_reported event and cause the
|
|
|
|
* job to move to the following step
|
|
|
|
*/
|
|
|
|
jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2014-03-18 05:24:49 +04:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DAEMONS_REPORTED);
|
2012-04-06 18:23:13 +04:00
|
|
|
OBJ_RELEASE(state);
|
|
|
|
return;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2012-04-06 18:23:13 +04:00
|
|
|
"%s plm:tm: launching vm",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
|
2008-12-09 03:32:04 +03:00
|
|
|
/* Allocate a bunch of TM events to use for tm_spawn()ing */
|
|
|
|
tm_events = malloc(sizeof(tm_event_t) * map->num_new_daemons);
|
|
|
|
if (NULL == tm_events) {
|
|
|
|
rc = ORTE_ERR_OUT_OF_RESOURCE;
|
|
|
|
ORTE_ERROR_LOG(rc);
|
2006-07-15 02:04:41 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2008-12-09 03:32:04 +03:00
|
|
|
tm_task_ids = malloc(sizeof(tm_task_id) * map->num_new_daemons);
|
2008-11-20 21:57:35 +03:00
|
|
|
if (NULL == tm_task_ids) {
|
2008-12-09 03:32:04 +03:00
|
|
|
rc = ORTE_ERR_OUT_OF_RESOURCE;
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
2008-11-20 21:57:35 +03:00
|
|
|
}
|
2006-07-15 02:04:41 +04:00
|
|
|
|
2005-08-19 20:49:59 +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);
|
2005-08-19 20:49:59 +04:00
|
|
|
|
2009-05-16 08:15:55 +04:00
|
|
|
/* create a list of nodes in this launch */
|
|
|
|
nodeargv = NULL;
|
Although we never really thought about it, we made an unconscious assumption in the mapper system - we assumed that the daemons would be placed on nodes in the order that the nodes appear in the allocation. In other words, we assumed that the launch environment would map processes in node order.
Turns out, this isn't necessarily true. The Cray, for example, launches processes in a toroidal pattern, thus causing the daemons to wind up somewhere other than what we thought. Other environments (e.g., slurm) are also capable of such behavior, depending upon the default mapping algorithm they are told to use.
Resolve this problem by making the daemon-to-node assignment in the affected environments when the daemon calls back and tells us what node it is on. Order the nodes in the mapping list so they are in daemon-vpid order as opposed to the order in which they show in the allocation. For environments that don't exhibit this mapping behavior (e.g., rsh), this won't have any impact.
Also, clean up the vm launch procedure a little bit so it more closely aligns with the state machine implementation that is coming, and remove some lingering "slave" code.
This commit was SVN r25551.
2011-11-30 23:58:24 +04:00
|
|
|
for (i = 0; i < map->nodes->size; i++) {
|
2010-06-09 06:16:05 +04:00
|
|
|
if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(map->nodes, i))) {
|
|
|
|
continue;
|
|
|
|
}
|
2009-05-16 08:15:55 +04:00
|
|
|
|
|
|
|
/* if this daemon already exists, don't launch it! */
|
|
|
|
if (node->daemon_launched) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add to list */
|
|
|
|
opal_argv_append_nosize(&nodeargv, node->name);
|
|
|
|
}
|
|
|
|
nodelist = opal_argv_join(nodeargv, ',');
|
|
|
|
opal_argv_free(nodeargv);
|
|
|
|
|
2007-04-10 18:23:32 +04:00
|
|
|
/* Add basic orted command line options */
|
2009-05-16 08:15:55 +04:00
|
|
|
orte_plm_base_orted_append_basic_args(&argc, &argv, "tm",
|
2008-02-28 04:57:57 +03:00
|
|
|
&proc_vpid_index,
|
2010-05-05 04:48:43 +04:00
|
|
|
nodelist);
|
2009-05-16 08:15:55 +04:00
|
|
|
free(nodelist);
|
|
|
|
|
2013-03-28 01:14:43 +04:00
|
|
|
if (0 < opal_output_get_verbosity(orte_plm_base_framework.framework_output)) {
|
2005-08-19 20:49:59 +04:00
|
|
|
param = opal_argv_join(argv, ' ');
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:tm: final top-level argv:\n\t%s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
(NULL == param) ? "NULL" : param));
|
|
|
|
if (NULL != param) free(param);
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
2005-03-18 06:43:59 +03:00
|
|
|
|
2013-09-23 03:53:57 +04:00
|
|
|
if (!connected) {
|
|
|
|
if (ORTE_SUCCESS != plm_tm_connect()) {
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
connected = true;
|
2005-03-18 06:43:59 +03:00
|
|
|
}
|
|
|
|
|
2006-05-16 18:14:12 +04:00
|
|
|
/* Figure out the basenames for the libdir and bindir. There is a
|
2008-02-28 04:57:57 +03:00
|
|
|
lengthy comment about this in plm_rsh_module.c explaining all
|
2006-05-16 18:14:12 +04:00
|
|
|
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
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* setup environment */
|
2008-06-24 02:39:36 +04:00
|
|
|
env = opal_argv_copy(orte_launch_environ);
|
2006-10-07 19:45:24 +04:00
|
|
|
|
2009-02-09 23:44:44 +03:00
|
|
|
/* enable local launch by the orteds */
|
2013-03-28 01:09:41 +04:00
|
|
|
(void) mca_base_var_env_name ("plm", &var);
|
2009-02-09 23:44:44 +03:00
|
|
|
opal_setenv(var, "rsh", true, &env);
|
|
|
|
free(var);
|
|
|
|
|
2007-08-14 22:44:52 +04:00
|
|
|
/* add our umask -- see big note in orted.c */
|
|
|
|
current_umask = umask(0);
|
|
|
|
umask(current_umask);
|
|
|
|
asprintf(&var, "0%o", current_umask);
|
|
|
|
opal_setenv("ORTE_DAEMON_UMASK_VALUE", var, true, &env);
|
2007-08-15 01:12:00 +04:00
|
|
|
free(var);
|
2006-10-20 20:50:13 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* If we have a prefix, then modify the PATH and
|
|
|
|
LD_LIBRARY_PATH environment variables. We only allow
|
|
|
|
a single prefix to be specified. Since there will
|
|
|
|
always be at least one app_context, we take it from
|
|
|
|
there
|
|
|
|
*/
|
2010-06-09 06:16:05 +04:00
|
|
|
app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, 0);
|
|
|
|
if (NULL != app->prefix_dir) {
|
2006-10-07 19:45:24 +04:00
|
|
|
char *newenv;
|
|
|
|
|
|
|
|
for (i = 0; NULL != env && NULL != env[i]; ++i) {
|
|
|
|
/* Reset PATH */
|
|
|
|
if (0 == strncmp("PATH=", env[i], 5)) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s",
|
2010-06-09 06:16:05 +04:00
|
|
|
app->prefix_dir, bin_base, env[i] + 5);
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:tm: resetting PATH: %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
newenv));
|
2006-10-07 19:45:24 +04:00
|
|
|
opal_setenv("PATH", newenv, true, &env);
|
|
|
|
free(newenv);
|
|
|
|
}
|
2005-10-02 15:58:18 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* Reset LD_LIBRARY_PATH */
|
|
|
|
else if (0 == strncmp("LD_LIBRARY_PATH=", env[i], 16)) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s",
|
2010-06-09 06:16:05 +04:00
|
|
|
app->prefix_dir, lib_base, env[i] + 16);
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:tm: resetting LD_LIBRARY_PATH: %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
newenv));
|
2006-10-07 19:45:24 +04:00
|
|
|
opal_setenv("LD_LIBRARY_PATH", newenv, true, &env);
|
|
|
|
free(newenv);
|
|
|
|
}
|
2005-10-02 15:58:18 +04:00
|
|
|
}
|
2006-10-07 19:45:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Iterate through each of the nodes and spin
|
|
|
|
* up a daemon.
|
|
|
|
*/
|
Although we never really thought about it, we made an unconscious assumption in the mapper system - we assumed that the daemons would be placed on nodes in the order that the nodes appear in the allocation. In other words, we assumed that the launch environment would map processes in node order.
Turns out, this isn't necessarily true. The Cray, for example, launches processes in a toroidal pattern, thus causing the daemons to wind up somewhere other than what we thought. Other environments (e.g., slurm) are also capable of such behavior, depending upon the default mapping algorithm they are told to use.
Resolve this problem by making the daemon-to-node assignment in the affected environments when the daemon calls back and tells us what node it is on. Order the nodes in the mapping list so they are in daemon-vpid order as opposed to the order in which they show in the allocation. For environments that don't exhibit this mapping behavior (e.g., rsh), this won't have any impact.
Also, clean up the vm launch procedure a little bit so it more closely aligns with the state machine implementation that is coming, and remove some lingering "slave" code.
This commit was SVN r25551.
2011-11-30 23:58:24 +04:00
|
|
|
for (i = 0; i < map->nodes->size; i++) {
|
2010-06-09 06:16:05 +04:00
|
|
|
if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(map->nodes, i))) {
|
|
|
|
continue;
|
|
|
|
}
|
2007-06-14 16:33:34 +04:00
|
|
|
/* if this daemon already exists, don't launch it! */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (node->daemon_launched) {
|
2007-06-14 16:33:34 +04:00
|
|
|
continue;
|
|
|
|
}
|
2007-07-12 23:53:18 +04:00
|
|
|
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:tm: launching on node %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
node->name));
|
2006-10-07 19:45:24 +04:00
|
|
|
|
|
|
|
/* setup process name */
|
2010-06-09 06:16:05 +04:00
|
|
|
rc = orte_util_convert_vpid_to_string(&vpid_string, node->daemon->name.vpid);
|
2006-10-07 19:45:24 +04:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "plm:tm: unable to get daemon vpid as string");
|
2008-12-09 03:32:04 +03:00
|
|
|
exit(-1);
|
2006-10-07 19:45:24 +04:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
free(argv[proc_vpid_index]);
|
|
|
|
argv[proc_vpid_index] = strdup(vpid_string);
|
|
|
|
free(vpid_string);
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* exec the daemon */
|
2013-03-28 01:14:43 +04:00
|
|
|
if (0 < opal_output_get_verbosity(orte_plm_base_framework.framework_output)) {
|
2006-10-07 19:45:24 +04:00
|
|
|
param = opal_argv_join(argv, ' ');
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:tm: executing:\n\t%s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 04:57:57 +03:00
|
|
|
(NULL == param) ? "NULL" : param));
|
|
|
|
if (NULL != param) free(param);
|
2005-03-18 06:43:59 +03:00
|
|
|
}
|
2006-10-07 19:45:24 +04:00
|
|
|
|
2008-12-09 03:32:04 +03:00
|
|
|
rc = tm_spawn(argc, argv, env, node->launch_id, tm_task_ids + launched, tm_events + launched);
|
2007-02-09 18:06:45 +03:00
|
|
|
if (TM_SUCCESS != rc) {
|
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-tm.txt", "tm-spawn-failed",
|
2008-02-28 04:57:57 +03:00
|
|
|
true, argv[0], node->name, node->launch_id);
|
2007-04-25 00:53:54 +04:00
|
|
|
rc = ORTE_ERROR;
|
2006-10-07 19:45:24 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2007-04-25 00:53:54 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
launched++;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
/* indicate that the daemons for this job were launched */
|
|
|
|
state->jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2012-05-03 01:00:22 +04:00
|
|
|
daemons->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2012-04-06 18:23:13 +04:00
|
|
|
|
|
|
|
/* flag that launch was successful, so far as we currently know */
|
|
|
|
failed_launch = false;
|
|
|
|
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"%s plm:tm:launch: finished spawning orteds",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2006-07-05 00:12:35 +04:00
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
cleanup:
|
|
|
|
/* cleanup */
|
|
|
|
OBJ_RELEASE(state);
|
|
|
|
|
|
|
|
/* check for failed launch - if so, force terminate */
|
|
|
|
if (failed_launch) {
|
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 20:37:40 +04:00
|
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
2012-04-06 18:23:13 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void poll_spawns(int fd, short args, void *cbdata)
|
|
|
|
{
|
|
|
|
orte_state_caddy_t *state = (orte_state_caddy_t*)cbdata;
|
|
|
|
int i, rc;
|
|
|
|
bool failed_launch = true;
|
|
|
|
int local_err;
|
|
|
|
tm_event_t event;
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* TM poll for all the spawns */
|
2008-12-09 03:32:04 +03:00
|
|
|
for (i = 0; i < launched; ++i) {
|
|
|
|
rc = tm_poll(TM_NULL_EVENT, &event, 1, &local_err);
|
2006-09-15 01:29:51 +04:00
|
|
|
if (TM_SUCCESS != rc) {
|
2008-12-09 03:32:04 +03:00
|
|
|
opal_output(0, "plm:tm: failed to poll for a spawned daemon, return status = %d", rc);
|
2007-04-25 00:53:54 +04:00
|
|
|
goto cleanup;
|
2005-08-19 20:49:59 +04:00
|
|
|
}
|
2009-08-14 07:13:02 +04:00
|
|
|
if (TM_SUCCESS != local_err) {
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_output(0, "plm:tm: failed to spawn daemon, error code = %d", local_err );
|
2009-08-14 07:13:02 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
2012-04-06 18:23:13 +04:00
|
|
|
failed_launch = false;
|
|
|
|
|
|
|
|
#if 0
|
2008-06-03 01:46:34 +04:00
|
|
|
/* set a timer to tell us if one or more daemon's fails to start - use the
|
|
|
|
* millisec/daemon timeout provided by the user to compute time
|
|
|
|
*/
|
|
|
|
if (0 < orte_startup_timeout) {
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-06-03 01:46:34 +04:00
|
|
|
"%s plm:tm: setting startup timer for %d milliseconds",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-06-03 01:46:34 +04:00
|
|
|
orte_startup_timeout));
|
2012-04-06 18:23:13 +04:00
|
|
|
ORTE_DETECT_TIMEOUT(map->num_new_daemons,
|
2008-06-03 01:46:34 +04:00
|
|
|
orte_startup_timeout*1000,
|
2012-04-06 18:23:13 +04:00
|
|
|
-1, failed_start, state->jdata);
|
Although we never really thought about it, we made an unconscious assumption in the mapper system - we assumed that the daemons would be placed on nodes in the order that the nodes appear in the allocation. In other words, we assumed that the launch environment would map processes in node order.
Turns out, this isn't necessarily true. The Cray, for example, launches processes in a toroidal pattern, thus causing the daemons to wind up somewhere other than what we thought. Other environments (e.g., slurm) are also capable of such behavior, depending upon the default mapping algorithm they are told to use.
Resolve this problem by making the daemon-to-node assignment in the affected environments when the daemon calls back and tells us what node it is on. Order the nodes in the mapping list so they are in daemon-vpid order as opposed to the order in which they show in the allocation. For environments that don't exhibit this mapping behavior (e.g., rsh), this won't have any impact.
Also, clean up the vm launch procedure a little bit so it more closely aligns with the state machine implementation that is coming, and remove some lingering "slave" code.
This commit was SVN r25551.
2011-11-30 23:58:24 +04:00
|
|
|
}
|
2012-04-06 18:23:13 +04:00
|
|
|
#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
|
|
|
|
2006-07-05 00:12:35 +04:00
|
|
|
cleanup:
|
2012-04-06 18:23:13 +04:00
|
|
|
/* cleanup */
|
|
|
|
OBJ_RELEASE(state);
|
2006-05-16 18:14:12 +04:00
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
/* check for failed launch - if so, force terminate */
|
|
|
|
if (failed_launch) {
|
As per the RFC, bring in the ORTE async progress code and the rewrite of OOB:
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE ***
Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro.
***************************************************************************************
I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week.
The code is in https://bitbucket.org/rhc/ompi-oob2
WHAT: Rewrite of ORTE OOB
WHY: Support asynchronous progress and a host of other features
WHEN: Wed, August 21
SYNOPSIS:
The current OOB has served us well, but a number of limitations have been identified over the years. Specifically:
* it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code)
* we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface.
* the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients
* there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort
* only one transport (i.e., component) can be "active"
The revised OOB resolves these problems:
* async progress is used for all application processes, with the progress thread blocking in the event library
* each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on")
* multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC.
* a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions.
* opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object
* NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions
* obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel
* the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport
* routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active
* all blocking send/recv APIs have been removed. Everything operates asynchronously.
KNOWN LIMITATIONS:
* although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline
* the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker
* routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways
* obviously, not every error path has been tested nor necessarily covered
* determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost.
* reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways
* the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC
This commit was SVN r29058.
2013-08-22 20:37:40 +04:00
|
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
2005-08-19 20:49:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/**
|
|
|
|
* Terminate the orteds for a given job
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
int plm_tm_terminate_orteds(void)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
2014-03-05 08:38:17 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_exit(ORTE_DAEMON_EXIT_CMD))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_tm_signal_job(orte_jobid_t jobid, int32_t signal)
|
2006-06-08 22:27:17 +04:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* order them to pass this signal to their local procs */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_signal_local_procs(jobid, signal))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
2006-06-08 22:27:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* Free stuff
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_tm_finalize(void)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
|
|
|
|
2005-08-19 20:49:59 +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-03-14 23:57:21 +03:00
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
if (connected) {
|
|
|
|
tm_finalize();
|
|
|
|
connected = false;
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
static int plm_tm_connect(void)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2005-08-19 20:49:59 +04:00
|
|
|
int ret;
|
|
|
|
struct tm_roots tm_root;
|
2012-06-11 23:59:53 +04:00
|
|
|
int count;
|
2013-09-23 03:53:57 +04:00
|
|
|
struct timespec tp = {0, 100};
|
2005-08-19 20:49:59 +04:00
|
|
|
|
|
|
|
/* try a couple times to connect - might get busy signals every
|
|
|
|
now and then */
|
|
|
|
for (count = 0 ; count < 10; ++count) {
|
|
|
|
ret = tm_init(NULL, &tm_root);
|
|
|
|
if (TM_SUCCESS == ret) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2013-09-23 03:53:57 +04:00
|
|
|
/* provide a very short quiet period so we
|
|
|
|
* don't hammer the cpu while we wait
|
|
|
|
*/
|
|
|
|
nanosleep(&tp, NULL);
|
2012-06-11 23:59:53 +04:00
|
|
|
#if HAVE_SCHED_YIELD
|
2013-09-23 03:53:57 +04:00
|
|
|
sched_yield();
|
2012-06-12 19:07:09 +04:00
|
|
|
#endif
|
2005-08-19 20:49:59 +04:00
|
|
|
}
|
2013-09-23 03:53:57 +04:00
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
return ORTE_ERR_RESOURCE_BUSY;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|