2014-05-13 22:36:54 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2008-02-17 19:29:06 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2011-07-07 18:54:30 +00:00
|
|
|
* Copyright (c) 2006-2011 Cisco Systems, Inc. All rights reserved.
|
2015-01-07 12:33:38 -07: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.
|
2008-02-17 19:29:06 +00: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 01:57:57 +00:00
|
|
|
#include "orte/constants.h"
|
|
|
|
#include "orte/types.h"
|
2008-02-17 19:29:06 +00:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdlib.h>
|
2009-04-29 08:11:37 +00:00
|
|
|
#include <string.h>
|
2008-02-17 19:29:06 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
|
2014-09-08 20:38:46 +00:00
|
|
|
#include "opal/mca/base/base.h"
|
2008-02-17 19:29:06 +00:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
|
|
|
#include "opal/util/argv.h"
|
2009-02-14 02:26:12 +00:00
|
|
|
#include "opal/util/output.h"
|
2008-02-17 19:29:06 +00:00
|
|
|
#include "opal/util/opal_environ.h"
|
|
|
|
#include "opal/util/path.h"
|
|
|
|
#include "opal/util/basename.h"
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
#include "orte/util/name_fns.h"
|
2017-06-05 15:22:28 -07:00
|
|
|
#include "orte/util/show_help.h"
|
|
|
|
#include "orte/util/threads.h"
|
2008-02-17 19:29:06 +00:00
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
2012-04-06 14:23:13 +00:00
|
|
|
#include "orte/mca/state/state.h"
|
2008-02-17 19:29:06 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/mca/plm/plm.h"
|
|
|
|
#include "orte/mca/plm/base/base.h"
|
|
|
|
#include "orte/mca/plm/base/plm_private.h"
|
|
|
|
#include "plm_alps.h"
|
2008-02-17 19:29:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_alps_init(void);
|
|
|
|
static int plm_alps_launch_job(orte_job_t *jdata);
|
|
|
|
static int plm_alps_terminate_orteds(void);
|
|
|
|
static int plm_alps_signal_job(orte_jobid_t jobid, int32_t signal);
|
|
|
|
static int plm_alps_finalize(void);
|
|
|
|
|
|
|
|
static int plm_alps_start_proc(int argc, char **argv, char **env,
|
2008-02-17 19:29:06 +00:00
|
|
|
char *prefix);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_plm_base_module_t orte_plm_alps_module = {
|
|
|
|
plm_alps_init,
|
|
|
|
orte_plm_base_set_hnp_name,
|
|
|
|
plm_alps_launch_job,
|
2008-04-14 19:36:13 +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_alps_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_alps_signal_job,
|
|
|
|
plm_alps_finalize
|
2008-02-17 19:29:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables
|
|
|
|
*/
|
2014-06-17 23:40:31 +00:00
|
|
|
static orte_proc_t *alpsrun = NULL;
|
2008-02-17 19:29:06 +00:00
|
|
|
static bool failed_launch;
|
2012-04-06 14:23:13 +00:00
|
|
|
static void launch_daemons(int fd, short args, void *cbdata);
|
2008-02-17 19:29:06 +00:00
|
|
|
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
/**
|
|
|
|
* Init the module
|
|
|
|
*/
|
|
|
|
static int plm_alps_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
|
|
|
}
|
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) {
|
|
|
|
/* must map daemons since we won't be launching them */
|
|
|
|
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 alps 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-17 19:29:06 +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_alps_launch_job(orte_job_t *jdata)
|
2012-04-06 14:23:13 +00:00
|
|
|
{
|
2014-05-22 16:04:36 +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)
|
2008-02-17 19:29:06 +00:00
|
|
|
{
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_job_map_t *map;
|
2008-02-17 19:29:06 +00:00
|
|
|
char *jobid_string = NULL;
|
|
|
|
char *param;
|
|
|
|
char **argv = NULL;
|
|
|
|
int argc;
|
|
|
|
int rc;
|
|
|
|
char *tmp;
|
|
|
|
char** env = NULL;
|
|
|
|
char *nodelist_flat;
|
|
|
|
char **nodelist_argv;
|
|
|
|
int nodelist_argc;
|
2008-02-28 01:57:57 +00:00
|
|
|
char *vpid_string;
|
2008-02-17 19:29:06 +00:00
|
|
|
char **custom_strings;
|
|
|
|
int num_args, i;
|
|
|
|
char *cur_prefix;
|
2008-02-28 01:57:57 +00:00
|
|
|
int proc_vpid_index;
|
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_app_context_t *app;
|
|
|
|
orte_node_t *node;
|
2008-02-28 01:57:57 +00:00
|
|
|
orte_std_cntr_t nnode;
|
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-02-01 16:33:14 -08:00
|
|
|
char *ltmp;
|
2008-08-19 15:19:30 +00:00
|
|
|
|
2017-06-05 15:22:28 -07:00
|
|
|
ORTE_ACQUIRE_OBJECT(state);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-12-05 22:01:08 +00:00
|
|
|
/* start by setting up the virtual machine */
|
|
|
|
daemons = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
2012-04-06 14:23:13 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_setup_virtual_machine(state->jdata))) {
|
2011-12-05 22:01:08 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
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;
|
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
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
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
|
|
|
|
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:alps: 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;
|
2014-03-18 01:24:49 +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;
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-17 19:29:06 +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
|
|
|
orte_util_convert_jobid_to_string(&jobid_string, daemons->jobid);
|
2008-02-17 19:29:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* start building argv array
|
|
|
|
*/
|
|
|
|
argv = NULL;
|
|
|
|
argc = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ALPS aprun OPTIONS
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* add the aprun command */
|
2010-08-12 14:41:35 +00:00
|
|
|
opal_argv_append(&argc, &argv, mca_plm_alps_component.aprun_cmd);
|
2008-02-17 19:29:06 +00:00
|
|
|
|
|
|
|
/* Append user defined arguments to aprun */
|
2008-02-28 01:57:57 +00:00
|
|
|
if ( NULL != mca_plm_alps_component.custom_args ) {
|
|
|
|
custom_strings = opal_argv_split(mca_plm_alps_component.custom_args, ' ');
|
2008-02-17 19:29:06 +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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* number of processors needed */
|
2009-08-07 01:15:09 +00:00
|
|
|
opal_argv_append(&argc, &argv, "-n");
|
|
|
|
asprintf(&tmp, "%lu", (unsigned long) map->num_new_daemons);
|
2008-02-17 19:29:06 +00:00
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
2009-08-07 01:15:09 +00:00
|
|
|
opal_argv_append(&argc, &argv, "-N");
|
|
|
|
opal_argv_append(&argc, &argv, "1");
|
2011-10-21 22:52:03 +00:00
|
|
|
opal_argv_append(&argc, &argv, "-cc");
|
|
|
|
opal_argv_append(&argc, &argv, "none");
|
2015-07-23 15:00:53 -07:00
|
|
|
/*
|
|
|
|
* stuff below is necessary in the event that we've sadly configured Open MPI with --disable-dlopen,
|
|
|
|
* which results in the orted's being linked against all kinds of unnecessary cray libraries, including
|
|
|
|
* the cray pmi, which has a ctor that cause bad things if run when using mpirun/orted based launch.
|
|
|
|
*
|
|
|
|
* Code below adds env. variables for aprun to forward which suppresses the action of the Cray PMI ctor.
|
|
|
|
*/
|
|
|
|
opal_argv_append(&argc, &argv, "-e");
|
|
|
|
opal_argv_append(&argc, &argv, "PMI_NO_PREINITIALIZE=1");
|
|
|
|
opal_argv_append(&argc, &argv, "-e");
|
|
|
|
opal_argv_append(&argc, &argv, "PMI_NO_FORK=1");
|
2015-06-18 09:53:20 -07:00
|
|
|
opal_argv_append(&argc, &argv, "-e");
|
|
|
|
opal_argv_append(&argc, &argv, "OMPI_NO_USE_CRAY_PMI=1");
|
2008-02-17 19:29:06 +00:00
|
|
|
|
2011-08-09 22:42:27 +00:00
|
|
|
/* if we are using all allocated nodes, then alps
|
2014-10-02 10:42:01 -06:00
|
|
|
* doesn't need a nodelist, or if running without a batch scheduler
|
2011-08-09 22:42:27 +00:00
|
|
|
*/
|
2014-10-02 10:42:01 -06:00
|
|
|
if ((map->num_new_daemons < orte_num_allocated_nodes) || (orte_num_allocated_nodes == 0)) {
|
2017-03-29 18:28:25 -07:00
|
|
|
/* create nodelist */
|
|
|
|
nodelist_argv = NULL;
|
|
|
|
nodelist_argc = 0;
|
|
|
|
|
|
|
|
for (nnode=0; nnode < map->nodes->size; nnode++) {
|
|
|
|
if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(map->nodes, nnode))) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if the daemon already exists on this node, then
|
|
|
|
* don't include it
|
|
|
|
*/
|
|
|
|
if (ORTE_FLAG_TEST(node, ORTE_NODE_FLAG_DAEMON_LAUNCHED)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* otherwise, add it to the list of nodes upon which
|
|
|
|
* we need to launch a daemon
|
|
|
|
*/
|
|
|
|
opal_argv_append(&nodelist_argc, &nodelist_argv, node->name);
|
|
|
|
}
|
|
|
|
if (0 == opal_argv_count(nodelist_argv)) {
|
|
|
|
orte_show_help("help-plm-alps.txt", "no-hosts-in-list", true);
|
|
|
|
rc = ORTE_ERR_FAILED_TO_START;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
nodelist_flat = opal_argv_join(nodelist_argv, ',');
|
|
|
|
opal_argv_free(nodelist_argv);
|
|
|
|
|
2011-08-09 22:42:27 +00:00
|
|
|
opal_argv_append(&argc, &argv, "-L");
|
|
|
|
opal_argv_append(&argc, &argv, nodelist_flat);
|
2017-03-29 18:28:25 -07:00
|
|
|
free(nodelist_flat);
|
2011-08-09 22:42:27 +00:00
|
|
|
}
|
2008-02-17 19:29:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ORTED OPTIONS
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* add the daemon command (as specified by user) */
|
Per the July technical meeting:
Standardize the handling of the orte launch agent option across PLMs. This has been a consistent complaint I have received - each PLM would register its own MCA param to get input on the launch agent for remote nodes (in fact, one or two didn't, but most did). This would then get handled in various and contradictory ways.
Some PLMs would accept only a one-word input. Others accepted multi-word args such as "valgrind orted", but then some would error by putting any prefix specified on the cmd line in front of the incorrect argument.
For example, while using the rsh launcher, if you specified "valgrind orted" as your launch agent and had "--prefix foo" on you cmd line, you would attempt to execute "ssh foo/valgrind orted" - which obviously wouldn't work.
This was all -very- confusing to users, who had to know which PLM was being used so they could even set the right mca param in the first place! And since we don't warn about non-recognized or non-used mca params, half of the time they would wind up not doing what they thought they were telling us to do.
To solve this problem, we did the following:
1. removed all mca params from the individual plms for the launch agent
2. added a new mca param "orte_launch_agent" for this purpose. To further simplify for users, this comes with a new cmd line option "--launch-agent" that can take a multi-word string argument. The value of the param defaults to "orted".
3. added a PLM base function that processes the orte_launch_agent value and adds the contents to a provided argv array. This can subsequently be harvested at-will to handle multi-word values
4. modified the PLMs to use this new function. All the PLMs except for the rsh PLM required very minor change - just called the function and moved on. The rsh PLM required much larger changes as - because of the rsh/ssh cmd line limitations - we had to correctly prepend any provided prefix to the correct argv entry.
5. added a new opal_argv_join_range function that allows the caller to "join" argv entries between two specified indices
Please let me know of any problems. I tried to make this as clean as possible, but cannot compile all PLMs to ensure all is correct.
This commit was SVN r19097.
2008-07-30 18:26:24 +00:00
|
|
|
orte_plm_base_setup_orted_cmd(&argc, &argv);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-17 19:29:06 +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,
|
2012-01-18 20:56:53 +00:00
|
|
|
NULL,
|
2017-03-29 18:28:25 -07:00
|
|
|
&proc_vpid_index);
|
2008-02-17 19:29:06 +00:00
|
|
|
|
|
|
|
/* tell the new daemons the base of the name list so they can compute
|
|
|
|
* their own name on the other end
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
rc = orte_util_convert_vpid_to_string(&vpid_string, map->daemon_vpid_start);
|
2008-02-17 19:29:06 +00:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm_alps: unable to create process name");
|
2008-02-17 19:29:06 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
free(argv[proc_vpid_index]);
|
|
|
|
argv[proc_vpid_index] = strdup(vpid_string);
|
|
|
|
free(vpid_string);
|
2008-02-17 19:29:06 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-02-17 19:29:06 +00:00
|
|
|
param = opal_argv_join(argv, ' ');
|
|
|
|
if (NULL != param) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm:alps: final top-level argv:");
|
|
|
|
opal_output(0, "plm:alps: %s", param);
|
2008-02-17 19:29:06 +00:00
|
|
|
free(param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the prefix-directory specified in the
|
|
|
|
corresponding app_context. If there are multiple,
|
|
|
|
different prefix's in the app context, complain (i.e., only
|
|
|
|
allow one --prefix option for the entire alps run -- we
|
|
|
|
don't support different --prefix'es for different nodes in
|
2008-02-28 01:57:57 +00:00
|
|
|
the ALPS plm) */
|
2008-02-17 19:29:06 +00:00
|
|
|
cur_prefix = NULL;
|
2012-04-06 14:23:13 +00:00
|
|
|
for (i=0; i < state->jdata->apps->size; i++) {
|
2014-06-24 21:29:04 +00:00
|
|
|
char *app_prefix_dir = NULL;
|
2012-04-06 14:23:13 +00:00
|
|
|
if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(state->jdata->apps, i))) {
|
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
|
|
|
continue;
|
|
|
|
}
|
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,
|
2008-02-17 19:29:06 +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-alps.txt", "multiple-prefixes",
|
2008-02-17 19:29:06 +00:00
|
|
|
true, cur_prefix, app_prefix_dir);
|
2012-04-06 14:23:13 +00:00
|
|
|
goto cleanup;
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If not yet set, copy it; iff set, then it's the
|
|
|
|
same anyway */
|
|
|
|
if (NULL == cur_prefix) {
|
|
|
|
cur_prefix = strdup(app_prefix_dir);
|
2008-02-28 01:57:57 +00:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output (0, "plm:alps: Set prefix:%s",
|
2008-02-17 19:29:06 +00:00
|
|
|
cur_prefix);
|
|
|
|
}
|
|
|
|
}
|
2014-06-01 17:59:06 +00:00
|
|
|
free(app_prefix_dir);
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-08 20:38:46 +00:00
|
|
|
/* protect the args in case someone has a script wrapper around aprun */
|
|
|
|
mca_base_cmd_line_wrap_args(argv);
|
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
/* setup environment */
|
2008-06-23 22:39:36 +00:00
|
|
|
env = opal_argv_copy(orte_launch_environ);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2013-03-27 21:14:43 +00:00
|
|
|
if (0 < opal_output_get_verbosity(orte_plm_base_framework.framework_output)) {
|
2012-04-06 14:23:13 +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,
|
2012-04-06 14:23:13 +00:00
|
|
|
"%s plm:alps: final top-level argv:\n\t%s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
(NULL == param) ? "NULL" : param));
|
|
|
|
if (NULL != param) free(param);
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
/* exec the daemon(s) */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = plm_alps_start_proc(argc, argv, env, cur_prefix))) {
|
2008-02-17 19:29:06 +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 */
|
2008-02-17 19:29:06 +00:00
|
|
|
failed_launch = false;
|
|
|
|
|
2011-07-07 18:54:30 +00:00
|
|
|
cleanup:
|
2008-02-17 19:29:06 +00:00
|
|
|
if (NULL != argv) {
|
|
|
|
opal_argv_free(argv);
|
|
|
|
}
|
|
|
|
if (NULL != env) {
|
|
|
|
opal_argv_free(env);
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-17 19:29:06 +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);
|
|
|
|
|
2008-02-17 19:29:06 +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);
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Terminate the orteds for a given job
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_alps_terminate_orteds(void)
|
2008-02-17 19:29:06 +00:00
|
|
|
{
|
|
|
|
int rc;
|
2015-01-07 12:28:58 -07:00
|
|
|
orte_job_t *jdata;
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2015-01-07 12:28:58 -07:00
|
|
|
OPAL_OUTPUT_VERBOSE((10, orte_plm_base_framework.framework_output,
|
|
|
|
"%s plm:alps: terminating orteds",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
/* deregister the waitpid callback to ensure we don't make it look like
|
|
|
|
* alps failed when it didn't. Since the alps may have already completed,
|
|
|
|
* do NOT ERROR_LOG any return code to avoid confusing, duplicate error
|
|
|
|
* messages
|
|
|
|
*/
|
2014-06-17 23:40:31 +00:00
|
|
|
if (NULL != alpsrun) {
|
|
|
|
orte_wait_cb_cancel(alpsrun);
|
|
|
|
}
|
|
|
|
|
2011-08-09 17:42:19 +00:00
|
|
|
/* now tell them to die */
|
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);
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2015-01-07 12:28:58 -07:00
|
|
|
jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DAEMONS_TERMINATED);
|
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((10, orte_plm_base_framework.framework_output,
|
|
|
|
"%s plm:alps: terminated orteds",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2008-02-17 19:29:06 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signal all the processes in the child alps by sending the signal directly to it
|
|
|
|
*/
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_alps_signal_job(orte_jobid_t jobid, int32_t signal)
|
2008-02-17 19:29:06 +00:00
|
|
|
{
|
2014-06-17 23:40:31 +00:00
|
|
|
if (NULL != alpsrun && 0 != alpsrun->pid) {
|
|
|
|
kill(alpsrun->pid, (int)signal);
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_alps_finalize(void)
|
2008-02-17 19:29:06 +00:00
|
|
|
{
|
|
|
|
int rc;
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2014-06-17 23:40:31 +00:00
|
|
|
if (NULL != alpsrun) {
|
|
|
|
OBJ_RELEASE(alpsrun);
|
|
|
|
}
|
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
/* cleanup any pending recvs */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_plm_base_comm_stop())) {
|
2008-02-17 19:29:06 +00:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-17 23:40:31 +00:00
|
|
|
static void alps_wait_cb(orte_proc_t *proc, void* cbdata){
|
2012-04-06 14:23:13 +00:00
|
|
|
orte_job_t *jdata;
|
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
/* According to the ALPS folks, alps always returns the highest exit
|
|
|
|
code of our remote processes. Thus, a non-zero exit status doesn't
|
|
|
|
necessarily mean that alps failed - it could be that an orted returned
|
|
|
|
a non-zero exit status. Of course, that means the orted failed(!), so
|
|
|
|
the end result is the same - the job didn't start.
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
As a result, we really can't do much with the exit status itself - it
|
|
|
|
could be something in errno (if alps itself failed), or it could be
|
|
|
|
something returned by an orted, or it could be something returned by
|
|
|
|
the OS (e.g., couldn't find the orted binary). Somebody is welcome
|
|
|
|
to sort out all the options and pretty-print a better error message. For
|
|
|
|
now, though, the only thing that really matters is that
|
|
|
|
alps failed. Report the error and make sure that orterun
|
|
|
|
wakes up - otherwise, do nothing!
|
|
|
|
*/
|
2012-04-06 14:23:13 +00:00
|
|
|
jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2014-06-17 23:40:31 +00:00
|
|
|
if (0 != proc->exit_code) {
|
2008-02-17 19:29:06 +00:00
|
|
|
if (failed_launch) {
|
2014-05-13 22:36:54 +00:00
|
|
|
/* report that the daemon has failed so we break out of the daemon
|
2008-02-17 19:29:06 +00:00
|
|
|
* callback receive and exit
|
|
|
|
*/
|
2015-06-23 20:59:57 -07:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_FAILED_TO_START);
|
2008-02-17 19:29:06 +00:00
|
|
|
} else {
|
|
|
|
/* an orted must have died unexpectedly after launch - report
|
|
|
|
* that the daemon has failed so we exit
|
|
|
|
*/
|
2012-04-06 14:23:13 +00:00
|
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_ABORTED);
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
static int plm_alps_start_proc(int argc, char **argv, char **env,
|
2008-02-17 19:29:06 +00:00
|
|
|
char *prefix)
|
|
|
|
{
|
|
|
|
int fd;
|
2014-06-24 21:29:04 +00:00
|
|
|
pid_t alps_pid;
|
2008-02-17 19:29:06 +00:00
|
|
|
char *exec_argv = opal_path_findv(argv[0], 0, env, NULL);
|
|
|
|
|
|
|
|
if (NULL == exec_argv) {
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
alps_pid = fork();
|
|
|
|
if (-1 == alps_pid) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_CHILDREN);
|
|
|
|
return ORTE_ERR_SYS_LIMITS_CHILDREN;
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2014-06-17 23:40:31 +00:00
|
|
|
alpsrun = OBJ_NEW(orte_proc_t);
|
|
|
|
alpsrun->pid = alps_pid;
|
2014-06-18 14:04:55 +00:00
|
|
|
/* be sure to mark it as alive so we don't instantly fire */
|
2014-06-24 21:29:04 +00:00
|
|
|
ORTE_FLAG_SET(alpsrun, ORTE_PROC_FLAG_ALIVE);
|
2014-06-17 23:40:31 +00:00
|
|
|
/* setup the waitpid so we can find out if alps succeeds! */
|
|
|
|
orte_wait_cb(alpsrun, alps_wait_cb, NULL);
|
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
if (0 == alps_pid) { /* child */
|
|
|
|
char *bin_base = NULL, *lib_base = NULL;
|
|
|
|
|
|
|
|
/* Figure out the basenames for the libdir and bindir. There
|
2008-02-28 01:57:57 +00:00
|
|
|
is a lengthy comment about this in plm_rsh_module.c
|
2008-02-17 19:29:06 +00:00
|
|
|
explaining all the rationale for how / why we're doing
|
|
|
|
this. */
|
|
|
|
|
|
|
|
lib_base = opal_basename(opal_install_dirs.libdir);
|
|
|
|
bin_base = opal_basename(opal_install_dirs.bindir);
|
|
|
|
|
|
|
|
/* If we have a prefix, then modify the PATH and
|
|
|
|
LD_LIBRARY_PATH environment variables. */
|
|
|
|
if (NULL != prefix) {
|
|
|
|
char *oldenv, *newenv;
|
|
|
|
|
|
|
|
/* Reset PATH */
|
|
|
|
oldenv = getenv("PATH");
|
|
|
|
if (NULL != oldenv) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, bin_base, oldenv);
|
|
|
|
} else {
|
|
|
|
asprintf(&newenv, "%s/%s", prefix, bin_base);
|
|
|
|
}
|
|
|
|
opal_setenv("PATH", newenv, true, &env);
|
2008-02-28 01:57:57 +00:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm:alps: reset PATH: %s", newenv);
|
2008-02-17 19:29:06 +00:00
|
|
|
}
|
|
|
|
free(newenv);
|
|
|
|
|
|
|
|
/* Reset LD_LIBRARY_PATH */
|
|
|
|
oldenv = getenv("LD_LIBRARY_PATH");
|
|
|
|
if (NULL != oldenv) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, lib_base, oldenv);
|
|
|
|
} else {
|
|
|
|
asprintf(&newenv, "%s/%s", prefix, lib_base);
|
|
|
|
}
|
|
|
|
opal_setenv("LD_LIBRARY_PATH", newenv, true, &env);
|
2008-02-28 01:57:57 +00:00
|
|
|
if (mca_plm_alps_component.debug) {
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm:alps: reset LD_LIBRARY_PATH: %s",
|
2008-02-17 19:29:06 +00:00
|
|
|
newenv);
|
|
|
|
}
|
|
|
|
free(newenv);
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = open("/dev/null", O_CREAT|O_WRONLY|O_TRUNC, 0666);
|
|
|
|
if(fd > 0) {
|
|
|
|
dup2(fd, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* When not in debug mode and --debug-daemons was not passed,
|
|
|
|
* tie stdout/stderr to dev null so we don't see messages from orted */
|
2008-02-28 01:57:57 +00:00
|
|
|
if (0 == mca_plm_alps_component.debug && !orte_debug_daemons_flag) {
|
2008-02-17 19:29:06 +00:00
|
|
|
if (fd >= 0) {
|
|
|
|
if (fd != 1) {
|
|
|
|
dup2(fd,1);
|
|
|
|
}
|
|
|
|
if (fd != 2) {
|
|
|
|
dup2(fd,2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fd > 2) {
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the alps process out of orterun's process group so that
|
|
|
|
signals sent from the shell (like those resulting from
|
|
|
|
cntl-c) don't get sent to alps */
|
|
|
|
setpgid(0, 0);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
execve(exec_argv, argv, env);
|
|
|
|
|
2008-06-09 14:53:58 +00:00
|
|
|
opal_output(0, "plm:alps:start_proc: exec failed");
|
2008-02-17 19:29:06 +00:00
|
|
|
/* don't return - need to exit - returning would be bad -
|
|
|
|
we're not in the calling process anymore */
|
|
|
|
exit(1);
|
|
|
|
} else { /* parent */
|
|
|
|
/* just in case, make sure that the alps process is not in our
|
|
|
|
process group any more. Stevens says always do this on both
|
|
|
|
sides of the fork... */
|
|
|
|
setpgid(alps_pid, alps_pid);
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2008-02-17 19:29:06 +00:00
|
|
|
free(exec_argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|