1
1
openmpi/orte/mca/rmgr/cnos/rmgr_cnos.c

221 строка
5.0 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 "rmgr_cnos.h"
static int orte_rmgr_cnos_query(void);
static int orte_rmgr_cnos_create(
orte_app_context_t** app_context,
orte_std_cntr_t num_context,
orte_jobid_t* jobid);
static int orte_rmgr_cnos_allocate(
orte_jobid_t jobid);
static int orte_rmgr_cnos_deallocate(
orte_jobid_t jobid);
static int orte_rmgr_cnos_map(
orte_jobid_t jobid);
static int orte_rmgr_cnos_launch(
orte_jobid_t jobid);
static int orte_rmgr_cnos_terminate_job(
orte_jobid_t jobid);
static int orte_rmgr_cnos_terminate_proc(
const orte_process_name_t* proc_name);
Add ability to trap and propagate SIGUSR1/2 to remote processes. There are a number of small changes that hit a bunch of files: 1. Changed the RMGR and PLS APIs to add "signal_job" and "signal_proc" entry points. Only the "signal_job" entries are implemented - none of the components have implementations for "signal_proc" at this time. Thus, you can signal all of the procs in a job, but cannot currently signal only one specific proc. 2. Implemented those new API functions in all components except xgrid (Brian will do so very soon). Only the rsh/ssh and fork modules have been tested, however, and only under OS-X. 3. Added signal traps and callback functions for SIGUSR1/2 to orterun/mpirun that catch those signals and call the appropriate commands to propagate them out to all processes in the job. 4. Added a new test directory under the orte branch to (eventually) hold unit and system level tests for just the run-time. Since our test branch of the repository is under restricted access, people working on the RTE were continually developing their own system-level tests - thus making it hard to help diagnose problems. I have moved the more commonly-used functions here, and added one specifically for testing the SIGUSR1/2 functionality. I will be contacting people directly to seek help with testing the changes on more environments. Other than compile issues, you should see absolutely no change in behavior on any of your systems - this additional functionality is transparent to anyone who does not issue a SIGUSR1/2 to mpirun. Ralph This commit was SVN r10258.
2006-06-08 18:27:17 +00:00
static int orte_rmgr_cnos_signal_job(
orte_jobid_t jobid, int32_t signal);
Add ability to trap and propagate SIGUSR1/2 to remote processes. There are a number of small changes that hit a bunch of files: 1. Changed the RMGR and PLS APIs to add "signal_job" and "signal_proc" entry points. Only the "signal_job" entries are implemented - none of the components have implementations for "signal_proc" at this time. Thus, you can signal all of the procs in a job, but cannot currently signal only one specific proc. 2. Implemented those new API functions in all components except xgrid (Brian will do so very soon). Only the rsh/ssh and fork modules have been tested, however, and only under OS-X. 3. Added signal traps and callback functions for SIGUSR1/2 to orterun/mpirun that catch those signals and call the appropriate commands to propagate them out to all processes in the job. 4. Added a new test directory under the orte branch to (eventually) hold unit and system level tests for just the run-time. Since our test branch of the repository is under restricted access, people working on the RTE were continually developing their own system-level tests - thus making it hard to help diagnose problems. I have moved the more commonly-used functions here, and added one specifically for testing the SIGUSR1/2 functionality. I will be contacting people directly to seek help with testing the changes on more environments. Other than compile issues, you should see absolutely no change in behavior on any of your systems - this additional functionality is transparent to anyone who does not issue a SIGUSR1/2 to mpirun. Ralph This commit was SVN r10258.
2006-06-08 18:27:17 +00:00
static int orte_rmgr_cnos_signal_proc(
const orte_process_name_t* proc_name, int32_t signal);
Add ability to trap and propagate SIGUSR1/2 to remote processes. There are a number of small changes that hit a bunch of files: 1. Changed the RMGR and PLS APIs to add "signal_job" and "signal_proc" entry points. Only the "signal_job" entries are implemented - none of the components have implementations for "signal_proc" at this time. Thus, you can signal all of the procs in a job, but cannot currently signal only one specific proc. 2. Implemented those new API functions in all components except xgrid (Brian will do so very soon). Only the rsh/ssh and fork modules have been tested, however, and only under OS-X. 3. Added signal traps and callback functions for SIGUSR1/2 to orterun/mpirun that catch those signals and call the appropriate commands to propagate them out to all processes in the job. 4. Added a new test directory under the orte branch to (eventually) hold unit and system level tests for just the run-time. Since our test branch of the repository is under restricted access, people working on the RTE were continually developing their own system-level tests - thus making it hard to help diagnose problems. I have moved the more commonly-used functions here, and added one specifically for testing the SIGUSR1/2 functionality. I will be contacting people directly to seek help with testing the changes on more environments. Other than compile issues, you should see absolutely no change in behavior on any of your systems - this additional functionality is transparent to anyone who does not issue a SIGUSR1/2 to mpirun. Ralph This commit was SVN r10258.
2006-06-08 18:27:17 +00:00
static int orte_rmgr_cnos_spawn(
orte_app_context_t** app_context,
orte_std_cntr_t num_context,
orte_jobid_t* jobid,
orte_rmgr_cb_fn_t cbfn,
orte_proc_state_t cb_conditions);
static int orte_rmgr_cnos_finalize(void);
orte_rmgr_base_module_t orte_rmgr_cnos_module = {
orte_rmgr_cnos_query,
orte_rmgr_cnos_create,
orte_rmgr_cnos_allocate,
orte_rmgr_cnos_deallocate,
orte_rmgr_cnos_map,
orte_rmgr_cnos_launch,
orte_rmgr_cnos_terminate_job,
orte_rmgr_cnos_terminate_proc,
Add ability to trap and propagate SIGUSR1/2 to remote processes. There are a number of small changes that hit a bunch of files: 1. Changed the RMGR and PLS APIs to add "signal_job" and "signal_proc" entry points. Only the "signal_job" entries are implemented - none of the components have implementations for "signal_proc" at this time. Thus, you can signal all of the procs in a job, but cannot currently signal only one specific proc. 2. Implemented those new API functions in all components except xgrid (Brian will do so very soon). Only the rsh/ssh and fork modules have been tested, however, and only under OS-X. 3. Added signal traps and callback functions for SIGUSR1/2 to orterun/mpirun that catch those signals and call the appropriate commands to propagate them out to all processes in the job. 4. Added a new test directory under the orte branch to (eventually) hold unit and system level tests for just the run-time. Since our test branch of the repository is under restricted access, people working on the RTE were continually developing their own system-level tests - thus making it hard to help diagnose problems. I have moved the more commonly-used functions here, and added one specifically for testing the SIGUSR1/2 functionality. I will be contacting people directly to seek help with testing the changes on more environments. Other than compile issues, you should see absolutely no change in behavior on any of your systems - this additional functionality is transparent to anyone who does not issue a SIGUSR1/2 to mpirun. Ralph This commit was SVN r10258.
2006-06-08 18:27:17 +00:00
orte_rmgr_cnos_signal_job,
orte_rmgr_cnos_signal_proc,
orte_rmgr_cnos_spawn,
orte_rmgr_base_proc_stage_gate_init,
orte_rmgr_base_proc_stage_gate_mgr,
orte_rmgr_cnos_finalize
};
/*
* Create the job segment and initialize the application context.
*/
static int orte_rmgr_cnos_create(
orte_app_context_t** app_context,
orte_std_cntr_t num_context,
orte_jobid_t* jobid)
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_query(void)
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_allocate(orte_jobid_t jobid)
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_deallocate(orte_jobid_t jobid)
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_map(orte_jobid_t jobid)
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_launch(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_rmgr_cnos_terminate_job(orte_jobid_t jobid)
{
#ifdef HAVE_KILLRANK
orte_jobid_t my_jobid;
orte_ns.get_jobid(&my_jobid, orte_process_info.my_name);
/* 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_rmgr_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_rmgr_cnos_signal_job(orte_jobid_t jobid, int32_t signal)
Add ability to trap and propagate SIGUSR1/2 to remote processes. There are a number of small changes that hit a bunch of files: 1. Changed the RMGR and PLS APIs to add "signal_job" and "signal_proc" entry points. Only the "signal_job" entries are implemented - none of the components have implementations for "signal_proc" at this time. Thus, you can signal all of the procs in a job, but cannot currently signal only one specific proc. 2. Implemented those new API functions in all components except xgrid (Brian will do so very soon). Only the rsh/ssh and fork modules have been tested, however, and only under OS-X. 3. Added signal traps and callback functions for SIGUSR1/2 to orterun/mpirun that catch those signals and call the appropriate commands to propagate them out to all processes in the job. 4. Added a new test directory under the orte branch to (eventually) hold unit and system level tests for just the run-time. Since our test branch of the repository is under restricted access, people working on the RTE were continually developing their own system-level tests - thus making it hard to help diagnose problems. I have moved the more commonly-used functions here, and added one specifically for testing the SIGUSR1/2 functionality. I will be contacting people directly to seek help with testing the changes on more environments. Other than compile issues, you should see absolutely no change in behavior on any of your systems - this additional functionality is transparent to anyone who does not issue a SIGUSR1/2 to mpirun. Ralph This commit was SVN r10258.
2006-06-08 18:27:17 +00:00
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_signal_proc(const orte_process_name_t* proc_name, int32_t signal)
Add ability to trap and propagate SIGUSR1/2 to remote processes. There are a number of small changes that hit a bunch of files: 1. Changed the RMGR and PLS APIs to add "signal_job" and "signal_proc" entry points. Only the "signal_job" entries are implemented - none of the components have implementations for "signal_proc" at this time. Thus, you can signal all of the procs in a job, but cannot currently signal only one specific proc. 2. Implemented those new API functions in all components except xgrid (Brian will do so very soon). Only the rsh/ssh and fork modules have been tested, however, and only under OS-X. 3. Added signal traps and callback functions for SIGUSR1/2 to orterun/mpirun that catch those signals and call the appropriate commands to propagate them out to all processes in the job. 4. Added a new test directory under the orte branch to (eventually) hold unit and system level tests for just the run-time. Since our test branch of the repository is under restricted access, people working on the RTE were continually developing their own system-level tests - thus making it hard to help diagnose problems. I have moved the more commonly-used functions here, and added one specifically for testing the SIGUSR1/2 functionality. I will be contacting people directly to seek help with testing the changes on more environments. Other than compile issues, you should see absolutely no change in behavior on any of your systems - this additional functionality is transparent to anyone who does not issue a SIGUSR1/2 to mpirun. Ralph This commit was SVN r10258.
2006-06-08 18:27:17 +00:00
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_spawn(
orte_app_context_t** app_context,
orte_std_cntr_t num_context,
orte_jobid_t* jobid,
orte_rmgr_cb_fn_t cbfunc,
orte_proc_state_t cb_conditions)
{
return ORTE_ERR_NOT_SUPPORTED;
}
static int orte_rmgr_cnos_finalize(void)
{
#ifdef HAVE_CNOS_PM_BARRIER
/* register with the process manager so that everyone aborts if
any one process aborts. This is a bit slower than it needs to
be, but useful. */
cnos_pm_barrier(1);
#endif
return ORTE_SUCCESS;
}