2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2007-03-29 04:50:56 +04:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 07:32:36 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2006-06-08 22:27:17 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2005-03-14 23:57:21 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-01-22 18:50:35 +03:00
|
|
|
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
2006-06-08 22:27:17 +04:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* Additional copyrights may follow
|
2006-06-08 22:27:17 +04:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* $HEADER$
|
|
|
|
*
|
|
|
|
* These symbols are in a file by themselves to provide nice linker
|
|
|
|
* semantics. Since linkers generally pull in symbols by object
|
|
|
|
* files, keeping these symbols as the only symbols in this file
|
|
|
|
* prevents utility programs such as "ompi_info" from having to import
|
|
|
|
* entire components just to query their version and parameters.
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte_config.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/orte_constants.h"
|
|
|
|
#include "orte/orte_types.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
#include <sys/types.h>
|
2006-02-17 18:06:08 +03:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-08-25 20:38:42 +04:00
|
|
|
#include <unistd.h>
|
2006-02-17 18:06:08 +03:00
|
|
|
#endif
|
2005-08-25 20:38:42 +04:00
|
|
|
#include <signal.h>
|
2006-02-17 18:06:08 +03:00
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
2006-02-17 18:06:08 +03:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2007-04-21 04:15:05 +04:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "opal/util/argv.h"
|
|
|
|
#include "opal/util/output.h"
|
|
|
|
#include "opal/util/opal_environ.h"
|
2005-08-25 20:38:42 +04:00
|
|
|
#include "opal/util/path.h"
|
2005-10-01 01:44:05 +04:00
|
|
|
#include "opal/util/show_help.h"
|
2006-05-16 18:14:12 +04:00
|
|
|
#include "opal/util/basename.h"
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
#include "orte/mca/ns/base/base.h"
|
|
|
|
#include "orte/mca/rml/rml.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/smr/smr.h"
|
2006-10-07 19:45:24 +04:00
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
|
|
|
#include "orte/mca/pls/pls.h"
|
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-03-14 23:57:21 +03:00
|
|
|
#include "pls_slurm.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_slurm_launch_job(orte_jobid_t jobid);
|
2007-01-25 17:17:44 +03:00
|
|
|
static int pls_slurm_terminate_job(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs);
|
2007-04-25 00:53:54 +04:00
|
|
|
static int pls_slurm_terminate_orteds(struct timeval *timeout, opal_list_t *attrs);
|
2005-03-14 23:57:21 +03:00
|
|
|
static int pls_slurm_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_slurm_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs);
|
2006-06-08 22:27:17 +04:00
|
|
|
static int pls_slurm_signal_proc(const orte_process_name_t *name, int32_t signal);
|
2005-03-14 23:57:21 +03:00
|
|
|
static int pls_slurm_finalize(void);
|
2007-01-25 17:17:44 +03:00
|
|
|
static int pls_slurm_cancel_operation(void);
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
static int pls_slurm_start_proc(int argc, char **argv, char **env,
|
|
|
|
char *prefix);
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/*
|
|
|
|
* Global variable
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_pls_base_module_1_3_0_t orte_pls_slurm_module = {
|
|
|
|
pls_slurm_launch_job,
|
2005-03-14 23:57:21 +03:00
|
|
|
pls_slurm_terminate_job,
|
2006-09-15 01:29:51 +04:00
|
|
|
pls_slurm_terminate_orteds,
|
2005-03-14 23:57:21 +03:00
|
|
|
pls_slurm_terminate_proc,
|
2006-06-08 22:27:17 +04:00
|
|
|
pls_slurm_signal_job,
|
|
|
|
pls_slurm_signal_proc,
|
2007-01-25 17:17:44 +03:00
|
|
|
pls_slurm_cancel_operation,
|
2005-03-14 23:57:21 +03:00
|
|
|
pls_slurm_finalize
|
|
|
|
};
|
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/*
|
2007-04-25 00:53:54 +04:00
|
|
|
* Local variables
|
2005-08-25 20:38:42 +04:00
|
|
|
*/
|
|
|
|
static pid_t srun_pid = 0;
|
2007-04-25 00:53:54 +04:00
|
|
|
static orte_jobid_t active_job = ORTE_JOBID_INVALID;
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/*
|
|
|
|
* External
|
|
|
|
*/
|
2006-08-23 07:32:36 +04:00
|
|
|
#if !defined(__WINDOWS__)
|
2005-08-25 02:19:48 +04:00
|
|
|
extern char **environ;
|
2006-08-23 07:32:36 +04:00
|
|
|
#endif /* !defined(__WINDOWS__) */
|
2005-08-25 02:19:48 +04:00
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
/* When working in this function, ALWAYS jump to "cleanup" if
|
|
|
|
* you encounter an error so that orterun will be woken up and
|
|
|
|
* the job can cleanly terminate
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
static int pls_slurm_launch_job(orte_jobid_t jobid)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2007-04-25 00:53:54 +04:00
|
|
|
orte_job_map_t *map = NULL;
|
2006-10-07 19:45:24 +04:00
|
|
|
opal_list_item_t *item;
|
2005-08-25 02:19:48 +04:00
|
|
|
size_t num_nodes;
|
|
|
|
orte_vpid_t vpid;
|
2007-03-29 04:50:56 +04:00
|
|
|
char *jobid_string = NULL;
|
2007-04-10 18:23:32 +04:00
|
|
|
char *param;
|
2007-04-25 00:53:54 +04:00
|
|
|
char **argv = NULL;
|
2005-08-25 02:19:48 +04:00
|
|
|
int argc;
|
|
|
|
int rc;
|
2005-08-25 20:38:42 +04:00
|
|
|
char *tmp;
|
2007-03-29 04:50:56 +04:00
|
|
|
char** env = NULL;
|
2005-08-25 20:38:42 +04:00
|
|
|
char* var;
|
2005-08-26 02:29:23 +04:00
|
|
|
char *nodelist_flat;
|
|
|
|
char **nodelist_argv;
|
|
|
|
int nodelist_argc;
|
|
|
|
orte_process_name_t* name;
|
|
|
|
char *name_string;
|
2005-09-07 01:52:28 +04:00
|
|
|
char **custom_strings;
|
2005-10-01 01:44:05 +04:00
|
|
|
int num_args, i;
|
|
|
|
char *cur_prefix;
|
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 joblaunchstart, launchstart, launchstop;
|
2007-04-10 18:23:32 +04:00
|
|
|
int proc_name_index = 0;
|
2007-04-25 00:53:54 +04:00
|
|
|
bool failed_launch = true;
|
2005-08-25 20:38:42 +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
|
|
|
if (mca_pls_slurm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&joblaunchstart, NULL)) {
|
|
|
|
opal_output(0, "pls_slurm: could not obtain job start time");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
/* save the active jobid */
|
|
|
|
active_job = jobid;
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* 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
|
|
|
|
* All other mapping responsibilities fall to orted in the fork PLS
|
2005-08-25 02:19:48 +04:00
|
|
|
*/
|
2006-10-07 19:45:24 +04:00
|
|
|
rc = orte_rmaps.get_job_map(&map, jobid);
|
2005-08-25 02:19:48 +04:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
2006-11-16 18:11:45 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
2007-04-25 00:53:54 +04:00
|
|
|
goto cleanup;
|
2005-08-25 02:19:48 +04:00
|
|
|
}
|
|
|
|
|
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);
|
2007-04-25 00:53:54 +04:00
|
|
|
goto cleanup;
|
2006-11-16 18:11:45 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
/*
|
|
|
|
* Allocate a range of vpids for the daemons.
|
|
|
|
*/
|
2006-10-07 19:45:24 +04:00
|
|
|
num_nodes = opal_list_get_size(&map->nodes);
|
2005-08-25 02:19:48 +04:00
|
|
|
if (num_nodes == 0) {
|
2006-11-16 18:11:45 +03:00
|
|
|
/* nothing further to do - job must have been launched
|
|
|
|
* on existing daemons, so we can just return
|
|
|
|
*/
|
|
|
|
OBJ_RELEASE(map);
|
|
|
|
return ORTE_SUCCESS;
|
2005-08-25 02:19:48 +04:00
|
|
|
}
|
|
|
|
rc = orte_ns.reserve_range(0, num_nodes, &vpid);
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
2007-04-25 00:53:54 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
2005-08-25 02:19:48 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
/* need integer value for command line parameter */
|
|
|
|
asprintf(&jobid_string, "%lu", (unsigned long) jobid);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* start building argv array
|
|
|
|
*/
|
|
|
|
argv = NULL;
|
|
|
|
argc = 0;
|
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
/*
|
|
|
|
* SLURM srun OPTIONS
|
|
|
|
*/
|
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/* add the srun command */
|
|
|
|
opal_argv_append(&argc, &argv, "srun");
|
|
|
|
|
2005-09-07 01:52:28 +04:00
|
|
|
/* Append user defined arguments to srun */
|
|
|
|
if ( NULL != mca_pls_slurm_component.custom_args ) {
|
|
|
|
custom_strings = opal_argv_split(mca_pls_slurm_component.custom_args, ' ');
|
|
|
|
num_args = opal_argv_count(custom_strings);
|
|
|
|
for (i = 0; i < num_args; ++i) {
|
|
|
|
opal_argv_append(&argc, &argv, custom_strings[i]);
|
|
|
|
}
|
|
|
|
opal_argv_free(custom_strings);
|
|
|
|
}
|
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
asprintf(&tmp, "--nodes=%lu", (unsigned long) num_nodes);
|
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
2005-08-25 20:38:42 +04:00
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
asprintf(&tmp, "--ntasks=%lu", (unsigned long) num_nodes);
|
2005-08-25 20:38:42 +04:00
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
/* create nodelist */
|
|
|
|
nodelist_argv = NULL;
|
|
|
|
nodelist_argc = 0;
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
for (item = opal_list_get_first(&map->nodes);
|
|
|
|
item != opal_list_get_end(&map->nodes);
|
2005-08-26 02:29:23 +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;
|
2005-08-26 02:29:23 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
opal_argv_append(&nodelist_argc, &nodelist_argv, node->nodename);
|
2005-08-26 02:29:23 +04:00
|
|
|
}
|
|
|
|
nodelist_flat = opal_argv_join(nodelist_argv, ',');
|
2007-03-29 04:50:56 +04:00
|
|
|
opal_argv_free(nodelist_argv);
|
2005-08-26 02:29:23 +04:00
|
|
|
asprintf(&tmp, "--nodelist=%s", nodelist_flat);
|
|
|
|
opal_argv_append(&argc, &argv, tmp);
|
|
|
|
free(tmp);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ORTED OPTIONS
|
|
|
|
*/
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
/* add the daemon command (as specified by user) */
|
|
|
|
opal_argv_append(&argc, &argv, mca_pls_slurm_component.orted);
|
|
|
|
opal_argv_append(&argc, &argv, "--no-daemonize");
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2007-04-10 18:23:32 +04:00
|
|
|
/* Add basic orted command line options */
|
|
|
|
orte_pls_base_orted_append_basic_args(&argc, &argv,
|
|
|
|
&proc_name_index,
|
|
|
|
NULL,
|
|
|
|
jobid_string,
|
|
|
|
num_nodes
|
|
|
|
);
|
2005-08-26 02:29:23 +04:00
|
|
|
|
|
|
|
/* force orted to use the slurm sds */
|
|
|
|
opal_argv_append(&argc, &argv, "--ns-nds");
|
|
|
|
opal_argv_append(&argc, &argv, "slurm");
|
|
|
|
|
|
|
|
/* set orte process name to be the base of the name list for the daemons */
|
2006-06-08 22:27:17 +04:00
|
|
|
rc = orte_ns.create_process_name(&name,
|
|
|
|
orte_process_info.my_name->cellid,
|
2005-08-26 02:29:23 +04:00
|
|
|
0, vpid);
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
rc = orte_ns.get_proc_name_string(&name_string, name);
|
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
opal_output(0, "orte_pls_rsh: unable to create process name");
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2007-03-30 17:43:50 +04:00
|
|
|
free(name);
|
|
|
|
|
2007-04-10 18:23:32 +04:00
|
|
|
free(argv[proc_name_index]);
|
|
|
|
argv[proc_name_index] = strdup(name_string);
|
2005-08-26 02:29:23 +04:00
|
|
|
free(name_string);
|
2005-08-25 02:19:48 +04:00
|
|
|
|
|
|
|
if (mca_pls_slurm_component.debug) {
|
|
|
|
param = opal_argv_join(argv, ' ');
|
|
|
|
if (NULL != param) {
|
|
|
|
opal_output(0, "pls:slurm: final top-level argv:");
|
|
|
|
opal_output(0, "pls:slurm: %s", param);
|
|
|
|
free(param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* Copy the prefix-directory specified in the
|
|
|
|
corresponding app_context. If there are multiple,
|
|
|
|
different prefix's in the app context, complain (i.e., only
|
|
|
|
allow one --prefix option for the entire slurm run -- we
|
|
|
|
don't support different --prefix'es for different nodes in
|
|
|
|
the SLURM pls) */
|
2005-10-01 01:44:05 +04:00
|
|
|
cur_prefix = NULL;
|
2006-10-07 19:45:24 +04:00
|
|
|
for (i=0; i < map->num_apps; i++) {
|
|
|
|
char * app_prefix_dir = map->apps[i]->prefix_dir;
|
|
|
|
/* Check for already set cur_prefix_dir -- if different,
|
|
|
|
complain */
|
|
|
|
if (NULL != app_prefix_dir) {
|
|
|
|
if (NULL != cur_prefix &&
|
|
|
|
0 != strcmp (cur_prefix, app_prefix_dir)) {
|
|
|
|
opal_show_help("help-pls-slurm.txt", "multiple-prefixes",
|
|
|
|
true, cur_prefix, app_prefix_dir);
|
|
|
|
return ORTE_ERR_FATAL;
|
|
|
|
}
|
2005-10-01 01:44:05 +04:00
|
|
|
|
2006-10-07 19:45:24 +04:00
|
|
|
/* If not yet set, copy it; iff set, then it's the
|
|
|
|
same anyway */
|
|
|
|
if (NULL == cur_prefix) {
|
|
|
|
cur_prefix = strdup(app_prefix_dir);
|
|
|
|
if (mca_pls_slurm_component.debug) {
|
|
|
|
opal_output (0, "pls:slurm: Set prefix:%s",
|
|
|
|
cur_prefix);
|
2005-10-01 01:44:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-10-07 19:45:24 +04:00
|
|
|
}
|
2005-08-25 02:19:48 +04:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/* setup environment */
|
|
|
|
env = opal_argv_copy(environ);
|
|
|
|
var = mca_base_param_environ_variable("seed", NULL, NULL);
|
|
|
|
opal_setenv(var, "0", true, &env);
|
2007-03-30 17:43:50 +04:00
|
|
|
free(var);
|
2006-11-17 23:51:03 +03:00
|
|
|
var = mca_base_param_environ_variable("orte", "slurm", "nodelist");
|
|
|
|
opal_setenv(var, nodelist_flat, true, &env);
|
|
|
|
free(nodelist_flat);
|
2007-03-30 17:43:50 +04:00
|
|
|
free(var);
|
2005-08-25 20:38:42 +04:00
|
|
|
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
if (mca_pls_slurm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&launchstart, NULL)) {
|
|
|
|
opal_output(0, "pls_slurm: could not obtain start time");
|
|
|
|
}
|
|
|
|
}
|
2006-10-20 20:50:13 +04:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/* exec the daemon */
|
2007-04-25 00:53:54 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = pls_slurm_start_proc(argc, argv, env, cur_prefix))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do NOT wait for srun to complete. Srun only completes when the processes
|
|
|
|
* it starts - in this case, the orteds - complete. We need to go ahead and
|
|
|
|
* return so orterun can do the rest of its stuff. Instead, we'll catch
|
|
|
|
* any srun failures and deal with them elsewhere
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* declare the launch a success */
|
|
|
|
failed_launch = false;
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
|
|
|
|
if (mca_pls_slurm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&launchstop, NULL)) {
|
|
|
|
opal_output(0, "pls_slurm: could not obtain stop time");
|
|
|
|
} else {
|
|
|
|
opal_output(0, "pls_slurm: daemon block launch time is %ld usec",
|
|
|
|
(launchstop.tv_sec - launchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - launchstart.tv_usec));
|
|
|
|
opal_output(0, "pls_slurm: total job launch time is %ld usec",
|
|
|
|
(launchstop.tv_sec - joblaunchstart.tv_sec)*1000000 +
|
|
|
|
(launchstop.tv_usec - joblaunchstart.tv_usec));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
if (ORTE_SUCCESS != rc) {
|
|
|
|
opal_output(0, "pls:slurm: start_procs returned error %d", rc);
|
|
|
|
goto cleanup;
|
2005-08-25 02:19:48 +04:00
|
|
|
}
|
Bring the timing instrumentation to the trunk.
If you want to look at our launch and MPI process startup times, you can do so with two MCA params:
OMPI_MCA_orte_timing: set it to anything non-zero and you will get the launch time for different steps in the job launch procedure. The degree of detail depends on the launch environment. rsh will provide you with the average, min, and max launch time for the daemons. SLURM block launches the daemon, so you only get the time to launch the daemons and the total time to launch the job. Ditto for bproc. TM looks more like rsh. Only those four environments are currently supported - anyone interested in extending this capability to other environs is welcome to do so. In all cases, you also get the time to setup the job for launch.
OMPI_MCA_ompi_timing: set it to anything non-zero and you will get the time for mpi_init to reach the compound registry command, the time to execute that command, the time to go from our stage1 barrier to the stage2 barrier, and the time to go from the stage2 barrier to the end of mpi_init. This will be output for each process, so you'll have to compile any statistics on your own. Note: if someone develops a nice parser to do so, it would be really appreciated if you could/would share!
This commit was SVN r12302.
2006-10-25 19:27:47 +04:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
/* JMS: short we stash the srun pid in the gpr somewhere for cleanup? */
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
cleanup:
|
2007-04-25 00:53:54 +04:00
|
|
|
if (NULL != map) {
|
|
|
|
OBJ_RELEASE(map);
|
|
|
|
}
|
|
|
|
if (NULL != argv) {
|
|
|
|
opal_argv_free(argv);
|
|
|
|
}
|
|
|
|
if (NULL != env) {
|
|
|
|
opal_argv_free(env);
|
|
|
|
}
|
|
|
|
|
2007-03-29 04:50:56 +04:00
|
|
|
if(NULL != jobid_string) {
|
|
|
|
free(jobid_string);
|
|
|
|
}
|
2006-10-08 02:44:00 +04:00
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
/* check for failed launch - if so, force terminate */
|
|
|
|
if (failed_launch) {
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_smr.set_job_state(jobid, ORTE_JOB_STATE_FAILED_TO_START))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_wakeup(jobid))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
return rc;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-25 17:17:44 +03:00
|
|
|
static int pls_slurm_terminate_job(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* order them to kill their local procs for this job */
|
2007-04-24 05:58:40 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_orted_kill_local_procs(jobid, timeout, attrs))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Terminate the orteds for a given job
|
|
|
|
*/
|
2007-04-25 00:53:54 +04:00
|
|
|
static int pls_slurm_terminate_orteds(struct timeval *timeout, opal_list_t *attrs)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
int rc;
|
2007-04-25 00:53:54 +04:00
|
|
|
|
|
|
|
/* deregister the waitpid callback to ensure we don't make it look like
|
|
|
|
* srun failed when it didn't. Since the srun may have already completed,
|
|
|
|
* do NOT ERROR_LOG any return code to avoid confusing, duplicate error
|
|
|
|
* messages
|
|
|
|
*/
|
|
|
|
orte_wait_cb_cancel(srun_pid);
|
|
|
|
|
|
|
|
/* tell them to die! */
|
2007-04-24 05:58:40 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_orted_exit(timeout, attrs))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
/*
|
|
|
|
* The way we've used SLURM, we can't kill individual processes --
|
|
|
|
* we'll kill the entire job
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
static int pls_slurm_terminate_proc(const orte_process_name_t *name)
|
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
opal_output(0, "pls:slurm:terminate_proc: not supported");
|
2005-08-25 02:19:48 +04:00
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-08 22:27:17 +04:00
|
|
|
/**
|
|
|
|
* Signal all the processes in the child srun by sending the signal directly to it
|
|
|
|
*/
|
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_slurm_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs)
|
2006-06-08 22:27:17 +04:00
|
|
|
{
|
|
|
|
if (0 != srun_pid) {
|
|
|
|
kill(srun_pid, (int)signal);
|
|
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Signal a specific process
|
|
|
|
*/
|
|
|
|
static int pls_slurm_signal_proc(const orte_process_name_t *name, int32_t signal)
|
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
opal_output(0, "pls:slurm:signal_proc: not supported");
|
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
2006-06-08 22:27:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-25 17:17:44 +03:00
|
|
|
/**
|
|
|
|
* Cancel an operation involving comm to an orted
|
|
|
|
*/
|
2007-02-28 11:36:34 +03:00
|
|
|
static int pls_slurm_cancel_operation(void)
|
2007-01-25 17:17:44 +03:00
|
|
|
{
|
|
|
|
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
|
|
|
static int pls_slurm_finalize(void)
|
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
int rc;
|
2007-04-25 00:53:54 +04:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* cleanup any pending recvs */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls_base_comm_stop())) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
2005-08-25 02:19:48 +04:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-25 00:53:54 +04:00
|
|
|
static void srun_wait_cb(pid_t pid, int status, void* cbdata){
|
|
|
|
/* According to the SLURM folks, srun always returns the highest exit
|
|
|
|
code of our remote processes. Thus, a non-zero exit status doesn't
|
|
|
|
necessarily mean that srun failed - it could be that an orted returned
|
|
|
|
a non-zero exit status. Of course, that means the orted failed(!), so
|
|
|
|
the end result is the same - the job didn't start.
|
|
|
|
|
|
|
|
As a result, we really can't do much with the exit status itself - it
|
|
|
|
could be something in errno (if srun itself failed), or it could be
|
|
|
|
something returned by an orted, or it could be something returned by
|
|
|
|
the OS (e.g., couldn't find the orted binary). Somebody is welcome
|
|
|
|
to sort out all the options and pretty-print a better error message. For
|
|
|
|
now, though, the only thing that really matters is that
|
|
|
|
srun failed. Report the error and make sure that orterun
|
|
|
|
wakes up - otherwise, do nothing!
|
|
|
|
*/
|
|
|
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (0 != status) {
|
|
|
|
/* we have a problem */
|
|
|
|
opal_output(0, "ERROR: srun failed to start the required daemons.");
|
|
|
|
opal_output(0, "ERROR: This could be due to an inability to find the orted binary");
|
|
|
|
opal_output(0, "ERROR: on one or more remote nodes, lack of authority to execute");
|
|
|
|
opal_output(0, "ERROR: on one or more specified nodes, or other factors.");
|
|
|
|
|
|
|
|
/* set the job state so we know it failed to start */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_smr.set_job_state(active_job, ORTE_JOB_STATE_FAILED_TO_START))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* force termination of the job */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_wakeup(active_job))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
static int pls_slurm_start_proc(int argc, char **argv, char **env,
|
|
|
|
char *prefix)
|
2005-08-25 02:19:48 +04:00
|
|
|
{
|
2006-10-24 17:05:13 +04:00
|
|
|
int fd, id, debug_daemons;
|
2005-08-25 20:38:42 +04:00
|
|
|
char *exec_argv = opal_path_findv(argv[0], 0, env, NULL);
|
2005-08-25 02:19:48 +04:00
|
|
|
|
2005-08-25 20:38:42 +04:00
|
|
|
if (NULL == exec_argv) {
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
srun_pid = fork();
|
|
|
|
if (-1 == srun_pid) {
|
2007-04-25 00:53:54 +04:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_CHILDREN);
|
|
|
|
return ORTE_ERR_SYS_LIMITS_CHILDREN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == srun_pid) { /* child */
|
2006-05-16 18:14:12 +04:00
|
|
|
char *bin_base = NULL, *lib_base = NULL;
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2006-05-16 18:14:12 +04:00
|
|
|
/* Figure out the basenames for the libdir and bindir. There
|
|
|
|
is a lengthy comment about this in pls_rsh_module.c
|
|
|
|
explaining all the rationale for how / why we're doing
|
|
|
|
this. */
|
|
|
|
|
2007-04-21 04:15:05 +04:00
|
|
|
lib_base = opal_basename(opal_install_dirs.libdir);
|
|
|
|
bin_base = opal_basename(opal_install_dirs.bindir);
|
2006-05-16 18:14:12 +04:00
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
/* If we have a prefix, then modify the PATH and
|
2007-01-22 18:50:35 +03:00
|
|
|
LD_LIBRARY_PATH environment variables. */
|
2005-10-01 01:44:05 +04:00
|
|
|
if (NULL != prefix) {
|
|
|
|
char *oldenv, *newenv;
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
/* Reset PATH */
|
|
|
|
oldenv = getenv("PATH");
|
|
|
|
if (NULL != oldenv) {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, bin_base, oldenv);
|
2005-10-01 01:44:05 +04:00
|
|
|
} else {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s", prefix, bin_base);
|
2005-10-01 01:44:05 +04:00
|
|
|
}
|
2007-01-22 18:50:35 +03:00
|
|
|
opal_setenv("PATH", newenv, true, &env);
|
2005-10-01 01:44:05 +04:00
|
|
|
if (mca_pls_slurm_component.debug) {
|
|
|
|
opal_output(0, "pls:slurm: reset PATH: %s", newenv);
|
|
|
|
}
|
|
|
|
free(newenv);
|
2006-06-08 22:27:17 +04:00
|
|
|
|
2005-10-01 01:44:05 +04:00
|
|
|
/* Reset LD_LIBRARY_PATH */
|
|
|
|
oldenv = getenv("LD_LIBRARY_PATH");
|
|
|
|
if (NULL != oldenv) {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s:%s", prefix, lib_base, oldenv);
|
2005-10-01 01:44:05 +04:00
|
|
|
} else {
|
2006-05-16 18:14:12 +04:00
|
|
|
asprintf(&newenv, "%s/%s", prefix, lib_base);
|
2005-10-01 01:44:05 +04:00
|
|
|
}
|
2007-01-22 18:50:35 +03:00
|
|
|
opal_setenv("LD_LIBRARY_PATH", newenv, true, &env);
|
2005-10-01 01:44:05 +04:00
|
|
|
if (mca_pls_slurm_component.debug) {
|
|
|
|
opal_output(0, "pls:slurm: reset LD_LIBRARY_PATH: %s",
|
|
|
|
newenv);
|
|
|
|
}
|
|
|
|
free(newenv);
|
|
|
|
}
|
|
|
|
|
2006-10-24 17:05:13 +04:00
|
|
|
/* When not in debug mode and --debug-daemons was not passed,
|
|
|
|
* tie stdout/stderr to dev null so we don't see messages from orted */
|
|
|
|
id = mca_base_param_find("orte", "debug", "daemons");
|
|
|
|
if(id < 0) {
|
|
|
|
id = mca_base_param_register_int("orte", "debug", "daemons", NULL, 0);
|
|
|
|
}
|
|
|
|
mca_base_param_lookup_int(id, &debug_daemons);
|
|
|
|
if (0 == mca_pls_slurm_component.debug && 0 == debug_daemons) {
|
2006-02-17 18:06:08 +03:00
|
|
|
fd = open("/dev/null", O_CREAT|O_WRONLY|O_TRUNC, 0666);
|
|
|
|
if (fd >= 0) {
|
|
|
|
if (fd != 1) {
|
|
|
|
dup2(fd,1);
|
|
|
|
}
|
|
|
|
if (fd != 2) {
|
|
|
|
dup2(fd,2);
|
|
|
|
}
|
|
|
|
if (fd > 2) {
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-16 23:40:23 +03:00
|
|
|
|
2005-08-27 21:08:48 +04:00
|
|
|
/* get the srun process out of orterun's process group so that
|
|
|
|
signals sent from the shell (like those resulting from
|
|
|
|
cntl-c) don't get sent to srun */
|
|
|
|
setpgid(0, 0);
|
|
|
|
|
2005-08-26 02:29:23 +04:00
|
|
|
execve(exec_argv, argv, env);
|
2006-09-15 01:29:51 +04:00
|
|
|
|
|
|
|
opal_output(0, "pls:slurm:start_proc: exec failed");
|
2005-08-27 21:08:48 +04:00
|
|
|
/* don't return - need to exit - returning would be bad -
|
|
|
|
we're not in the calling process anymore */
|
|
|
|
exit(1);
|
2007-04-25 00:53:54 +04:00
|
|
|
} else { /* parent */
|
|
|
|
/* just in case, make sure that the srun process is not in our
|
|
|
|
process group any more. Stevens says always do this on both
|
|
|
|
sides of the fork... */
|
|
|
|
setpgid(srun_pid, srun_pid);
|
|
|
|
|
|
|
|
/* setup the waitpid so we can find out if srun succeeds! */
|
|
|
|
orte_wait_cb(srun_pid, srun_wait_cb, NULL);
|
|
|
|
free(exec_argv);
|
2005-08-25 20:38:42 +04:00
|
|
|
}
|
2005-08-25 02:19:48 +04:00
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|