2008-02-28 01:57:57 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2011-06-23 20:38:02 +00:00
|
|
|
* Copyright (c) 2004-2011 The University of Tennessee and The University
|
2008-02-28 01:57:57 +00:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
|
|
|
#include "orte/constants.h"
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2008-06-09 14:53:58 +00:00
|
|
|
#include "orte/util/show_help.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/mca/plm/base/base.h"
|
2011-12-05 15:40:46 +00:00
|
|
|
#include "orte/mca/plm/base/plm_private.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/mca/plm/plm.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "orte/runtime/orte_cr.h"
|
|
|
|
|
|
|
|
#include "orte/mca/ess/ess.h"
|
|
|
|
#include "orte/mca/ess/base/base.h"
|
|
|
|
#include "orte/mca/ess/tool/ess_tool.h"
|
|
|
|
|
2009-05-04 11:07:40 +00:00
|
|
|
static int rte_init(void);
|
2008-02-28 01:57:57 +00:00
|
|
|
static void rte_abort(int status, bool report) __opal_attribute_noreturn__;
|
2008-10-31 21:10:00 +00:00
|
|
|
static orte_vpid_t proc_get_daemon(orte_process_name_t *proc);
|
2008-02-28 01:57:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
orte_ess_base_module_t orte_ess_tool_module = {
|
|
|
|
rte_init,
|
|
|
|
orte_ess_base_tool_finalize,
|
2008-03-05 04:57:23 +00:00
|
|
|
rte_abort,
|
2008-04-30 19:49:53 +00:00
|
|
|
NULL, /* don't need a local procs fn */
|
2008-10-31 21:10:00 +00:00
|
|
|
proc_get_daemon,
|
2008-04-30 19:49:53 +00:00
|
|
|
NULL, /* don't need a proc_get_hostname fn */
|
|
|
|
NULL, /* don't need a proc_get_local_rank fn */
|
|
|
|
NULL, /* don't need a proc_get_node_rank fn */
|
2011-06-23 20:38:02 +00:00
|
|
|
orte_ess_base_proc_get_epoch, /* proc_get_epoch */
|
2008-11-18 15:35:50 +00:00
|
|
|
NULL, /* don't need to update_pidmap */
|
2008-10-31 21:10:00 +00:00
|
|
|
NULL, /* don't need to update_nidmap */
|
2008-03-05 04:57:23 +00:00
|
|
|
NULL /* ft_event */
|
2008-02-28 01:57:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-05-04 11:07:40 +00:00
|
|
|
static int rte_init(void)
|
2008-02-28 01:57:57 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char *error = NULL;
|
|
|
|
|
2008-06-18 03:15:56 +00:00
|
|
|
/* run the prolog */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
|
|
|
|
error = "orte_ess_base_std_prolog";
|
|
|
|
goto error;
|
|
|
|
}
|
2011-12-05 15:40:46 +00:00
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
/* If we are a tool with no name, then responsibility for
|
|
|
|
* defining the name falls to the PLM component for our
|
2011-12-05 15:40:46 +00:00
|
|
|
* respective environment.
|
|
|
|
* Just call the base function for this.
|
2008-02-28 01:57:57 +00:00
|
|
|
*
|
|
|
|
* NOTE: Tools with names - i.e., tools consisting of a
|
|
|
|
* distributed set of processes - will select and use
|
|
|
|
* the appropriate enviro-specific module and -not- this one!
|
|
|
|
*/
|
2011-12-05 15:40:46 +00:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_plm_base_set_hnp_name())) {
|
2008-02-28 01:57:57 +00:00
|
|
|
ORTE_ERROR_LOG(ret);
|
2011-12-05 15:40:46 +00:00
|
|
|
error = "orte_plm_base_set_hnp_name";
|
2008-02-28 01:57:57 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do the rest of the standard tool init */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
error = "orte_ess_base_tool_setup";
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
|
|
|
|
error:
|
2011-11-22 21:24:35 +00:00
|
|
|
if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) {
|
|
|
|
orte_show_help("help-ess-tool.txt",
|
|
|
|
"tool:rte_init:startup:internal-failure",
|
|
|
|
true, error, ORTE_ERROR_NAME(ret), ret);
|
|
|
|
}
|
|
|
|
|
2008-02-28 01:57:57 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we are a tool-without-name, then we look just like the HNP.
|
|
|
|
* In that scenario, it could be beneficial to get a core file, so
|
|
|
|
* we call abort.
|
|
|
|
*/
|
|
|
|
static void rte_abort(int status, bool report)
|
|
|
|
{
|
|
|
|
/* do NOT do a normal finalize as this will very likely
|
|
|
|
* hang the process. We are aborting due to an abnormal condition
|
|
|
|
* that precludes normal cleanup
|
|
|
|
*
|
|
|
|
* We do need to do the following bits to make sure we leave a
|
|
|
|
* clean environment. Taken from orte_finalize():
|
|
|
|
* - Assume errmgr cleans up child processes before we exit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* CRS cleanup since it may have a named pipe and thread active */
|
|
|
|
orte_cr_finalize();
|
|
|
|
|
|
|
|
/* - Clean out the global structures
|
|
|
|
* (not really necessary, but good practice)
|
|
|
|
*/
|
|
|
|
orte_proc_info_finalize();
|
|
|
|
|
2008-12-20 23:24:36 +00:00
|
|
|
/* Now just exit */
|
|
|
|
exit(0);
|
2008-02-28 01:57:57 +00:00
|
|
|
}
|
|
|
|
|
2008-10-31 21:10:00 +00:00
|
|
|
static orte_vpid_t proc_get_daemon(orte_process_name_t *proc)
|
|
|
|
{
|
|
|
|
return ORTE_VPID_INVALID;
|
|
|
|
}
|