1
1
openmpi/orte/mca/pls/cnos/pls_cnos.c
Ralph Castain 6d6cebb4a7 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

153 строки
3.8 KiB
C

/*
* 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
#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);
static int orte_pls_cnos_terminate_job(orte_jobid_t jobid, opal_list_t *attrs);
static int orte_pls_cnos_terminate_orteds(orte_jobid_t jobid, opal_list_t *attrs);
static int orte_pls_cnos_terminate_proc(const orte_process_name_t* proc_name);
static int orte_pls_cnos_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs);
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
static int orte_pls_cnos_terminate_job(orte_jobid_t jobid, opal_list_t *attrs)
{
#ifdef HAVE_KILLRANK
orte_jobid_t my_jobid;
my_jobid = orte_process_info.my_name->jobid;
/* make sure it's my job */
if (jobid == my_jobid) {
killrank(-1, SIGKILL);
} else {
return ORTE_ERR_NOT_SUPPORTED;
}
#else
exit(0);
#endif
return ORTE_SUCCESS;
}
static int orte_pls_cnos_terminate_orteds(orte_jobid_t jobid, opal_list_t *attrs)
{
#ifdef HAVE_KILLRANK
orte_jobid_t my_jobid;
my_jobid = orte_process_info.my_name->jobid;
/* make sure it's my job */
if (jobid == my_jobid) {
killrank(-1, SIGKILL);
} else {
return ORTE_ERR_NOT_SUPPORTED;
}
#else
exit(0);
#endif
return ORTE_SUCCESS;
}
static int orte_pls_cnos_terminate_proc(const orte_process_name_t* proc_name)
{
#ifdef HAVE_KILLRANK
orte_jobid_t my_jobid;
orte_jobid_t his_jobid;
orte_vpid_t his_vpid;
orte_ns.get_jobid(&my_jobid, orte_process_info.my_name);
orte_ns.get_jobid(&his_jobid, proc_name);
orte_ns.get_vpid(&his_vpid, proc_name);
/* make sure it's my job. This may end up killing me, but what
the heck. */
if (his_jobid == my_jobid) {
killrank((int) his_vpid, SIGKILL);
} else {
return ORTE_ERR_NOT_SUPPORTED;
}
#else
exit(0);
#endif
return ORTE_SUCCESS;
}
static int orte_pls_cnos_signal_job(orte_jobid_t jobid, int32_t signal, opal_list_t *attrs)
{
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;
}