2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 07:32:36 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2006-05-16 18:14:12 +04:00
|
|
|
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*
|
|
|
|
* These symbols are in a file by themselves to provide nice linker
|
|
|
|
* semantics. Since linkers generally pull in symbols by object
|
|
|
|
* files, keeping these symbols as the only symbols in this file
|
|
|
|
* prevents utility programs such as "ompi_info" from having to import
|
|
|
|
* entire components just to query their version and parameters.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/orte_constants.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
#if HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <signal.h>
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2005-03-18 06:43:59 +03:00
|
|
|
#include <sys/types.h>
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_WAIT_H
|
2005-03-18 06:43:59 +03:00
|
|
|
#include <sys/wait.h>
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
#endif
|
2005-08-19 20:49:59 +04:00
|
|
|
#ifdef HAVE_SCHED_H
|
|
|
|
#include <sched.h>
|
|
|
|
#endif
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
2005-08-19 20:49:59 +04:00
|
|
|
#include <errno.h>
|
|
|
|
#include <tm.h>
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-05-16 18:14:12 +04:00
|
|
|
#include "opal/install_dirs.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "opal/threads/condition.h"
|
2006-07-05 00:12:35 +04:00
|
|
|
#include "opal/event/event.h"
|
2005-07-04 04:13:44 +04:00
|
|
|
#include "opal/util/argv.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-07-04 05:36:20 +04:00
|
|
|
#include "opal/util/opal_environ.h"
|
2005-10-02 15:58:18 +04:00
|
|
|
#include "opal/util/show_help.h"
|
2005-10-04 23:38:51 +04:00
|
|
|
#include "opal/util/path.h"
|
2006-05-16 18:14:12 +04:00
|
|
|
#include "opal/util/basename.h"
|
2005-08-25 02:20:51 +04:00
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2005-08-19 20:49:59 +04:00
|
|
|
#include "opal/runtime/opal_progress.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/orte_types.h"
|
2005-08-25 02:20:51 +04:00
|
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
#include "orte/mca/pls/pls.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/smr/smr.h"
|
2005-08-25 02:20:51 +04:00
|
|
|
#include "orte/mca/gpr/gpr.h"
|
|
|
|
#include "orte/mca/sds/base/base.h"
|
2006-10-07 19:45:24 +04:00
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
2005-08-25 02:20:51 +04:00
|
|
|
#include "orte/mca/rml/rml.h"
|
|
|
|
#include "orte/mca/ns/ns.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2006-11-16 18:11:45 +03:00
|
|
|
#include "orte/mca/pls/base/base.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/pls/base/pls_private.h"
|
2005-08-25 02:20:51 +04:00
|
|
|
#include "pls_tm.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
|
2006-07-05 00:12:35 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_tm_launch_job(orte_jobid_t jobid);
|
2007-01-25 17:17:44 +03:00
|
|
|
static int pls_tm_terminate_job(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs);
|
|
|
|
static int pls_tm_terminate_orteds(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs);
|
2005-03-14 23:57:21 +03:00
|
|
|
static int pls_tm_terminate_proc(const orte_process_name_t *name);
|
Bring over the update to terminate orteds that are generated by a dynamic spawn such as comm_spawn. This introduces the concept of a job "family" - i.e., jobs that have a parent/child relationship. Comm_spawn'ed jobs have a parent (the one that spawned them). We track that relationship throughout the lineage - i.e., if a comm_spawned job in turn calls comm_spawn, then it has a parent (the one that spawned it) and a "root" job (the original job that started things).
Accordingly, there are new APIs to the name service to support the ability to get a job's parent, root, immediate children, and all its descendants. In addition, the terminate_job, terminate_orted, and signal_job APIs for the PLS have been modified to accept attributes that define the extent of their actions. For example, doing a "terminate_job" with an attribute of ORTE_NS_INCLUDE_DESCENDANTS will terminate the given jobid AND all jobs that descended from it.
I have tested this capability on a MacBook under rsh, Odin under SLURM, and LANL's Flash (bproc). It worked successfully on non-MPI jobs (both simple and including a spawn), and MPI jobs (again, both simple and with a spawn).
This commit was SVN r12597.
2006-11-14 22:34:59 +03:00
|
|
|
static int pls_tm_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs);
|
2006-06-08 22:27:17 +04:00
|
|
|
static int pls_tm_signal_proc(const orte_process_name_t *name, int32_t signal);
|
2007-01-25 17:17:44 +03:00
|
|
|
static int pls_tm_cancel_operation(void);
|
2005-03-14 23:57:21 +03:00
|
|
|
static int pls_tm_finalize(void);
|
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
static int pls_tm_connect(void);
|
|
|
|
static int pls_tm_disconnect(void);
|
2005-10-04 23:38:51 +04:00
|
|
|
static int pls_tm_check_path(char *exe, char **env);
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/*
|
|
|
|
* Local variables
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_pls_base_module_t orte_pls_tm_module = {
|
|
|
|
pls_tm_launch_job,
|
2005-03-14 23:57:21 +03:00
|
|
|
pls_tm_terminate_job,
|
2006-09-15 01:29:51 +04:00
|
|
|
pls_tm_terminate_orteds,
|
2005-03-14 23:57:21 +03:00
|
|
|
pls_tm_terminate_proc,
|
2006-06-08 22:27:17 +04:00
|
|
|
pls_tm_signal_job,
|
|
|
|
pls_tm_signal_proc,
|
2007-02-01 19:52:28 +03:00
|
|
|
pls_tm_cancel_operation,
|
2005-03-14 23:57:21 +03:00
|
|
|
pls_tm_finalize
|
|
|
|
};
|
|
|
|
|
2006-08-23 07:32:36 +04:00
|
|
|
#if !defined(__WINDOWS__)
|
2005-08-19 20:49:59 +04:00
|
|
|
extern char **environ;
|
2006-08-23 07:32:36 +04:00
|
|
|
#endif /* !defined(__WINDOWS__) */
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_tm_launch_job(orte_jobid_t jobid)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2006-10-07 19:45:24 +04:00
|
|
|
orte_job_map_t *map;
|
|
|
|
opal_list_item_t *item;
|
2005-08-19 20:49:59 +04:00
|
|
|
size_t num_nodes;
|
|
|
|
orte_vpid_t vpid;
|
|
|
|
int node_name_index;
|
|
|
|
int proc_name_index;
|
|
|
|
char *jobid_string;
|
|
|
|
char *uri, *param;
|
2006-10-07 19:45:24 +04:00
|
|
|
char **env;
|
|
|
|
char *var;
|
2005-08-19 20:49:59 +04:00
|
|
|
char **argv;
|
|
|
|
int argc;
|
|
|
|
int rc;
|
2005-08-19 22:10:37 +04:00
|
|
|
bool connected = false;
|
2006-09-15 01:29:51 +04:00
|
|
|
uint launched = 0, i;
|
2006-05-16 18:14:12 +04:00
|
|
|
char *bin_base = NULL, *lib_base = NULL;
|
2006-09-15 01:29:51 +04:00
|
|
|
tm_event_t *tm_events = NULL;
|
|
|
|
tm_task_id *tm_task_ids = NULL;
|
|
|
|
int local_err;
|
|
|
|
tm_event_t event;
|
|
|
|
opal_list_t daemons;
|
|
|
|
orte_pls_daemon_info_t *dmn;
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
struct timeval launchstart, launchstop, completionstart, completionstop;
|
|
|
|
struct timeval jobstart, jobstop;
|
2007-01-25 20:22:01 +03:00
|
|
|
int maxtime=0, mintime=99999999, maxiter = 0, miniter = 0, deltat;
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
float avgtime=0.0;
|
|
|
|
|
|
|
|
/* check for timing request - get start time if so */
|
|
|
|
if (mca_pls_tm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&jobstart, NULL)) {
|
|
|
|
opal_output(0, "pls_tm: could not obtain job start time");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Query the map for this job.
|
2005-10-08 02:24:52 +04:00
|
|
|
* We need the entire mapping for a couple of reasons:
|
|
|
|
* - need the prefix to start with.
|
|
|
|
* - need to know if we are launching on a subset of the allocated nodes
|
2005-08-19 20:49:59 +04:00
|
|
|
*/
|
2006-10-07 19:45:24 +04:00
|
|
|
rc = orte_rmaps.get_job_map(&map, jobid);
|
2005-08-19 20:49:59 +04:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2006-11-16 18:11:45 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
2005-08-19 20:49:59 +04:00
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-11-16 18:11:45 +03:00
|
|
|
/* if the user requested that we re-use daemons,
|
|
|
|
* launch the procs on any existing, re-usable daemons
|
|
|
|
*/
|
|
|
|
if (orte_pls_base.reuse_daemons) {
|
2006-11-17 22:06:10 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_launch_on_existing_daemons(map))) {
|
2006-11-16 18:11:45 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
OBJ_RELEASE(map);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
num_nodes = opal_list_get_size(&map->nodes);
|
2006-11-16 18:11:45 +03:00
|
|
|
if (0 == num_nodes) {
|
|
|
|
/* must have been launched on existing daemons - just return */
|
|
|
|
OBJ_RELEASE(map);
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
/*
|
|
|
|
* Allocate a range of vpids for the daemons.
|
|
|
|
*/
|
|
|
|
rc = orte_ns.reserve_range(0, num_nodes, &vpid);
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
goto cleanup;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
2005-03-18 06:43:59 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* setup the orted triggers for passing their launch info */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_smr.init_orted_stage_gates(jobid, num_nodes, NULL, NULL))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup a list that will contain the info for all the daemons
|
|
|
|
* so we can store it on the registry when done
|
|
|
|
*/
|
|
|
|
OBJ_CONSTRUCT(&daemons, opal_list_t);
|
|
|
|
|
2006-07-15 02:04:41 +04:00
|
|
|
/* Allocate a bunch of TM events to use for tm_spawn()ing */
|
2006-09-15 01:29:51 +04:00
|
|
|
tm_events = malloc(sizeof(tm_event_t) * num_nodes);
|
|
|
|
if (NULL == tm_events) {
|
|
|
|
rc = ORTE_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
tm_task_ids = malloc(sizeof(tm_task_id) * num_nodes);
|
|
|
|
if (NULL == tm_task_ids) {
|
2006-07-15 02:04:41 +04:00
|
|
|
rc = ORTE_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
/* need integer value for command line parameter */
|
|
|
|
asprintf(&jobid_string, "%lu", (unsigned long) jobid);
|
|
|
|
|
|
|
|
/* add the daemon command (as specified by user) */
|
2005-10-04 23:38:51 +04:00
|
|
|
argv = opal_argv_split(mca_pls_tm_component.orted, ' ');
|
|
|
|
argc = opal_argv_count(argv);
|
2005-08-19 20:49:59 +04:00
|
|
|
|
|
|
|
opal_argv_append(&argc, &argv, "--no-daemonize");
|
|
|
|
|
|
|
|
/* check for debug flags */
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_pls_base_mca_argv(&argc, &argv);
|
2005-03-18 06:43:59 +03:00
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
/* proxy information */
|
|
|
|
opal_argv_append(&argc, &argv, "--bootproxy");
|
|
|
|
opal_argv_append(&argc, &argv, jobid_string);
|
|
|
|
opal_argv_append(&argc, &argv, "--name");
|
|
|
|
proc_name_index = argc;
|
|
|
|
opal_argv_append(&argc, &argv, "");
|
|
|
|
|
|
|
|
/* tell the daemon how many procs are in the daemon's job */
|
|
|
|
opal_argv_append(&argc, &argv, "--num_procs");
|
|
|
|
asprintf(¶m, "%lu", (unsigned long)(vpid + num_nodes));
|
|
|
|
opal_argv_append(&argc, &argv, param);
|
|
|
|
free(param);
|
|
|
|
|
|
|
|
/* tell the daemon the starting vpid of the daemon's job */
|
|
|
|
opal_argv_append(&argc, &argv, "--vpid_start");
|
|
|
|
opal_argv_append(&argc, &argv, "0");
|
|
|
|
|
|
|
|
opal_argv_append(&argc, &argv, "--nodename");
|
|
|
|
node_name_index = argc;
|
|
|
|
opal_argv_append(&argc, &argv, "");
|
|
|
|
|
|
|
|
/* pass along the universe name and location info */
|
|
|
|
opal_argv_append(&argc, &argv, "--universe");
|
|
|
|
asprintf(¶m, "%s@%s:%s", orte_universe_info.uid,
|
|
|
|
orte_universe_info.host, orte_universe_info.name);
|
|
|
|
opal_argv_append(&argc, &argv, param);
|
|
|
|
free(param);
|
|
|
|
|
|
|
|
/* setup ns contact info */
|
|
|
|
opal_argv_append(&argc, &argv, "--nsreplica");
|
|
|
|
if (NULL != orte_process_info.ns_replica_uri) {
|
|
|
|
uri = strdup(orte_process_info.ns_replica_uri);
|
|
|
|
} else {
|
|
|
|
uri = orte_rml.get_uri();
|
|
|
|
}
|
|
|
|
asprintf(¶m, "\"%s\"", uri);
|
|
|
|
opal_argv_append(&argc, &argv, param);
|
|
|
|
free(uri);
|
|
|
|
free(param);
|
|
|
|
|
|
|
|
/* setup gpr contact info */
|
|
|
|
opal_argv_append(&argc, &argv, "--gprreplica");
|
|
|
|
if (NULL != orte_process_info.gpr_replica_uri) {
|
|
|
|
uri = strdup(orte_process_info.gpr_replica_uri);
|
|
|
|
} else {
|
|
|
|
uri = orte_rml.get_uri();
|
|
|
|
}
|
|
|
|
asprintf(¶m, "\"%s\"", uri);
|
|
|
|
opal_argv_append(&argc, &argv, param);
|
|
|
|
free(uri);
|
|
|
|
free(param);
|
|
|
|
|
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
param = opal_argv_join(argv, ' ');
|
|
|
|
if (NULL != param) {
|
|
|
|
opal_output(0, "pls:tm: final top-level argv:");
|
|
|
|
opal_output(0, "pls:tm: %s", param);
|
|
|
|
free(param);
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
}
|
2005-03-18 06:43:59 +03:00
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
rc = pls_tm_connect();
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
goto cleanup;
|
2005-03-18 06:43:59 +03:00
|
|
|
}
|
2005-08-19 22:10:37 +04:00
|
|
|
connected = true;
|
2005-03-18 06:43:59 +03:00
|
|
|
|
2006-05-16 18:14:12 +04:00
|
|
|
/* Figure out the basenames for the libdir and bindir. There is a
|
|
|
|
lengthy comment about this in pls_rsh_module.c explaining all
|
|
|
|
the rationale for how / why we're doing this. */
|
|
|
|
lib_base = opal_basename(OPAL_LIBDIR);
|
|
|
|
bin_base = opal_basename(OPAL_BINDIR);
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* setup environment */
|
|
|
|
env = opal_argv_copy(environ);
|
|
|
|
var = mca_base_param_environ_variable("seed",NULL,NULL);
|
|
|
|
opal_setenv(var, "0", true, &env);
|
|
|
|
|
2006-10-20 20:50:13 +04:00
|
|
|
/* clean out any MCA component selection directives that
|
|
|
|
* won't work on remote nodes
|
|
|
|
*/
|
|
|
|
orte_pls_base_purge_mca_params(&env);
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* If we have a prefix, then modify the PATH and
|
|
|
|
LD_LIBRARY_PATH environment variables. We only allow
|
|
|
|
a single prefix to be specified. Since there will
|
|
|
|
always be at least one app_context, we take it from
|
|
|
|
there
|
|
|
|
*/
|
|
|
|
if (NULL != map->apps[0]->prefix_dir) {
|
|
|
|
char *newenv;
|
|
|
|
|
|
|
|
for (i = 0; NULL != env && NULL != env[i]; ++i) {
|
|
|
|
/* Reset PATH */
|
|
|
|
if (0 == strncmp("PATH=", env[i], 5)) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s",
|
|
|
|
map->apps[0]->prefix_dir, bin_base, env[i] + 5);
|
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
opal_output(0, "pls:tm: resetting PATH: %s",
|
|
|
|
newenv);
|
|
|
|
}
|
|
|
|
opal_setenv("PATH", newenv, true, &env);
|
|
|
|
free(newenv);
|
|
|
|
}
|
2005-10-02 15:58:18 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* Reset LD_LIBRARY_PATH */
|
|
|
|
else if (0 == strncmp("LD_LIBRARY_PATH=", env[i], 16)) {
|
|
|
|
asprintf(&newenv, "%s/%s:%s",
|
|
|
|
map->apps[0]->prefix_dir, lib_base, env[i] + 16);
|
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
opal_output(0, "pls:tm: resetting LD_LIBRARY_PATH: %s",
|
|
|
|
newenv);
|
|
|
|
}
|
|
|
|
opal_setenv("LD_LIBRARY_PATH", newenv, true, &env);
|
|
|
|
free(newenv);
|
|
|
|
}
|
2005-10-02 15:58:18 +04:00
|
|
|
}
|
2006-10-07 19:45:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Do a quick sanity check to ensure that we can find the
|
|
|
|
orted in the PATH */
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS !=
|
|
|
|
(rc = pls_tm_check_path(argv[0], env))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
opal_show_help("help-pls-tm.txt", "daemon-not-found",
|
|
|
|
true, argv[0]);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Iterate through each of the nodes and spin
|
|
|
|
* up a daemon.
|
|
|
|
*/
|
|
|
|
for (item = opal_list_get_first(&map->nodes);
|
|
|
|
item != opal_list_get_end(&map->nodes);
|
2006-10-10 00:37:39 +04:00
|
|
|
item = opal_list_get_next(item)) {
|
2006-10-07 19:45:24 +04:00
|
|
|
orte_mapped_node_t* node = (orte_mapped_node_t*)item;
|
|
|
|
orte_process_name_t* name;
|
|
|
|
char* name_string;
|
2006-07-05 00:12:35 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* new daemon - setup to record its info */
|
|
|
|
dmn = OBJ_NEW(orte_pls_daemon_info_t);
|
|
|
|
dmn->active_job = jobid;
|
|
|
|
opal_list_append(&daemons, &dmn->super);
|
2005-10-04 23:38:51 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* setup node name */
|
|
|
|
free(argv[node_name_index]);
|
|
|
|
argv[node_name_index] = strdup(node->nodename);
|
|
|
|
|
|
|
|
/* record the node name in the daemon struct */
|
|
|
|
dmn->cell = node->cell;
|
|
|
|
dmn->nodename = strdup(node->nodename);
|
|
|
|
|
|
|
|
/* initialize daemons process name */
|
|
|
|
rc = orte_ns.create_process_name(&name, node->cell, 0, vpid);
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
2005-10-04 23:38:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2006-07-05 00:12:35 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* save it in the daemon struct */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.copy((void**)&(dmn->name), name, ORTE_NAME))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup per-node options */
|
|
|
|
if (mca_pls_tm_component.debug ||
|
|
|
|
mca_pls_tm_component.verbose) {
|
|
|
|
opal_output(0, "pls:tm: launching on node %s",
|
|
|
|
node->nodename);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup process name */
|
|
|
|
rc = orte_ns.get_proc_name_string(&name_string, name);
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
opal_output(0, "pls:tm: unable to create process name");
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
free(argv[proc_name_index]);
|
|
|
|
argv[proc_name_index] = strdup(name_string);
|
|
|
|
|
|
|
|
/* exec the daemon */
|
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
param = opal_argv_join(argv, ' ');
|
|
|
|
if (NULL != param) {
|
|
|
|
opal_output(0, "pls:tm: executing: %s", param);
|
|
|
|
free(param);
|
2005-08-19 20:49:59 +04:00
|
|
|
}
|
2005-03-18 06:43:59 +03:00
|
|
|
}
|
2006-10-07 19:45:24 +04:00
|
|
|
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
/* check for timing request - get start time if so */
|
|
|
|
if (mca_pls_tm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&launchstart, NULL)) {
|
|
|
|
opal_output(0, "pls_tm: could not obtain start time");
|
|
|
|
launchstart.tv_sec = 0;
|
|
|
|
launchstart.tv_usec = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-09 18:06:45 +03:00
|
|
|
rc = tm_spawn(argc, argv, env, node->launch_id, tm_task_ids + launched, tm_events + launched);
|
|
|
|
if (TM_SUCCESS != rc) {
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
opal_output(0, "pls:tm: start_procs returned error %d", 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 19:27:47 +04:00
|
|
|
/* check for timing request - get stop time and process if so */
|
|
|
|
if (mca_pls_tm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&launchstop, NULL)) {
|
|
|
|
opal_output(0, "pls_tm: could not obtain stop time");
|
|
|
|
} else {
|
|
|
|
deltat = (launchstop.tv_sec - launchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - launchstart.tv_usec);
|
|
|
|
avgtime = avgtime + deltat / num_nodes;
|
|
|
|
if (deltat < mintime) {
|
|
|
|
mintime = deltat;
|
|
|
|
miniter = launched;
|
|
|
|
}
|
|
|
|
if (deltat > maxtime) {
|
|
|
|
maxtime = deltat;
|
|
|
|
maxiter = launched;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
launched++;
|
|
|
|
++vpid;
|
|
|
|
free(name);
|
|
|
|
|
|
|
|
/* Allow some progress to occur */
|
|
|
|
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
opal_output(0, "pls:tm:launch: finished spawning orteds\n");
|
2006-07-05 00:12:35 +04:00
|
|
|
}
|
|
|
|
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
/* check for timing request - get start time for launch completion */
|
|
|
|
if (mca_pls_tm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&completionstart, NULL)) {
|
|
|
|
opal_output(0, "pls_tm: could not obtain completion start time");
|
|
|
|
completionstart.tv_sec = 0;
|
|
|
|
completionstart.tv_usec = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* all done, so store the daemon info on the registry */
|
2006-10-07 19:45:24 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_store_active_daemons(&daemons))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TM poll for all the spawns */
|
|
|
|
for (i = 0; i < launched; ++i) {
|
|
|
|
rc = tm_poll(TM_NULL_EVENT, &event, 1, &local_err);
|
|
|
|
if (TM_SUCCESS != rc) {
|
2006-07-05 00:12:35 +04:00
|
|
|
errno = local_err;
|
2006-09-15 01:29:51 +04:00
|
|
|
opal_output(0, "pls:tm: failed to poll for a spawned proc, return status = %d", rc);
|
|
|
|
return ORTE_ERR_IN_ERRNO;
|
2005-08-19 20:49:59 +04:00
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
|
|
|
|
/* check for timing request - get stop time for launch completion and report */
|
|
|
|
if (mca_pls_tm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&completionstop, NULL)) {
|
|
|
|
opal_output(0, "pls_tm: could not obtain completion stop time");
|
|
|
|
} else {
|
|
|
|
deltat = (launchstop.tv_sec - launchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - launchstart.tv_usec);
|
|
|
|
opal_output(0, "pls_tm: launch completion required %d usec", deltat);
|
|
|
|
}
|
|
|
|
opal_output(0, "pls_tm: Launch statistics:");
|
|
|
|
opal_output(0, "pls_tm: Average time to launch an orted: %f usec", avgtime);
|
|
|
|
opal_output(0, "pls_tm: Max time to launch an orted: %d usec at iter %d", maxtime, maxiter);
|
|
|
|
opal_output(0, "pls_tm: Min time to launch an orted: %d usec at iter %d", mintime, miniter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-05 00:12:35 +04:00
|
|
|
cleanup:
|
2006-10-08 02:44:00 +04:00
|
|
|
OBJ_RELEASE(map);
|
|
|
|
|
2005-08-19 22:10:37 +04:00
|
|
|
if (connected) {
|
2005-10-04 23:38:51 +04:00
|
|
|
pls_tm_disconnect();
|
2005-08-19 22:10:37 +04:00
|
|
|
}
|
2006-09-15 01:29:51 +04:00
|
|
|
if (NULL != tm_events) {
|
|
|
|
free(tm_events);
|
|
|
|
}
|
|
|
|
if (NULL != tm_task_ids) {
|
|
|
|
free(tm_task_ids);
|
2006-07-15 02:04:41 +04:00
|
|
|
}
|
2006-07-05 00:12:35 +04:00
|
|
|
|
2006-05-16 18:14:12 +04:00
|
|
|
if (NULL != lib_base) {
|
|
|
|
free(lib_base);
|
|
|
|
}
|
|
|
|
if (NULL != bin_base) {
|
|
|
|
free(bin_base);
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* deconstruct the daemon list */
|
2006-10-07 19:45:24 +04:00
|
|
|
while (NULL != (item = opal_list_remove_first(&daemons))) {
|
|
|
|
OBJ_RELEASE(item);
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&daemons);
|
|
|
|
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
/* check for timing request - get stop time and process if so */
|
|
|
|
if (mca_pls_tm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&jobstop, NULL)) {
|
|
|
|
opal_output(0, "pls_tm: could not obtain stop time");
|
|
|
|
} else {
|
|
|
|
deltat = (jobstop.tv_sec - jobstart.tv_sec)*1000000 +
|
|
|
|
(jobstop.tv_usec - jobstart.tv_usec);
|
|
|
|
opal_output(0, "pls_tm: launch of entire job required %d usec", deltat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
opal_output(0, "pls:tm:launch: finished\n");
|
|
|
|
}
|
2005-08-19 20:49:59 +04:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-25 17:17:44 +03:00
|
|
|
static int pls_tm_terminate_job(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs)
|
2005-08-19 20:49:59 +04:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
|
|
|
opal_list_t daemons;
|
|
|
|
opal_list_item_t *item;
|
|
|
|
|
|
|
|
/* construct the list of active daemons on this job */
|
|
|
|
OBJ_CONSTRUCT(&daemons, opal_list_t);
|
Bring over the update to terminate orteds that are generated by a dynamic spawn such as comm_spawn. This introduces the concept of a job "family" - i.e., jobs that have a parent/child relationship. Comm_spawn'ed jobs have a parent (the one that spawned them). We track that relationship throughout the lineage - i.e., if a comm_spawned job in turn calls comm_spawn, then it has a parent (the one that spawned it) and a "root" job (the original job that started things).
Accordingly, there are new APIs to the name service to support the ability to get a job's parent, root, immediate children, and all its descendants. In addition, the terminate_job, terminate_orted, and signal_job APIs for the PLS have been modified to accept attributes that define the extent of their actions. For example, doing a "terminate_job" with an attribute of ORTE_NS_INCLUDE_DESCENDANTS will terminate the given jobid AND all jobs that descended from it.
I have tested this capability on a MacBook under rsh, Odin under SLURM, and LANL's Flash (bproc). It worked successfully on non-MPI jobs (both simple and including a spawn), and MPI jobs (again, both simple and with a spawn).
This commit was SVN r12597.
2006-11-14 22:34:59 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_get_active_daemons(&daemons, jobid, attrs))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* order them to kill their local procs for this job */
|
2007-01-25 17:17:44 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_orted_kill_local_procs(&daemons, jobid, timeout))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
while (NULL != (item = opal_list_remove_first(&daemons))) {
|
|
|
|
OBJ_RELEASE(item);
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&daemons);
|
|
|
|
return rc;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/**
|
|
|
|
* Terminate the orteds for a given job
|
|
|
|
*/
|
2007-01-25 17:17:44 +03:00
|
|
|
int pls_tm_terminate_orteds(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
opal_list_t daemons;
|
|
|
|
opal_list_item_t *item;
|
|
|
|
|
|
|
|
/* construct the list of active daemons on this job */
|
|
|
|
OBJ_CONSTRUCT(&daemons, opal_list_t);
|
Bring over the update to terminate orteds that are generated by a dynamic spawn such as comm_spawn. This introduces the concept of a job "family" - i.e., jobs that have a parent/child relationship. Comm_spawn'ed jobs have a parent (the one that spawned them). We track that relationship throughout the lineage - i.e., if a comm_spawned job in turn calls comm_spawn, then it has a parent (the one that spawned it) and a "root" job (the original job that started things).
Accordingly, there are new APIs to the name service to support the ability to get a job's parent, root, immediate children, and all its descendants. In addition, the terminate_job, terminate_orted, and signal_job APIs for the PLS have been modified to accept attributes that define the extent of their actions. For example, doing a "terminate_job" with an attribute of ORTE_NS_INCLUDE_DESCENDANTS will terminate the given jobid AND all jobs that descended from it.
I have tested this capability on a MacBook under rsh, Odin under SLURM, and LANL's Flash (bproc). It worked successfully on non-MPI jobs (both simple and including a spawn), and MPI jobs (again, both simple and with a spawn).
This commit was SVN r12597.
2006-11-14 22:34:59 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_get_active_daemons(&daemons, jobid, attrs))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now tell them to die! */
|
2007-01-25 17:17:44 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_orted_exit(&daemons, timeout))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
while (NULL != (item = opal_list_remove_first(&daemons))) {
|
|
|
|
OBJ_RELEASE(item);
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&daemons);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* TM can't kill individual processes -- PBS will kill the entire job
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_tm_terminate_proc(const orte_process_name_t *name)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
opal_output(0, "pls:tm:terminate_proc: not supported");
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Bring over the update to terminate orteds that are generated by a dynamic spawn such as comm_spawn. This introduces the concept of a job "family" - i.e., jobs that have a parent/child relationship. Comm_spawn'ed jobs have a parent (the one that spawned them). We track that relationship throughout the lineage - i.e., if a comm_spawned job in turn calls comm_spawn, then it has a parent (the one that spawned it) and a "root" job (the original job that started things).
Accordingly, there are new APIs to the name service to support the ability to get a job's parent, root, immediate children, and all its descendants. In addition, the terminate_job, terminate_orted, and signal_job APIs for the PLS have been modified to accept attributes that define the extent of their actions. For example, doing a "terminate_job" with an attribute of ORTE_NS_INCLUDE_DESCENDANTS will terminate the given jobid AND all jobs that descended from it.
I have tested this capability on a MacBook under rsh, Odin under SLURM, and LANL's Flash (bproc). It worked successfully on non-MPI jobs (both simple and including a spawn), and MPI jobs (again, both simple and with a spawn).
This commit was SVN r12597.
2006-11-14 22:34:59 +03:00
|
|
|
static int pls_tm_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs)
|
2006-06-08 22:27:17 +04:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
|
|
|
opal_list_t daemons;
|
|
|
|
opal_list_item_t *item;
|
|
|
|
|
|
|
|
/* construct the list of active daemons on this job */
|
|
|
|
OBJ_CONSTRUCT(&daemons, opal_list_t);
|
Bring over the update to terminate orteds that are generated by a dynamic spawn such as comm_spawn. This introduces the concept of a job "family" - i.e., jobs that have a parent/child relationship. Comm_spawn'ed jobs have a parent (the one that spawned them). We track that relationship throughout the lineage - i.e., if a comm_spawned job in turn calls comm_spawn, then it has a parent (the one that spawned it) and a "root" job (the original job that started things).
Accordingly, there are new APIs to the name service to support the ability to get a job's parent, root, immediate children, and all its descendants. In addition, the terminate_job, terminate_orted, and signal_job APIs for the PLS have been modified to accept attributes that define the extent of their actions. For example, doing a "terminate_job" with an attribute of ORTE_NS_INCLUDE_DESCENDANTS will terminate the given jobid AND all jobs that descended from it.
I have tested this capability on a MacBook under rsh, Odin under SLURM, and LANL's Flash (bproc). It worked successfully on non-MPI jobs (both simple and including a spawn), and MPI jobs (again, both simple and with a spawn).
This commit was SVN r12597.
2006-11-14 22:34:59 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_get_active_daemons(&daemons, jobid, attrs))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
OBJ_DESTRUCT(&daemons);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* order them to pass this signal to their local procs */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_orted_signal_local_procs(&daemons, signal))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (NULL != (item = opal_list_remove_first(&daemons))) {
|
|
|
|
OBJ_RELEASE(item);
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&daemons);
|
|
|
|
return rc;
|
2006-06-08 22:27:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_tm_signal_proc(const orte_process_name_t *name, int32_t signal)
|
2006-06-08 22:27:17 +04:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
return ORTE_ERR_NOT_IMPLEMENTED;
|
2006-06-08 22:27:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-25 17:17:44 +03:00
|
|
|
/**
|
|
|
|
* Cancel an operation involving comm to an orted
|
|
|
|
*/
|
|
|
|
static int pls_tm_cancel_operation(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_orted_cancel_operation())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* Free stuff
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_tm_finalize(void)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
/* cleanup any pending recvs */
|
2006-09-15 01:29:51 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_comm_stop())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_tm_connect(void)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2005-08-19 20:49:59 +04:00
|
|
|
int ret;
|
|
|
|
struct tm_roots tm_root;
|
|
|
|
int count, progress;
|
|
|
|
|
|
|
|
/* try a couple times to connect - might get busy signals every
|
|
|
|
now and then */
|
|
|
|
for (count = 0 ; count < 10; ++count) {
|
|
|
|
ret = tm_init(NULL, &tm_root);
|
|
|
|
if (TM_SUCCESS == ret) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
for (progress = 0 ; progress < 10 ; ++progress) {
|
|
|
|
opal_progress();
|
|
|
|
#if HAVE_SCHED_YIELD
|
|
|
|
sched_yield();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-08-19 20:49:59 +04:00
|
|
|
return ORTE_ERR_RESOURCE_BUSY;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_tm_disconnect(void)
|
2005-08-19 20:49:59 +04:00
|
|
|
{
|
|
|
|
tm_finalize();
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-04 23:38:51 +04:00
|
|
|
static int pls_tm_check_path(char *exe, char **env)
|
|
|
|
{
|
|
|
|
static int size = 256;
|
|
|
|
int i;
|
|
|
|
char *file;
|
|
|
|
char *cwd;
|
2005-10-05 14:23:02 +04:00
|
|
|
char *path = NULL;
|
2005-10-04 23:38:51 +04:00
|
|
|
|
|
|
|
/* Do we want this check at all? */
|
|
|
|
|
|
|
|
if (!mca_pls_tm_component.want_path_check) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the path in the supplied environment */
|
|
|
|
|
|
|
|
for (i = 0; NULL != env[i]; ++i) {
|
|
|
|
if (0 == strncmp("PATH=", env[i], 5)) {
|
|
|
|
path = strdup(env[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (NULL == env[i]) {
|
|
|
|
path = strdup("NULL");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check the already-successful paths (i.e., be a little
|
|
|
|
friendlier to the filesystem -- if we find the executable
|
|
|
|
successfully, save it) */
|
|
|
|
|
|
|
|
for (i = 0; NULL != mca_pls_tm_component.checked_paths &&
|
|
|
|
NULL != mca_pls_tm_component.checked_paths[i]; ++i) {
|
|
|
|
if (0 == strcmp(path, mca_pls_tm_component.checked_paths[i])) {
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We didn't already find it, so check now. First, get the cwd. */
|
|
|
|
|
|
|
|
do {
|
|
|
|
cwd = malloc(size);
|
|
|
|
if (NULL == cwd) {
|
|
|
|
return ORTE_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
if (NULL == getcwd(cwd, size)) {
|
|
|
|
free(cwd);
|
|
|
|
if (ERANGE == errno) {
|
|
|
|
size *= 2;
|
|
|
|
} else {
|
|
|
|
return ORTE_ERR_IN_ERRNO;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (1);
|
|
|
|
|
|
|
|
/* Now do the search */
|
|
|
|
|
|
|
|
file = opal_path_findv(exe, X_OK, env, cwd);
|
|
|
|
free(cwd);
|
|
|
|
if (NULL == file) {
|
|
|
|
free(path);
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
if (mca_pls_tm_component.debug) {
|
|
|
|
opal_output(0, "pls:tm: found %s", file);
|
|
|
|
}
|
|
|
|
free(file);
|
|
|
|
|
|
|
|
/* Success -- so cache it */
|
|
|
|
|
|
|
|
opal_argv_append_nosize(&mca_pls_tm_component.checked_paths, path);
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
|
|
|
free(path);
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|