2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2006-03-29 05:26:16 +04:00
|
|
|
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* 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.
|
2006-02-08 20:40:11 +03: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.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
2006-02-08 20:40:11 +03:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* Additional copyrights may follow
|
2006-02-08 20:40:11 +03:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
2005-09-19 19:29:14 +04:00
|
|
|
#include "orte_config.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/orte_constants.h"
|
|
|
|
|
2005-12-12 23:04:00 +03:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
2005-10-27 21:04:10 +04:00
|
|
|
#include <sys/time.h>
|
2005-12-12 23:04:00 +03:00
|
|
|
#endif /* HAVE_SYS_TIME_H */
|
2005-03-14 23:57:21 +03:00
|
|
|
#include <errno.h>
|
2005-12-12 23:04:00 +03:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-03-14 23:57:21 +03:00
|
|
|
#include <unistd.h>
|
2005-12-12 23:04:00 +03:00
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
#ifdef HAVE_STRING_H
|
2005-03-14 23:57:21 +03:00
|
|
|
#include <string.h>
|
2005-12-12 23:04:00 +03:00
|
|
|
#endif /* HAVE_STRING_H */
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-10-17 20:06:17 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
#include "opal/util/trace.h"
|
2006-09-29 17:19:44 +04:00
|
|
|
#include "opal/util/output.h"
|
2006-10-20 19:27:29 +04:00
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
|
|
|
#include "opal/util/opal_environ.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/rds/rds.h"
|
|
|
|
#include "orte/mca/ras/ras.h"
|
|
|
|
#include "orte/mca/rmaps/rmaps.h"
|
|
|
|
#include "orte/mca/pls/pls.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
#include "orte/mca/gpr/gpr.h"
|
|
|
|
#include "orte/mca/iof/iof.h"
|
|
|
|
#include "orte/mca/ns/ns.h"
|
2006-08-16 20:35:09 +04:00
|
|
|
#include "orte/mca/smr/smr.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/rmgr/base/rmgr_private.h"
|
2006-11-13 21:51:18 +03:00
|
|
|
#include "orte/mca/rmgr/base/base.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
#include "orte/mca/rmgr/urm/rmgr_urm.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int orte_rmgr_urm_setup_job(
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_app_context_t** app_context,
|
2006-08-15 23:54:10 +04:00
|
|
|
orte_std_cntr_t num_context,
|
2006-11-13 21:51:18 +03:00
|
|
|
orte_jobid_t* jobid,
|
|
|
|
opal_list_t *attrs);
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int orte_rmgr_urm_spawn_job(
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_app_context_t** app_context,
|
2006-08-15 23:54:10 +04:00
|
|
|
orte_std_cntr_t num_context,
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_jobid_t* jobid,
|
2006-09-19 05:45:05 +04:00
|
|
|
orte_std_cntr_t num_connect,
|
|
|
|
orte_process_name_t *connect,
|
2006-02-08 20:40:11 +03:00
|
|
|
orte_rmgr_cb_fn_t cbfn,
|
2006-10-17 20:06:17 +04:00
|
|
|
orte_proc_state_t cb_conditions,
|
|
|
|
opal_list_t *attributes);
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int orte_rmgr_urm_module_init(void);
|
|
|
|
|
|
|
|
static int orte_rmgr_urm_module_finalize(void);
|
2005-04-01 03:22:44 +04:00
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_rmgr_base_module_t orte_rmgr_urm_module = {
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_rmgr_urm_module_init,
|
|
|
|
orte_rmgr_urm_setup_job,
|
|
|
|
orte_rmgr_urm_spawn_job,
|
2006-09-19 05:45:05 +04:00
|
|
|
orte_rmgr_base_connect,
|
|
|
|
orte_rmgr_base_disconnect,
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_rmgr_urm_module_finalize,
|
|
|
|
/** SUPPORT FUNCTIONS ***/
|
2006-10-17 20:06:17 +04:00
|
|
|
orte_rmgr_base_find_attribute,
|
|
|
|
orte_rmgr_base_add_attribute,
|
2006-10-19 00:02:16 +04:00
|
|
|
orte_rmgr_base_merge_attributes,
|
2006-10-17 20:06:17 +04:00
|
|
|
orte_rmgr_base_delete_attribute,
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_rmgr_base_get_app_context,
|
|
|
|
orte_rmgr_base_put_app_context,
|
|
|
|
orte_rmgr_base_check_context_cwd,
|
|
|
|
orte_rmgr_base_check_context_app,
|
|
|
|
orte_rmgr_base_set_vpid_range,
|
|
|
|
orte_rmgr_base_get_vpid_range
|
2005-03-14 23:57:21 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2005-03-31 19:47:37 +04:00
|
|
|
/*
|
2006-09-15 01:29:51 +04:00
|
|
|
* Since we were selected, complete the init
|
|
|
|
* by starting the comm system
|
2005-03-31 19:47:37 +04:00
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
static int orte_rmgr_urm_module_init(void)
|
2005-03-31 19:47:37 +04:00
|
|
|
{
|
|
|
|
int rc;
|
2006-09-15 01:29:51 +04:00
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_rmgr_base_comm_start())) {
|
2005-03-31 19:47:37 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
2006-09-15 01:29:51 +04:00
|
|
|
return rc;
|
2005-03-31 19:47:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2006-09-15 01:29:51 +04:00
|
|
|
* Setup the job
|
2005-03-14 23:57:21 +03:00
|
|
|
*/
|
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
static int orte_rmgr_urm_setup_job(orte_app_context_t** app_context,
|
|
|
|
orte_std_cntr_t num_context,
|
|
|
|
orte_jobid_t* jobid,
|
|
|
|
opal_list_t *attrs)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
|
|
|
int rc;
|
2006-10-20 19:27:29 +04:00
|
|
|
orte_std_cntr_t i;
|
2006-11-13 21:51:18 +03:00
|
|
|
orte_attribute_t *attr;
|
|
|
|
orte_jobid_t *jptr;
|
2006-10-20 19:27:29 +04:00
|
|
|
|
2005-09-19 19:29:14 +04:00
|
|
|
OPAL_TRACE(1);
|
2006-02-08 20:40:11 +03:00
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
/* check for given jobid */
|
|
|
|
if (NULL != (attr = orte_rmgr.find_attribute(attrs, ORTE_RMGR_USE_GIVEN_JOBID))) {
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&jptr, attr->value, ORTE_JOBID))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
*jobid = *jptr;
|
|
|
|
} else {
|
|
|
|
/* allocate a jobid */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_ns.create_jobid(jobid))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
2006-10-20 19:27:29 +04:00
|
|
|
/* for each app_context, we need to purge their environment of HNP
|
|
|
|
* MCA component selection directives
|
|
|
|
*/
|
|
|
|
for (i=0; i < num_context; i++) {
|
2006-10-20 20:50:13 +04:00
|
|
|
orte_rmgr_base_purge_mca_params(&app_context[i]->env);
|
2006-10-20 19:27:29 +04:00
|
|
|
}
|
|
|
|
|
2005-10-08 02:24:52 +04:00
|
|
|
/* create and initialize job segment */ /* JJH C/N mapping before this */
|
2006-02-08 20:40:11 +03:00
|
|
|
if (ORTE_SUCCESS !=
|
|
|
|
(rc = orte_rmgr_base_put_app_context(*jobid, app_context,
|
2005-03-14 23:57:21 +03:00
|
|
|
num_context))) {
|
2005-03-31 19:47:37 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
2005-03-14 23:57:21 +03:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* set a default job state of INIT. We need this so that
|
|
|
|
* orterun doesn't report an error from the registry if
|
|
|
|
* the spawn fails for some reason. Otherwise, orterun
|
|
|
|
* will try to get the job state (to see why we exited)
|
|
|
|
* and will find nothing
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_smr.set_job_state(*jobid, ORTE_JOB_STATE_INIT))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
2006-06-08 22:27:17 +04:00
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
return ORTE_SUCCESS;
|
2006-06-08 22:27:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-01 23:23:23 +04:00
|
|
|
static void orte_rmgr_urm_wireup_stdin(orte_jobid_t jobid)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
orte_process_name_t* name;
|
|
|
|
|
2005-09-19 19:29:14 +04:00
|
|
|
OPAL_TRACE(1);
|
2006-02-08 20:40:11 +03:00
|
|
|
|
2005-06-01 23:23:23 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_ns.create_process_name(&name, 0, jobid, 0))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_iof.iof_push(name, ORTE_NS_CMP_JOBID, ORTE_IOF_STDIN, 0))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
static void orte_rmgr_urm_callback(orte_gpr_notify_data_t *data, void *cbdata)
|
|
|
|
{
|
2006-03-29 05:26:16 +04:00
|
|
|
orte_rmgr_cb_fn_t cbfunc;
|
|
|
|
union {
|
|
|
|
orte_rmgr_cb_fn_t func;
|
|
|
|
void * ptr;
|
|
|
|
} cbfunc_union;
|
2005-07-18 22:49:00 +04:00
|
|
|
orte_gpr_value_t **values, *value;
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_gpr_keyval_t** keyvals;
|
|
|
|
orte_jobid_t jobid;
|
2006-08-15 23:54:10 +04:00
|
|
|
orte_std_cntr_t i, j, k;
|
2005-05-01 04:47:35 +04:00
|
|
|
int rc;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-09-19 19:29:14 +04:00
|
|
|
OPAL_TRACE(1);
|
2006-02-08 20:40:11 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* ISO C forbids conversion of object pointer to function
|
2006-03-29 05:26:16 +04:00
|
|
|
pointer. So we do this, which is the same thing, but without
|
|
|
|
the warning from GCC */
|
|
|
|
cbfunc_union.ptr = cbdata;
|
|
|
|
cbfunc = cbfunc_union.func;
|
|
|
|
|
2005-06-24 20:59:37 +04:00
|
|
|
/* we made sure in the subscriptions that at least one
|
|
|
|
* value is always returned
|
|
|
|
* get the jobid from the segment name in the first value
|
|
|
|
*/
|
2005-07-18 22:49:00 +04:00
|
|
|
values = (orte_gpr_value_t**)(data->values)->addr;
|
2005-06-24 20:59:37 +04:00
|
|
|
if (ORTE_SUCCESS != (rc =
|
|
|
|
orte_schema.extract_jobid_from_segment_name(&jobid,
|
|
|
|
values[0]->segment))) {
|
2005-03-14 23:57:21 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-07-18 22:49:00 +04:00
|
|
|
for(i = 0, k=0; k < data->cnt &&
|
|
|
|
i < (data->values)->size; i++) {
|
|
|
|
if (NULL != values[i]) {
|
|
|
|
k++;
|
|
|
|
value = values[i];
|
|
|
|
/* determine the state change */
|
|
|
|
keyvals = value->keyvals;
|
|
|
|
for(j=0; j<value->cnt; j++) {
|
|
|
|
orte_gpr_keyval_t* keyval = keyvals[j];
|
2006-02-08 20:40:11 +03:00
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_AT_INIT) == 0) {
|
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_INIT);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_LAUNCHED) == 0) {
|
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_LAUNCHED);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_RUNNING) == 0) {
|
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_RUNNING);
|
|
|
|
continue;
|
|
|
|
}
|
2005-07-18 22:49:00 +04:00
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_AT_STG1) == 0) {
|
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_AT_STG1);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_AT_STG2) == 0) {
|
2005-09-20 23:12:59 +04:00
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_AT_STG2);
|
2005-07-18 22:49:00 +04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_AT_STG3) == 0) {
|
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_AT_STG3);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_FINALIZED) == 0) {
|
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_FINALIZED);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(strcmp(keyval->key, ORTE_PROC_NUM_TERMINATED) == 0) {
|
|
|
|
(*cbfunc)(jobid,ORTE_PROC_STATE_TERMINATED);
|
|
|
|
continue;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-08 20:40:11 +03:00
|
|
|
/**
|
|
|
|
* define a callback point for completing the wireup of the stdin for io forwarding
|
|
|
|
*/
|
|
|
|
static void orte_rmgr_urm_wireup_callback(orte_gpr_notify_data_t *data, void *cbdata)
|
|
|
|
{
|
|
|
|
orte_gpr_value_t **values;
|
|
|
|
orte_jobid_t jobid;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
OPAL_TRACE(1);
|
|
|
|
|
|
|
|
/* we made sure in the subscriptions that at least one
|
|
|
|
* value is always returned
|
|
|
|
* get the jobid from the segment name in the first value
|
|
|
|
*/
|
|
|
|
values = (orte_gpr_value_t**)(data->values)->addr;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_schema.extract_jobid_from_segment_name(&jobid, values[0]->segment))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return;
|
|
|
|
}
|
2006-11-13 21:51:18 +03:00
|
|
|
|
|
|
|
opal_output(orte_rmgr_base.rmgr_output, "rmgr_urm:wireup_callback called for job %ld", (long)jobid);
|
|
|
|
|
2006-02-08 20:40:11 +03:00
|
|
|
orte_rmgr_urm_wireup_stdin(jobid);
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* Shortcut for the multiple steps involved in spawning a new job.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int orte_rmgr_urm_spawn_job(
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_app_context_t** app_context,
|
2006-08-15 23:54:10 +04:00
|
|
|
orte_std_cntr_t num_context,
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_jobid_t* jobid,
|
2006-09-19 05:45:05 +04:00
|
|
|
orte_std_cntr_t num_connect,
|
|
|
|
orte_process_name_t *connect,
|
2006-02-08 20:40:11 +03:00
|
|
|
orte_rmgr_cb_fn_t cbfunc,
|
2006-10-17 20:06:17 +04:00
|
|
|
orte_proc_state_t cb_conditions,
|
|
|
|
opal_list_t *attributes)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
orte_process_name_t* name;
|
2006-09-29 17:19:44 +04:00
|
|
|
struct timeval urmstart, urmstop;
|
2006-11-01 01:16:51 +03:00
|
|
|
orte_job_map_t *map;
|
2006-11-02 08:15:24 +03:00
|
|
|
orte_attribute_t *flow;
|
|
|
|
uint8_t flags, *fptr;
|
2006-02-08 20:40:11 +03:00
|
|
|
|
2005-09-19 19:29:14 +04:00
|
|
|
OPAL_TRACE(1);
|
2006-02-08 20:40:11 +03:00
|
|
|
|
2006-09-29 17:19:44 +04:00
|
|
|
/* check for timing request - get start time if so */
|
|
|
|
if (mca_rmgr_urm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&urmstart, NULL)) {
|
|
|
|
opal_output(0, "rmgr_urm: could not obtain start time");
|
|
|
|
urmstart.tv_sec = 0;
|
|
|
|
urmstart.tv_usec = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-02 08:15:24 +03:00
|
|
|
/* check for any flow directives to control what we do */
|
|
|
|
if (NULL != (flow = orte_rmgr.find_attribute(attributes, ORTE_RMGR_SPAWN_FLOW))) {
|
|
|
|
/* something was specified - get the value */
|
2006-11-03 23:45:22 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&fptr, flow->value, ORTE_UINT8))) {
|
2006-11-02 08:15:24 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
flags = *fptr;
|
|
|
|
} else {
|
|
|
|
flags = 0xff;
|
|
|
|
}
|
|
|
|
|
2006-02-08 20:40:11 +03:00
|
|
|
/*
|
2005-03-14 23:57:21 +03:00
|
|
|
* Perform resource discovery.
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_rds.query())) {
|
2005-03-14 23:57:21 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize job segment and allocate resources
|
2005-10-08 02:24:52 +04:00
|
|
|
*/ /* JJH Insert C/N mapping stuff here */
|
2006-10-02 04:46:31 +04:00
|
|
|
|
2006-11-02 08:15:24 +03:00
|
|
|
/* Only do this step if we have been asked to do it via the ORTE_RMGR_SPAWN_FLOW
|
|
|
|
* attribute, or if no flow flags were provided
|
|
|
|
* If the jobid = ORTE_JOBID_INVALID, then we need to
|
2006-10-02 04:46:31 +04:00
|
|
|
* get one assigned to us. Otherwise, we are entering
|
|
|
|
* with a valid jobid, so no need to get one
|
|
|
|
*/
|
2006-11-02 08:15:24 +03:00
|
|
|
if (flags & ORTE_RMGR_SETUP) {
|
|
|
|
if (ORTE_SUCCESS !=
|
2006-11-13 21:51:18 +03:00
|
|
|
(rc = orte_rmgr_urm_setup_job(app_context,num_context,jobid,attributes))) {
|
2006-11-02 08:15:24 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
2006-11-01 01:16:51 +03:00
|
|
|
|
2006-11-02 08:15:24 +03:00
|
|
|
if (flags & ORTE_RMGR_ALLOC) {
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_ras.allocate_job(*jobid, attributes))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2006-11-01 01:16:51 +03:00
|
|
|
}
|
2005-10-27 21:04:10 +04:00
|
|
|
|
2006-11-02 08:15:24 +03:00
|
|
|
if (flags & ORTE_RMGR_MAP) {
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_rmaps.map_job(*jobid, attributes))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2006-11-02 08:52:24 +03:00
|
|
|
if (NULL != orte_rmgr.find_attribute(attributes, ORTE_RMAPS_DISPLAY_AFTER_MAP)) {
|
|
|
|
orte_rmaps.get_job_map(&map, *jobid);
|
|
|
|
orte_dss.dump(0, map, ORTE_JOB_MAP);
|
|
|
|
}
|
2006-11-01 01:16:51 +03:00
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
if (flags & ORTE_RMGR_SETUP_TRIGS) {
|
|
|
|
/*
|
|
|
|
* setup I/O forwarding
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_ns.create_process_name(&name, 0, *jobid, 0))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_iof.iof_pull(name, ORTE_NS_CMP_JOBID, ORTE_IOF_STDOUT, 1))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_iof.iof_pull(name, ORTE_NS_CMP_JOBID, ORTE_IOF_STDERR, 2))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
free(name); /* done with this */
|
2006-03-29 05:26:16 +04:00
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
/* setup the launch system's stage gate counters and subscriptions */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_rmgr_base_proc_stage_gate_init(*jobid))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** setup the subscription so we can complete the wireup when all processes reach LAUNCHED */
|
|
|
|
rc = orte_smr.job_stage_gate_subscribe(*jobid, orte_rmgr_urm_wireup_callback, NULL, ORTE_PROC_STATE_LAUNCHED);
|
2005-03-14 23:57:21 +03:00
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
/*
|
|
|
|
* Define the ERRMGR's callbacks as required
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_errmgr.register_job(*jobid))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
2006-09-29 17:19:44 +04:00
|
|
|
}
|
2006-11-13 21:51:18 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* setup caller's callback
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(NULL != cbfunc) {
|
|
|
|
union {
|
|
|
|
orte_rmgr_cb_fn_t func;
|
|
|
|
void * ptr;
|
|
|
|
} cbfunc_union;
|
|
|
|
void *cbdata;
|
|
|
|
|
|
|
|
/* ISO C forbids conversion of object pointer to function
|
|
|
|
pointer. So we do this, which is the same thing, but without
|
|
|
|
the warning from GCC */
|
|
|
|
cbfunc_union.func = cbfunc;
|
|
|
|
cbdata = cbfunc_union.ptr;
|
|
|
|
|
|
|
|
rc = orte_smr.job_stage_gate_subscribe(*jobid, orte_rmgr_urm_callback, cbdata, cb_conditions);
|
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for timing request - get stop time and report elapsed time if so */
|
|
|
|
if (mca_rmgr_urm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&urmstop, NULL)) {
|
|
|
|
opal_output(0, "rmgr_urm: could not obtain stop time");
|
|
|
|
} else {
|
|
|
|
opal_output(0, "rmgr_urm: job setup time is %ld usec",
|
|
|
|
(long int)((urmstop.tv_sec - urmstart.tv_sec)*1000000 +
|
|
|
|
(urmstop.tv_usec - urmstart.tv_usec)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we don't want to launch, then just return here */
|
|
|
|
if (!(flags & ORTE_RMGR_LAUNCH)) {
|
|
|
|
return ORTE_SUCCESS;
|
2006-09-29 17:19:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-03-14 23:57:21 +03:00
|
|
|
* launch the job
|
|
|
|
*/
|
2006-09-15 01:29:51 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_pls.launch_job(*jobid))) {
|
2005-03-14 23:57:21 +03:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* check for timing request - get start time if so */
|
|
|
|
if (mca_rmgr_urm_component.timing) {
|
|
|
|
if (0 != gettimeofday(&urmstart, NULL)) {
|
|
|
|
opal_output(0, "rmgr_urm: could not obtain launch stop time");
|
|
|
|
} else {
|
|
|
|
opal_output(0, "rmgr_urm: launch time is %ld usec",
|
|
|
|
(long int)((urmstart.tv_sec - urmstop.tv_sec)*1000000 +
|
|
|
|
(urmstart.tv_usec - urmstop.tv_usec)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static int orte_rmgr_urm_module_finalize(void)
|
2005-04-01 03:22:44 +04:00
|
|
|
{
|
2005-04-15 21:04:57 +04:00
|
|
|
int rc;
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* Cancel pending receive. */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_rmgr_base_comm_stop())) {
|
2005-04-15 21:04:57 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
return rc;
|
2005-04-01 03:22:44 +04:00
|
|
|
}
|
|
|
|
|