2006-09-14 21:29:51 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 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$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
#include "orte_config.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif /* HAVE_STRING_H */
|
|
|
|
#ifdef HAVE_SIGNAL_H
|
|
|
|
#include <signal.h>
|
|
|
|
#endif
|
2007-01-25 14:17:44 +00:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
|
2006-09-14 21:29:51 +00:00
|
|
|
#ifdef HAVE_CNOS_PM_BARRIER
|
|
|
|
#include <catamount/cnos_mpi_os.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "orte/orte_constants.h"
|
|
|
|
#include "orte/mca/rmgr/base/base.h"
|
|
|
|
#include "orte/mca/ns/ns.h"
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "pls_cnos.h"
|
|
|
|
|
|
|
|
|
|
|
|
static int orte_pls_cnos_launch_job(orte_jobid_t jobid);
|
2007-01-25 14:17:44 +00:00
|
|
|
static int orte_pls_cnos_terminate_job(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs);
|
2007-04-24 20:53:54 +00:00
|
|
|
static int orte_pls_cnos_terminate_orteds(struct timeval *timeout, opal_list_t *attrs);
|
2006-09-14 21:29:51 +00:00
|
|
|
static int orte_pls_cnos_terminate_proc(const orte_process_name_t* proc_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 19:34:59 +00:00
|
|
|
static int orte_pls_cnos_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs);
|
2006-09-14 21:29:51 +00:00
|
|
|
static int orte_pls_cnos_signal_proc(const orte_process_name_t* proc_name, int32_t signal);
|
|
|
|
static int orte_pls_cnos_finalize(void);
|
|
|
|
|
|
|
|
|
|
|
|
orte_pls_base_module_t orte_pls_cnos_module = {
|
|
|
|
orte_pls_cnos_launch_job,
|
|
|
|
orte_pls_cnos_terminate_job,
|
|
|
|
orte_pls_cnos_terminate_orteds,
|
|
|
|
orte_pls_cnos_terminate_proc,
|
|
|
|
orte_pls_cnos_signal_job,
|
|
|
|
orte_pls_cnos_signal_proc,
|
|
|
|
orte_pls_cnos_finalize
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int orte_pls_cnos_launch_job(orte_jobid_t jobid)
|
|
|
|
{
|
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_KILLRANK
|
|
|
|
#include "catamount/types.h"
|
|
|
|
/* secret sauce on the Cray machine */
|
|
|
|
extern int killrank(rank_t RANK, int SIG);
|
|
|
|
#endif
|
|
|
|
|
2007-01-25 14:17:44 +00:00
|
|
|
static int orte_pls_cnos_terminate_job(orte_jobid_t jobid, struct timeval *timeout, opal_list_t *attrs)
|
2006-09-14 21:29:51 +00:00
|
|
|
{
|
2007-01-17 22:47:27 +00:00
|
|
|
orte_jobid_t my_jobid = ORTE_PROC_MY_NAME->jobid;
|
2006-09-14 21:29:51 +00:00
|
|
|
|
|
|
|
/* make sure it's my job */
|
|
|
|
if (jobid == my_jobid) {
|
2007-01-17 22:47:27 +00:00
|
|
|
#ifdef HAVE_KILLRANK
|
2006-09-14 21:29:51 +00:00
|
|
|
killrank(-1, SIGKILL);
|
|
|
|
#else
|
2007-01-17 22:47:27 +00:00
|
|
|
exit(0);
|
2006-09-14 21:29:51 +00:00
|
|
|
#endif
|
2007-01-17 22:47:27 +00:00
|
|
|
}
|
2006-09-14 21:29:51 +00:00
|
|
|
|
2007-01-17 22:47:27 +00:00
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
2006-09-14 21:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-24 20:53:54 +00:00
|
|
|
static int orte_pls_cnos_terminate_orteds(struct timeval *timeout, opal_list_t *attrs)
|
2006-09-14 21:29:51 +00:00
|
|
|
{
|
2007-01-17 22:47:27 +00:00
|
|
|
#ifdef HAVE_KILLRANK
|
2007-04-24 20:53:54 +00:00
|
|
|
killrank(-1, SIGKILL);
|
2006-09-14 21:29:51 +00:00
|
|
|
#else
|
2007-04-24 20:53:54 +00:00
|
|
|
exit(0);
|
2006-09-14 21:29:51 +00:00
|
|
|
#endif
|
2007-01-17 22:47:27 +00:00
|
|
|
|
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
2006-09-14 21:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int orte_pls_cnos_terminate_proc(const orte_process_name_t* proc_name)
|
|
|
|
{
|
2007-01-17 22:47:27 +00:00
|
|
|
orte_jobid_t my_jobid = ORTE_PROC_MY_NAME->jobid;
|
|
|
|
orte_jobid_t his_jobid = proc_name->jobid;
|
|
|
|
orte_vpid_t his_vpid = proc_name->vpid;
|
2006-09-14 21:29:51 +00:00
|
|
|
|
|
|
|
/* make sure it's my job. This may end up killing me, but what
|
|
|
|
the heck. */
|
|
|
|
if (his_jobid == my_jobid) {
|
2007-01-17 22:47:27 +00:00
|
|
|
#ifdef HAVE_KILLRANK
|
2006-09-14 21:29:51 +00:00
|
|
|
killrank((int) his_vpid, SIGKILL);
|
|
|
|
#else
|
2007-01-17 22:47:27 +00:00
|
|
|
exit(0);
|
2006-09-14 21:29:51 +00:00
|
|
|
#endif
|
2007-01-17 22:47:27 +00:00
|
|
|
}
|
2006-09-14 21:29:51 +00:00
|
|
|
|
2007-01-17 22:47:27 +00:00
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
2006-09-14 21:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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 19:34:59 +00:00
|
|
|
static int orte_pls_cnos_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs)
|
2006-09-14 21:29:51 +00:00
|
|
|
{
|
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int orte_pls_cnos_signal_proc(const orte_process_name_t* proc_name, int32_t signal)
|
|
|
|
{
|
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int orte_pls_cnos_finalize(void)
|
|
|
|
{
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|