2005-03-14 20:57:21 +00:00
|
|
|
/*
|
2007-03-29 00:50:56 +00:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 19:57:48 +00:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 03:32:36 +00:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 19:57:48 +00:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2006-06-08 18:27:17 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2005-03-14 20:57:21 +00:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2014-04-21 20:09:15 +00:00
|
|
|
* Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
|
2015-12-08 10:56:25 -06:00
|
|
|
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
|
2015-06-23 20:59:57 -07:00
|
|
|
* reserved.
|
2017-01-28 10:09:44 -08:00
|
|
|
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
2005-03-14 20:57:21 +00:00
|
|
|
* $COPYRIGHT$
|
2006-06-08 18:27:17 +00:00
|
|
|
*
|
2005-03-14 20:57:21 +00:00
|
|
|
* Additional copyrights may follow
|
2006-06-08 18:27:17 +00:00
|
|
|
*
|
2005-03-14 20:57:21 +00: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 01:33:29 +00:00
|
|
|
#include "orte_config.h"
|
2015-12-08 10:56:25 -06:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
2005-03-14 20:57:21 +00:00
|
|
|
|
2009-03-13 02:10:32 +00:00
|
|
|
#include <string.h>
|
2005-08-25 16:38:42 +00:00
|
|
|
#include <sys/types.h>
|
2006-02-17 15:06:08 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-08-25 16:38:42 +00:00
|
|
|
#include <unistd.h>
|
2006-02-17 15:06:08 +00:00
|
|
|
#endif
|
2005-08-25 16:38:42 +00:00
|
|
|
#include <signal.h>
|
2006-02-17 15:06:08 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#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 15:27:47 +00:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
2006-02-17 15:06:08 +00:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
2005-08-25 16:38:42 +00:00
|
|
|
|
2014-09-08 20:38:46 +00:00
|
|
|
#include "opal/mca/base/base.h"
|
2007-04-21 00:15:05 +00:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
2005-08-24 22:19:48 +00:00
|
|
|
#include "opal/util/argv.h"
|
2009-02-14 02:26:12 +00:00
|
|
|
#include "opal/util/output.h"
|
2005-08-24 22:19:48 +00:00
|
|
|
#include "opal/util/opal_environ.h"
|
2005-08-25 16:38:42 +00:00
|
|
|
#include "opal/util/path.h"
|
2006-05-16 14:14:12 +00:00
|
|
|
#include "opal/util/basename.h"
|
2006-09-14 21:29:51 +00:00
|
|
|
|
2009-03-13 02:10:32 +00:00
|
|
|
#include "orte/constants.h"
|
|
|
|
#include "orte/types.h"
|
2008-06-09 14:53:58 +00:00
|
|
|
#include "orte/util/show_help.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/util/name_fns.h"
|
2017-06-05 15:22:28 -07:00
|
|
|
#include "orte/util/threads.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
2007-04-24 21:39:12 +00:00
|
|
|
#include "orte/runtime/orte_wait.h"
|
2010-07-17 21:03:27 +00:00
|
|
|
#include "orte/runtime/orte_quit.h"
|
2005-08-24 22:19:48 +00:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2017-04-05 17:32:39 -07:00
|
|
|
#include "orte/mca/rmaps/base/base.h"
|
2012-04-06 14:23:13 +00:00
|
|
|
#include "orte/mca/state/state.h"
|
2006-09-14 21:29:51 +00:00
|
|
|
|
2009-06-24 20:31:26 +00:00
|
|
|
#include "orte/orted/orted.h"
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/mca/plm/plm.h"
|
|
|
|
#include "orte/mca/plm/base/plm_private.h"
|
|
|
|
#include "plm_slurm.h"
|
2005-03-14 20:57:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_slurm_init(void);
|
|
|
|
static int plm_slurm_launch_job(orte_job_t *jdata);
|
|
|
|
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-09-30 21:44:05 +00:00
|
|
|
char *prefix);
|
2005-08-25 16:38:42 +00:00
|
|
|
|
2005-03-14 20:57:21 +00:00
|
|
|
|
2005-08-25 16:38:42 +00:00
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2008-02-28 01:57:57 +00: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 18:26:08 +00:00
|
|
|
NULL,
|
2009-07-13 02:29:17 +00:00
|
|
|
orte_plm_base_orted_terminate_job,
|
2008-02-28 01:57:57 +00:00
|
|
|
plm_slurm_terminate_orteds,
|
2009-07-13 02:29:17 +00:00
|
|
|
orte_plm_base_orted_kill_local_procs,
|
2008-02-28 01:57:57 +00:00
|
|
|
plm_slurm_signal_job,
|
|
|
|
plm_slurm_finalize
|
2005-03-14 20:57:21 +00:00
|
|
|
};
|
|
|
|
|
2005-08-25 16:38:42 +00:00
|
|
|
/*
|
2007-04-24 20:53:54 +00:00
|
|
|
* Local variables
|
2005-08-25 16:38:42 +00:00
|
|
|
*/
|
2009-03-03 16:39:13 +00:00
|
|
|
static pid_t primary_srun_pid = 0;
|
|
|
|
static bool primary_pid_set = false;
|
2012-04-06 14:23:13 +00:00
|
|
|
static void launch_daemons(int fd, short args, void *cbdata);
|
2005-03-14 20:57:21 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
/**
|
|
|
|
* Init the module
|
|
|
|
*/
|
|
|
|
static int plm_slurm_init(void)
|
|
|
|
{
|
|
|
|
int rc;
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_start())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
2012-04-06 14:23:13 +00:00
|
|
|
return rc;
|
2008-02-28 01:57:57 +00:00
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2011-12-05 22:01:08 +00:00
|
|
|
/* if we don't want to launch (e.g., someone just wants
|
|
|
|
* to test the mappers), then we assign vpids at "launch"
|
|
|
|
* so the mapper has something to work with
|
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 19:58:24 +00:00
|
|
|
*/
|
2011-12-05 22:01:08 +00:00
|
|
|
if (orte_do_not_launch) {
|
|
|
|
orte_plm_globals.daemon_nodes_assigned_at_launch = true;
|
|
|
|
} else {
|
|
|
|
/* we do NOT assign daemons to nodes at launch - we will
|
|
|
|
* determine that mapping when the daemon
|
|
|
|
* calls back. This is required because slurm does
|
|
|
|
* its own mapping of proc-to-node, and we cannot know
|
|
|
|
* in advance which daemon will wind up on which node
|
|
|
|
*/
|
|
|
|
orte_plm_globals.daemon_nodes_assigned_at_launch = false;
|
|
|
|
}
|
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 19:58:24 +00:00
|
|
|
|
2012-04-06 14:23:13 +00: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;
|
|
|
|
}
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2007-04-24 20:53:54 +00:00
|
|
|
/* When working in this function, ALWAYS jump to "cleanup" if
|
|
|
|
* you encounter an error so that orterun will be woken up and
|
|
|
|
* the job can cleanly terminate
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_slurm_launch_job(orte_job_t *jdata)
|
2012-04-06 14:23:13 +00:00
|
|
|
{
|
2014-06-01 17:59:06 +00:00
|
|
|
if (ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_RESTART)) {
|
2012-04-06 14:23:13 +00:00
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void launch_daemons(int fd, short args, void *cbdata)
|
2005-03-14 20:57:21 +00:00
|
|
|
{
|
2011-03-12 20:18:51 +00:00
|
|
|
orte_app_context_t *app;
|
|
|
|
orte_node_t *node;
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_std_cntr_t n;
|
|
|
|
orte_job_map_t *map;
|
2007-03-29 00:50:56 +00:00
|
|
|
char *jobid_string = NULL;
|
2007-04-10 14:23:32 +00:00
|
|
|
char *param;
|
2007-04-24 20:53:54 +00:00
|
|
|
char **argv = NULL;
|
2005-08-24 22:19:48 +00: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 18:26:24 +00:00
|
|
|
char *tmp;
|
2007-03-29 00:50:56 +00:00
|
|
|
char** env = NULL;
|
2005-08-25 22:29:23 +00:00
|
|
|
char *nodelist_flat;
|
|
|
|
char **nodelist_argv;
|
|
|
|
char *name_string;
|
2005-09-06 21:52:28 +00:00
|
|
|
char **custom_strings;
|
2005-09-30 21:44:05 +00:00
|
|
|
int num_args, i;
|
|
|
|
char *cur_prefix;
|
2008-02-28 01:57:57 +00:00
|
|
|
int proc_vpid_index;
|
2009-03-03 16:39:13 +00:00
|
|
|
bool failed_launch=true;
|
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 19:58:24 +00:00
|
|
|
orte_job_t *daemons;
|
2012-04-06 14:23:13 +00:00
|
|
|
orte_state_caddy_t *state = (orte_state_caddy_t*)cbdata;
|
|
|
|
|
2017-06-05 15:22:28 -07:00
|
|
|
ORTE_ACQUIRE_OBJECT(state);
|
|
|
|
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2012-04-06 14:23:13 +00:00
|
|
|
"%s plm:slurm: LAUNCH DAEMONS CALLED",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2009-03-03 16:39:13 +00:00
|
|
|
|
2012-01-18 00:19:49 +00:00
|
|
|
/* if we are launching debugger daemons, then just go
|
|
|
|
* do it - no new daemons will be launched
|
|
|
|
*/
|
2014-06-01 17:59:06 +00:00
|
|
|
if (ORTE_FLAG_TEST(state->jdata, ORTE_JOB_FLAG_DEBUGGER_DAEMON)) {
|
2012-05-02 21:00:22 +00:00
|
|
|
state->jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2012-04-06 14:23:13 +00:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(state->jdata, ORTE_JOB_STATE_DAEMONS_REPORTED);
|
|
|
|
OBJ_RELEASE(state);
|
|
|
|
return;
|
2012-01-18 00:19:49 +00:00
|
|
|
}
|
|
|
|
|
2012-04-06 14:23:13 +00:00
|
|
|
/* start by setting up the virtual machine */
|
|
|
|
daemons = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_setup_virtual_machine(state->jdata))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
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 15:27:47 +00:00
|
|
|
}
|
2012-04-06 14:23:13 +00:00
|
|
|
|
|
|
|
/* if we don't want to launch, then don't attempt to
|
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 19:58:24 +00:00
|
|
|
* launch the daemons - the user really wants to just
|
|
|
|
* look at the proposed process map
|
|
|
|
*/
|
|
|
|
if (orte_do_not_launch) {
|
2012-04-06 14:23:13 +00: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
|
|
|
|
*/
|
|
|
|
state->jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2012-05-02 21:00:22 +00:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(state->jdata, ORTE_JOB_STATE_DAEMONS_REPORTED);
|
2012-04-06 14:23:13 +00:00
|
|
|
OBJ_RELEASE(state);
|
|
|
|
return;
|
2005-08-24 22:19:48 +00:00
|
|
|
}
|
2009-06-06 01:08:47 +00:00
|
|
|
|
2008-02-28 01:57:57 +00: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 19:58:24 +00:00
|
|
|
if (NULL == (map = daemons->map)) {
|
2008-02-28 01:57:57 +00:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
rc = ORTE_ERR_NOT_FOUND;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
if (0 == map->num_new_daemons) {
|
2012-04-06 14:23:13 +00: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
|
|
|
|
*/
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:slurm: no new daemons to launch",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2012-04-06 14:23:13 +00:00
|
|
|
state->jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2013-08-29 22:50:51 +00:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(state->jdata, ORTE_JOB_STATE_DAEMONS_REPORTED);
|
2012-04-06 14:23:13 +00:00
|
|
|
OBJ_RELEASE(state);
|
|
|
|
return;
|
2006-09-14 21:29:51 +00: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 13:28:54 +00:00
|
|
|
|
2005-08-24 22:19:48 +00:00
|
|
|
/* need integer value for command line parameter */
|
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 19:58:24 +00:00
|
|
|
asprintf(&jobid_string, "%lu", (unsigned long) daemons->jobid);
|
2005-08-24 22:19:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* start building argv array
|
|
|
|
*/
|
|
|
|
argv = NULL;
|
|
|
|
argc = 0;
|
|
|
|
|
2005-08-25 22:29:23 +00:00
|
|
|
/*
|
|
|
|
* SLURM srun OPTIONS
|
|
|
|
*/
|
|
|
|
|
2005-08-25 16:38:42 +00:00
|
|
|
/* add the srun command */
|
|
|
|
opal_argv_append(&argc, &argv, "srun");
|
|
|
|
|
2013-12-09 17:58:46 +00:00
|
|
|
/* start one orted on each node */
|
|
|
|
opal_argv_append(&argc, &argv, "--ntasks-per-node=1");
|
|
|
|
|
2017-06-27 09:05:26 -07:00
|
|
|
if (!orte_enable_recovery) {
|
|
|
|
/* kill the job if any orteds die */
|
|
|
|
opal_argv_append(&argc, &argv, "--kill-on-bad-exit");
|
|
|
|
}
|
2011-07-07 18:54:30 +00:00
|
|
|
|
2014-03-29 18:30:38 +00:00
|
|
|
/* ensure the orteds are not bound to a single processor,
|
|
|
|
* just in case the TaskAffinity option is set by default.
|
|
|
|
* This will *not* release the orteds from any cpu-set
|
|
|
|
* constraint, but will ensure it doesn't get
|
|
|
|
* bound to only one processor
|
|
|
|
*/
|
|
|
|
opal_argv_append(&argc, &argv, "--cpu_bind=none");
|
|
|
|
|
2015-12-08 10:56:25 -06:00
|
|
|
#if SLURM_CRAY_ENV
|
|
|
|
/*
|
|
|
|
* If in a SLURM/Cray env. make sure that Cray PMI is not pulled in,
|
|
|
|
* neither as a constructor run when orteds start, nor selected
|
|
|
|
* when pmix components are registered
|
|
|
|
*/
|
|
|
|
|
|
|
|
opal_setenv("PMI_NO_PREINITIALIZE", "1", false, &orte_launch_environ);
|
|
|
|
opal_setenv("PMI_NO_FORK", "1", false, &orte_launch_environ);
|
|
|
|
opal_setenv("OMPI_NO_USE_CRAY_PMI", "1", false, &orte_launch_environ);
|
|
|
|
#endif
|
|
|
|
|
2005-09-06 21:52:28 +00:00
|
|
|
/* Append user defined arguments to srun */
|
2008-02-28 01:57:57 +00:00
|
|
|
if ( NULL != mca_plm_slurm_component.custom_args ) {
|
|
|
|
custom_strings = opal_argv_split(mca_plm_slurm_component.custom_args, ' ');
|
2005-09-06 21:52:28 +00: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);
|
|
|
|
}
|
|
|
|
|
2005-08-25 22:29:23 +00:00
|
|
|
/* create nodelist */
|
|
|
|
nodelist_argv = NULL;
|
|
|
|
|
2011-03-12 20:18:51 +00:00
|
|
|
for (n=0; n < map->nodes->size; n++ ) {
|
|
|
|
if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(map->nodes, n))) {
|
|
|
|
continue;
|
|
|
|
}
|
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 13:28:54 +00:00
|
|
|
/* if the daemon already exists on this node, then
|
|
|
|
* don't include it
|
|
|
|
*/
|
2014-06-01 17:59:06 +00:00
|
|
|
if (ORTE_FLAG_TEST(node, ORTE_NODE_FLAG_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 13:28:54 +00:00
|
|
|
continue;
|
|
|
|
}
|
2015-06-23 20:59:57 -07: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 13:28:54 +00:00
|
|
|
/* otherwise, add it to the list of nodes upon which
|
|
|
|
* we need to launch a daemon
|
|
|
|
*/
|
2011-03-12 20:18:51 +00:00
|
|
|
opal_argv_append_nosize(&nodelist_argv, node->name);
|
2005-08-25 22:29:23 +00:00
|
|
|
}
|
2007-07-12 19:53:18 +00: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-13 20:00:55 +00:00
|
|
|
orte_show_help("help-plm-slurm.txt", "no-hosts-in-list", true);
|
2007-07-12 19:53:18 +00:00
|
|
|
rc = ORTE_ERR_FAILED_TO_START;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2005-08-25 22:29:23 +00:00
|
|
|
nodelist_flat = opal_argv_join(nodelist_argv, ',');
|
2017-03-29 18:28:25 -07:00
|
|
|
opal_argv_free(nodelist_argv);
|
2011-07-07 18:54:30 +00:00
|
|
|
|
|
|
|
/* if we are using all allocated nodes, then srun doesn't
|
|
|
|
* require any further arguments
|
|
|
|
*/
|
|
|
|
if (map->num_new_daemons < orte_num_allocated_nodes) {
|
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 19:58:24 +00:00
|
|
|
asprintf(&tmp, "--nodes=%lu", (unsigned long)map->num_new_daemons);
|
2011-07-07 18:54:30 +00:00
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
|
|
|
|
asprintf(&tmp, "--nodelist=%s", nodelist_flat);
|
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
}
|
2005-08-25 22:29:23 +00:00
|
|
|
|
2012-01-26 19:58:57 +00:00
|
|
|
/* tell srun how many tasks to run */
|
|
|
|
asprintf(&tmp, "--ntasks=%lu", (unsigned long)map->num_new_daemons);
|
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_plm_base_framework.framework_output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:slurm: launching on nodes %s",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), nodelist_flat));
|
2017-04-11 09:14:58 -07:00
|
|
|
free(nodelist_flat);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2005-08-25 22:29:23 +00:00
|
|
|
/*
|
|
|
|
* ORTED OPTIONS
|
|
|
|
*/
|
|
|
|
|
2005-08-24 22:19:48 +00: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 18:26:24 +00:00
|
|
|
orte_plm_base_setup_orted_cmd(&argc, &argv);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2011-07-07 18:54:30 +00:00
|
|
|
/* Add basic orted command line options, including debug flags */
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_plm_base_orted_append_basic_args(&argc, &argv,
|
2017-03-29 18:28:25 -07:00
|
|
|
"slurm", &proc_vpid_index);
|
2005-08-25 22:29:23 +00: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 13:28:54 +00:00
|
|
|
/* tell the new daemons the base of the name list so they can compute
|
|
|
|
* their own name on the other end
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
rc = orte_util_convert_vpid_to_string(&name_string, map->daemon_vpid_start);
|
2005-08-25 22:29:23 +00:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_slurm: unable to get daemon vpid as string");
|
2005-08-25 22:29:23 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2007-03-30 13:43:50 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
free(argv[proc_vpid_index]);
|
|
|
|
argv[proc_vpid_index] = strdup(name_string);
|
2005-08-25 22:29:23 +00:00
|
|
|
free(name_string);
|
2005-08-24 22:19:48 +00:00
|
|
|
|
2006-10-07 15:45:24 +00: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 01:57:57 +00:00
|
|
|
the SLURM plm) */
|
2005-09-30 21:44:05 +00:00
|
|
|
cur_prefix = NULL;
|
2012-04-06 14:23:13 +00:00
|
|
|
for (n=0; n < state->jdata->apps->size; n++) {
|
2011-03-12 20:18:51 +00:00
|
|
|
char * app_prefix_dir;
|
2012-04-06 14:23:13 +00:00
|
|
|
if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(state->jdata->apps, n))) {
|
2011-03-12 20:18:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
2014-06-04 03:09:37 +00:00
|
|
|
app_prefix_dir = NULL;
|
2014-06-01 17:59:06 +00:00
|
|
|
orte_get_attribute(&app->attributes, ORTE_APP_PREFIX_DIR, (void**)&app_prefix_dir, OPAL_STRING);
|
2011-07-07 18:54:30 +00:00
|
|
|
/* Check for already set cur_prefix_dir -- if different,
|
2006-10-07 15:45:24 +00:00
|
|
|
complain */
|
|
|
|
if (NULL != app_prefix_dir) {
|
|
|
|
if (NULL != cur_prefix &&
|
|
|
|
0 != strcmp (cur_prefix, app_prefix_dir)) {
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-13 20:00:55 +00:00
|
|
|
orte_show_help("help-plm-slurm.txt", "multiple-prefixes",
|
2006-10-07 15:45:24 +00:00
|
|
|
true, cur_prefix, app_prefix_dir);
|
2012-04-06 14:23:13 +00:00
|
|
|
goto cleanup;
|
2006-10-07 15:45:24 +00:00
|
|
|
}
|
2005-09-30 21:44:05 +00:00
|
|
|
|
2006-10-07 15:45:24 +00:00
|
|
|
/* If not yet set, copy it; iff set, then it's the
|
2009-02-09 20:44:44 +00:00
|
|
|
* same anyway
|
|
|
|
*/
|
2006-10-07 15:45:24 +00:00
|
|
|
if (NULL == cur_prefix) {
|
|
|
|
cur_prefix = strdup(app_prefix_dir);
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:slurm: Set prefix:%s",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 01:57:57 +00:00
|
|
|
cur_prefix));
|
2005-09-30 21:44:05 +00:00
|
|
|
}
|
2014-06-01 17:59:06 +00:00
|
|
|
free(app_prefix_dir);
|
2005-09-30 21:44:05 +00:00
|
|
|
}
|
2006-10-07 15:45:24 +00:00
|
|
|
}
|
2005-08-24 22:19:48 +00:00
|
|
|
|
2014-09-08 20:38:46 +00:00
|
|
|
/* protect the args in case someone has a script wrapper around srun */
|
|
|
|
mca_base_cmd_line_wrap_args(argv);
|
|
|
|
|
2005-08-25 16:38:42 +00:00
|
|
|
/* setup environment */
|
2008-06-23 22:39:36 +00:00
|
|
|
env = opal_argv_copy(orte_launch_environ);
|
2008-02-28 01:57:57 +00:00
|
|
|
|
2013-03-27 21:14:43 +00:00
|
|
|
if (0 < opal_output_get_verbosity(orte_plm_base_framework.framework_output)) {
|
2009-06-23 20:25:38 +00:00
|
|
|
param = opal_argv_join(argv, ' ');
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2009-06-23 20:25:38 +00:00
|
|
|
"%s plm:slurm: final top-level argv:\n\t%s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
(NULL == param) ? "NULL" : param));
|
|
|
|
if (NULL != param) free(param);
|
|
|
|
}
|
2015-06-23 20:59:57 -07: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 13:28:54 +00:00
|
|
|
/* exec the daemon(s) */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = plm_slurm_start_proc(argc, argv, env, cur_prefix))) {
|
2007-04-24 20:53:54 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2012-04-06 14:23:13 +00:00
|
|
|
/* indicate that the daemons for this job were launched */
|
|
|
|
state->jdata->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
2012-05-02 21:00:22 +00:00
|
|
|
daemons->state = ORTE_JOB_STATE_DAEMONS_LAUNCHED;
|
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 19:58:24 +00:00
|
|
|
|
2012-04-06 14:23:13 +00:00
|
|
|
/* flag that launch was successful, so far as we currently know */
|
2007-04-24 20:53:54 +00:00
|
|
|
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 15:27:47 +00:00
|
|
|
|
2011-07-07 18:54:30 +00:00
|
|
|
cleanup:
|
2007-04-24 20:53:54 +00:00
|
|
|
if (NULL != argv) {
|
|
|
|
opal_argv_free(argv);
|
|
|
|
}
|
|
|
|
if (NULL != env) {
|
|
|
|
opal_argv_free(env);
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2007-03-29 00:50:56 +00:00
|
|
|
if(NULL != jobid_string) {
|
|
|
|
free(jobid_string);
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2012-04-06 14:23:13 +00:00
|
|
|
/* cleanup the caddy */
|
|
|
|
OBJ_RELEASE(state);
|
|
|
|
|
2007-04-24 20:53:54 +00: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 16:37:40 +00:00
|
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
2006-09-14 21:29:51 +00:00
|
|
|
}
|
2005-03-14 20:57:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-14 21:29:51 +00:00
|
|
|
/**
|
|
|
|
* Terminate the orteds for a given job
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_slurm_terminate_orteds(void)
|
2006-09-14 21:29:51 +00:00
|
|
|
{
|
2012-05-29 20:11:51 +00:00
|
|
|
int rc=ORTE_SUCCESS;
|
2009-03-03 16:39:13 +00:00
|
|
|
orte_job_t *jdata;
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2009-03-03 16:39:13 +00: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
|
|
|
|
*/
|
2012-04-06 14:23:13 +00:00
|
|
|
if (primary_pid_set) {
|
2014-03-05 04:38:17 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_orted_exit(ORTE_DAEMON_EXIT_CMD))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
2012-04-06 14:23:13 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2009-03-03 16:39:13 +00:00
|
|
|
"%s plm:slurm: primary daemons complete!",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2009-03-03 16:39:13 +00:00
|
|
|
jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
|
|
|
/* need to set the #terminated value to avoid an incorrect error msg */
|
|
|
|
jdata->num_terminated = jdata->num_procs;
|
2012-04-06 14:23:13 +00:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DAEMONS_TERMINATED);
|
2009-03-03 16:39:13 +00:00
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2006-09-14 21:29:51 +00:00
|
|
|
return rc;
|
2005-03-14 20:57:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-08 18:27:17 +00:00
|
|
|
/**
|
|
|
|
* Signal all the processes in the child srun by sending the signal directly to it
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_slurm_signal_job(orte_jobid_t jobid, int32_t signal)
|
2006-06-08 18:27:17 +00:00
|
|
|
{
|
2008-02-28 01:57:57 +00:00
|
|
|
int rc = ORTE_SUCCESS;
|
2006-06-08 18:27:17 +00:00
|
|
|
|
2008-02-28 01:57:57 +00: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 18:27:17 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
return rc;
|
2006-06-08 18:27:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_slurm_finalize(void)
|
2005-03-14 20:57:21 +00:00
|
|
|
{
|
2006-09-14 21:29:51 +00:00
|
|
|
int rc;
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2006-09-14 21:29:51 +00:00
|
|
|
/* cleanup any pending recvs */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_stop())) {
|
2006-09-14 21:29:51 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2005-08-24 22:19:48 +00:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-17 23:40:31 +00:00
|
|
|
static void srun_wait_cb(orte_proc_t *proc, void* cbdata){
|
2009-03-03 16:39:13 +00:00
|
|
|
orte_job_t *jdata;
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2009-03-03 16:39:13 +00: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.
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2009-03-03 16:39:13 +00:00
|
|
|
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!
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2009-03-03 16:39:13 +00: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
|
|
|
|
*/
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2012-04-06 14:23:13 +00:00
|
|
|
jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
|
|
|
|
2017-06-05 15:22:28 -07:00
|
|
|
/* abort only if the status returned is non-zero - i.e., if
|
|
|
|
* the orteds exited with an error
|
|
|
|
*/
|
|
|
|
if (0 != proc->exit_code) {
|
|
|
|
/* an orted must have died unexpectedly - report
|
|
|
|
* that the daemon has failed so we exit
|
|
|
|
*/
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2017-06-05 15:22:28 -07:00
|
|
|
"%s plm:slurm: daemon failed while running",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2017-06-05 15:22:28 -07:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_ABORTED);
|
2009-03-03 16:39:13 +00:00
|
|
|
} else {
|
|
|
|
/* otherwise, check to see if this is the primary pid */
|
2014-06-17 23:40:31 +00:00
|
|
|
if (primary_srun_pid == proc->pid) {
|
2009-03-03 16:39:13 +00:00
|
|
|
/* in this case, we just want to fire the proper trigger so
|
|
|
|
* mpirun can exit
|
|
|
|
*/
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2009-03-03 16:39:13 +00:00
|
|
|
"%s plm:slurm: primary daemons complete!",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2009-03-03 16:39:13 +00:00
|
|
|
/* need to set the #terminated value to avoid an incorrect error msg */
|
|
|
|
jdata->num_terminated = jdata->num_procs;
|
2012-04-06 14:23:13 +00:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DAEMONS_TERMINATED);
|
2009-03-03 16:39:13 +00:00
|
|
|
}
|
2007-04-24 20:53:54 +00:00
|
|
|
}
|
2017-06-05 15:22:28 -07:00
|
|
|
|
2014-06-17 23:40:31 +00:00
|
|
|
/* done with this dummy */
|
|
|
|
OBJ_RELEASE(proc);
|
2007-04-24 20:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_slurm_start_proc(int argc, char **argv, char **env,
|
2005-09-30 21:44:05 +00:00
|
|
|
char *prefix)
|
2005-08-24 22:19:48 +00:00
|
|
|
{
|
2007-07-12 19:53:18 +00:00
|
|
|
int fd;
|
2009-03-03 16:39:13 +00:00
|
|
|
int srun_pid;
|
2005-08-25 16:38:42 +00:00
|
|
|
char *exec_argv = opal_path_findv(argv[0], 0, env, NULL);
|
2014-06-17 23:40:31 +00:00
|
|
|
orte_proc_t *dummy;
|
2005-08-24 22:19:48 +00:00
|
|
|
|
2005-08-25 16:38:42 +00:00
|
|
|
if (NULL == exec_argv) {
|
2017-06-09 07:46:47 -07:00
|
|
|
orte_show_help("help-plm-slurm.txt", "no-srun", true);
|
|
|
|
return ORTE_ERR_SILENT;
|
2005-08-25 16:38:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
srun_pid = fork();
|
|
|
|
if (-1 == srun_pid) {
|
2007-04-24 20:53:54 +00:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_CHILDREN);
|
2008-03-25 22:42:24 +00:00
|
|
|
free(exec_argv);
|
2007-04-24 20:53:54 +00:00
|
|
|
return ORTE_ERR_SYS_LIMITS_CHILDREN;
|
|
|
|
}
|
2017-06-05 15:22:28 -07:00
|
|
|
/* if this is the primary launch - i.e., not a comm_spawn of a
|
|
|
|
* child job - then save the pid
|
|
|
|
*/
|
|
|
|
if (0 < srun_pid && !primary_pid_set) {
|
|
|
|
primary_srun_pid = srun_pid;
|
|
|
|
primary_pid_set = true;
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2014-06-17 23:40:31 +00:00
|
|
|
/* setup a dummy proc object to track the srun */
|
|
|
|
dummy = OBJ_NEW(orte_proc_t);
|
|
|
|
dummy->pid = srun_pid;
|
2014-06-18 14:04:55 +00:00
|
|
|
/* be sure to mark it as alive so we don't instantly fire */
|
|
|
|
ORTE_FLAG_SET(dummy, ORTE_PROC_FLAG_ALIVE);
|
2014-06-17 23:40:31 +00:00
|
|
|
/* setup the waitpid so we can find out if srun succeeds! */
|
|
|
|
orte_wait_cb(dummy, srun_wait_cb, NULL);
|
|
|
|
|
2007-04-24 20:53:54 +00:00
|
|
|
if (0 == srun_pid) { /* child */
|
2006-05-16 14:14:12 +00:00
|
|
|
char *bin_base = NULL, *lib_base = NULL;
|
2006-06-08 18:27:17 +00:00
|
|
|
|
2006-05-16 14:14:12 +00:00
|
|
|
/* Figure out the basenames for the libdir and bindir. There
|
2008-02-28 01:57:57 +00:00
|
|
|
is a lengthy comment about this in plm_rsh_module.c
|
2006-05-16 14:14:12 +00:00
|
|
|
explaining all the rationale for how / why we're doing
|
|
|
|
this. */
|
|
|
|
|
2007-04-21 00:15:05 +00:00
|
|
|
lib_base = opal_basename(opal_install_dirs.libdir);
|
|
|
|
bin_base = opal_basename(opal_install_dirs.bindir);
|
2006-05-16 14:14:12 +00:00
|
|
|
|
2005-09-30 21:44:05 +00:00
|
|
|
/* If we have a prefix, then modify the PATH and
|
2007-01-22 15:50:35 +00:00
|
|
|
LD_LIBRARY_PATH environment variables. */
|
2005-09-30 21:44:05 +00:00
|
|
|
if (NULL != prefix) {
|
|
|
|
char *oldenv, *newenv;
|
2006-06-08 18:27:17 +00:00
|
|
|
|
2005-09-30 21:44:05 +00:00
|
|
|
/* Reset PATH */
|
|
|
|
oldenv = getenv("PATH");
|
|
|
|
if (NULL != oldenv) {
|
2006-05-16 14:14:12 +00:00
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, bin_base, oldenv);
|
2005-09-30 21:44:05 +00:00
|
|
|
} else {
|
2006-05-16 14:14:12 +00:00
|
|
|
asprintf(&newenv, "%s/%s", prefix, bin_base);
|
2005-09-30 21:44:05 +00:00
|
|
|
}
|
2007-01-22 15:50:35 +00:00
|
|
|
opal_setenv("PATH", newenv, true, &env);
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:slurm: reset PATH: %s",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 01:57:57 +00:00
|
|
|
newenv));
|
2005-09-30 21:44:05 +00:00
|
|
|
free(newenv);
|
2006-06-08 18:27:17 +00:00
|
|
|
|
2005-09-30 21:44:05 +00:00
|
|
|
/* Reset LD_LIBRARY_PATH */
|
|
|
|
oldenv = getenv("LD_LIBRARY_PATH");
|
|
|
|
if (NULL != oldenv) {
|
2006-05-16 14:14:12 +00:00
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, lib_base, oldenv);
|
2005-09-30 21:44:05 +00:00
|
|
|
} else {
|
2006-05-16 14:14:12 +00:00
|
|
|
asprintf(&newenv, "%s/%s", prefix, lib_base);
|
2005-09-30 21:44:05 +00:00
|
|
|
}
|
2007-01-22 15:50:35 +00:00
|
|
|
opal_setenv("LD_LIBRARY_PATH", newenv, true, &env);
|
2013-03-27 21:14:43 +00:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
|
2008-02-28 01:57:57 +00:00
|
|
|
"%s plm:slurm: reset LD_LIBRARY_PATH: %s",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-02-28 01:57:57 +00:00
|
|
|
newenv));
|
2005-09-30 21:44:05 +00:00
|
|
|
free(newenv);
|
|
|
|
}
|
|
|
|
|
2014-04-08 21:46:07 +00:00
|
|
|
fd = open("/dev/null", O_CREAT|O_RDWR|O_TRUNC, 0666);
|
|
|
|
if (fd >= 0) {
|
2007-08-16 20:49:27 +00:00
|
|
|
dup2(fd, 0);
|
2014-04-08 19:51:11 +00:00
|
|
|
/* When not in debug mode and --debug-daemons was not passed,
|
|
|
|
* tie stdout/stderr to dev null so we don't see messages from orted
|
|
|
|
* EXCEPT if the user has requested that we leave sessions attached
|
|
|
|
*/
|
|
|
|
if (0 > opal_output_get_verbosity(orte_plm_base_framework.framework_output) &&
|
|
|
|
!orte_debug_daemons_flag && !orte_leave_session_attached) {
|
|
|
|
dup2(fd,1);
|
|
|
|
dup2(fd,2);
|
2006-02-17 15:06:08 +00:00
|
|
|
}
|
2014-04-21 20:09:15 +00:00
|
|
|
|
|
|
|
/* Don't leave the extra fd to /dev/null open */
|
|
|
|
if (fd > 2) {
|
|
|
|
close(fd);
|
|
|
|
}
|
2006-02-17 15:06:08 +00:00
|
|
|
}
|
2006-02-16 20:40:23 +00:00
|
|
|
|
2005-08-27 17:08:48 +00: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-25 22:29:23 +00:00
|
|
|
execve(exec_argv, argv, env);
|
2006-09-14 21:29:51 +00:00
|
|
|
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm:slurm:start_proc: exec failed");
|
2005-08-27 17:08:48 +00:00
|
|
|
/* don't return - need to exit - returning would be bad -
|
|
|
|
we're not in the calling process anymore */
|
|
|
|
exit(1);
|
2007-04-24 20:53:54 +00:00
|
|
|
} else { /* parent */
|
|
|
|
/* just in case, make sure that the srun process is not in our
|
2014-04-08 19:51:11 +00:00
|
|
|
process group any more. Stevens says always do this on both
|
|
|
|
sides of the fork... */
|
2007-04-24 20:53:54 +00:00
|
|
|
setpgid(srun_pid, srun_pid);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2007-04-24 20:53:54 +00:00
|
|
|
free(exec_argv);
|
2005-08-25 16:38:42 +00:00
|
|
|
}
|
2005-08-24 22:19:48 +00:00
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
2005-03-14 20:57:21 +00:00
|
|
|
}
|