2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 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.
|
2006-02-07 06:32:36 +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-07 06:32:36 +03:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* Additional copyrights may follow
|
2006-02-07 06:32:36 +03:00
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/orte_constants.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-02-07 06:32:36 +03:00
|
|
|
#include "orte/dss/dss.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
|
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
|
|
|
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-07-04 04:13:44 +04:00
|
|
|
#include "opal/util/argv.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
#include "opal/util/trace.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/rmgr/base/rmgr_private.h"
|
2005-09-19 19:29:14 +04:00
|
|
|
#include "orte/mca/rmgr/base/base.h"
|
2005-05-01 04:58:06 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following file was created by configure. It contains extern
|
|
|
|
* statements and the definition of an array of pointers to each
|
|
|
|
* component's public mca_base_component_t struct.
|
|
|
|
*/
|
|
|
|
|
2005-07-04 22:24:58 +04:00
|
|
|
#include "orte/mca/rmgr/base/static-components.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* globals
|
|
|
|
*/
|
|
|
|
|
|
|
|
orte_rmgr_base_t orte_rmgr_base;
|
|
|
|
orte_rmgr_base_module_t orte_rmgr = {
|
2006-09-15 01:29:51 +04:00
|
|
|
NULL,
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_rmgr_base_create_not_available,
|
|
|
|
orte_rmgr_base_spawn_not_available,
|
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_base_finalize_not_available,
|
|
|
|
/** 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
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup up app_context_t class so we can use it
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* orte_app_context_t constructor
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void orte_app_context_construct(orte_app_context_t* app_context)
|
|
|
|
{
|
|
|
|
app_context->idx=0;
|
|
|
|
app_context->app=NULL;
|
|
|
|
app_context->num_procs=0;
|
|
|
|
app_context->argv=NULL;
|
|
|
|
app_context->env=NULL;
|
|
|
|
app_context->cwd=NULL;
|
|
|
|
app_context->num_map = 0;
|
|
|
|
app_context->map_data = NULL;
|
2005-09-06 20:10:05 +04:00
|
|
|
app_context->prefix_dir = NULL;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* destructor - used to free any resources held by instance */
|
|
|
|
static void orte_app_context_destructor(orte_app_context_t* app_context)
|
|
|
|
{
|
2006-08-15 23:54:10 +04:00
|
|
|
orte_std_cntr_t i;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
if (NULL != app_context->app) {
|
|
|
|
free (app_context->app);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* argv and env lists created by util/argv copy functions */
|
|
|
|
if (NULL != app_context->argv) {
|
2005-07-04 04:13:44 +04:00
|
|
|
opal_argv_free(app_context->argv);
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != app_context->env) {
|
2005-07-04 04:13:44 +04:00
|
|
|
opal_argv_free(app_context->env);
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != app_context->cwd) {
|
|
|
|
free (app_context->cwd);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != app_context->map_data) {
|
|
|
|
for (i = 0; i < app_context->num_map; ++i) {
|
|
|
|
if (NULL != app_context->map_data[i]) {
|
|
|
|
OBJ_RELEASE(app_context->map_data[i]);
|
|
|
|
}
|
|
|
|
}
|
2006-10-02 04:46:31 +04:00
|
|
|
if (NULL != app_context->map_data) {
|
|
|
|
free(app_context->map_data);
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
2006-10-02 04:46:31 +04:00
|
|
|
|
2005-09-06 20:10:05 +04:00
|
|
|
if (NULL != app_context->prefix_dir) {
|
|
|
|
free(app_context->prefix_dir);
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
2005-07-03 20:06:07 +04:00
|
|
|
/* define instance of opal_class_t */
|
2005-03-14 23:57:21 +03:00
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
orte_app_context_t, /* type name */
|
2005-07-03 20:06:07 +04:00
|
|
|
opal_object_t, /* parent "class" name */
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_app_context_construct, /* constructor */
|
|
|
|
orte_app_context_destructor); /* destructor */
|
|
|
|
|
|
|
|
|
2006-02-07 06:32:36 +03:00
|
|
|
static void orte_app_context_map_construct(orte_app_context_map_t *a)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
|
|
|
a->map_type = ORTE_APP_CONTEXT_MAP_INVALID;
|
|
|
|
a->map_data = NULL;
|
|
|
|
}
|
|
|
|
|
2006-02-07 06:32:36 +03:00
|
|
|
static void orte_app_context_map_destruct(orte_app_context_map_t *a)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
|
|
|
if (NULL != a->map_data) {
|
|
|
|
free(a->map_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-07 06:32:36 +03:00
|
|
|
OBJ_CLASS_INSTANCE(orte_app_context_map_t,
|
2005-07-03 20:06:07 +04:00
|
|
|
opal_object_t,
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_app_context_map_construct,
|
|
|
|
orte_app_context_map_destruct);
|
|
|
|
|
2006-10-17 20:06:17 +04:00
|
|
|
/*
|
|
|
|
* ATTRIBUTE
|
|
|
|
*/
|
|
|
|
static void orte_attribute_construct(orte_attribute_t *a)
|
|
|
|
{
|
|
|
|
a->key = NULL;
|
|
|
|
a->value = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void orte_attribute_destruct(orte_attribute_t *a)
|
|
|
|
{
|
|
|
|
if (NULL != a->key) free(a->key);
|
|
|
|
if (NULL != a->value) OBJ_RELEASE(a->value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(orte_attribute_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
orte_attribute_construct,
|
|
|
|
orte_attribute_destruct);
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/**
|
|
|
|
* Function for finding and opening either all MCA components, or the one
|
|
|
|
* that was specifically requested via a MCA parameter.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int orte_rmgr_base_open(void)
|
|
|
|
{
|
2005-05-01 04:58:06 +04:00
|
|
|
int param, value, rc;
|
|
|
|
orte_data_type_t tmp;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-09-19 19:29:14 +04:00
|
|
|
OPAL_TRACE(5);
|
2006-02-07 06:32:36 +03:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* Debugging / verbose output */
|
|
|
|
|
2005-07-04 03:31:27 +04:00
|
|
|
orte_rmgr_base.rmgr_output = opal_output_open(NULL);
|
2006-02-07 06:32:36 +03:00
|
|
|
param = mca_base_param_reg_int_name("rmgr_base", "verbose",
|
2005-08-15 22:25:35 +04:00
|
|
|
"Verbosity level for the rmgr framework",
|
|
|
|
false, false, 0, &value);
|
2005-03-14 23:57:21 +03:00
|
|
|
if (value != 0) {
|
2005-07-04 03:31:27 +04:00
|
|
|
orte_rmgr_base.rmgr_output = opal_output_open(NULL);
|
2005-03-14 23:57:21 +03:00
|
|
|
} else {
|
|
|
|
orte_rmgr_base.rmgr_output = -1;
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* register the base system types with the DSS */
|
2005-05-01 04:58:06 +04:00
|
|
|
tmp = ORTE_APP_CONTEXT;
|
2006-02-07 06:32:36 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_rmgr_base_pack_app_context,
|
|
|
|
orte_rmgr_base_unpack_app_context,
|
|
|
|
(orte_dss_copy_fn_t)orte_rmgr_base_copy_app_context,
|
|
|
|
(orte_dss_compare_fn_t)orte_rmgr_base_compare_app_context,
|
|
|
|
(orte_dss_size_fn_t)orte_rmgr_base_size_app_context,
|
|
|
|
(orte_dss_print_fn_t)orte_rmgr_base_print_app_context,
|
|
|
|
(orte_dss_release_fn_t)orte_rmgr_base_std_obj_release,
|
|
|
|
ORTE_DSS_STRUCTURED,
|
|
|
|
"ORTE_APP_CONTEXT", &tmp))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-05-01 04:58:06 +04:00
|
|
|
tmp = ORTE_APP_CONTEXT_MAP;
|
2006-02-07 06:32:36 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_rmgr_base_pack_app_context_map,
|
|
|
|
orte_rmgr_base_unpack_app_context_map,
|
|
|
|
(orte_dss_copy_fn_t)orte_rmgr_base_copy_app_context_map,
|
|
|
|
(orte_dss_compare_fn_t)orte_rmgr_base_compare_app_context_map,
|
|
|
|
(orte_dss_size_fn_t)orte_rmgr_base_size_app_context_map,
|
|
|
|
(orte_dss_print_fn_t)orte_rmgr_base_print_app_context_map,
|
|
|
|
(orte_dss_release_fn_t)orte_rmgr_base_std_obj_release,
|
|
|
|
ORTE_DSS_STRUCTURED,
|
|
|
|
"ORTE_APP_CONTEXT_MAP", &tmp))) {
|
2005-05-01 04:58:06 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2006-10-17 20:06:17 +04:00
|
|
|
tmp = ORTE_ATTRIBUTE;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_rmgr_base_pack_attribute,
|
|
|
|
orte_rmgr_base_unpack_attribute,
|
|
|
|
(orte_dss_copy_fn_t)orte_rmgr_base_copy_attribute,
|
|
|
|
(orte_dss_compare_fn_t)orte_rmgr_base_compare_attribute,
|
|
|
|
(orte_dss_size_fn_t)orte_rmgr_base_size_attribute,
|
|
|
|
(orte_dss_print_fn_t)orte_rmgr_base_print_attribute,
|
|
|
|
(orte_dss_release_fn_t)orte_rmgr_base_std_obj_release,
|
|
|
|
ORTE_DSS_STRUCTURED,
|
|
|
|
"ORTE_ATTRIBUTE", &tmp))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = ORTE_ATTR_LIST;
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_rmgr_base_pack_attr_list,
|
|
|
|
orte_rmgr_base_unpack_attr_list,
|
|
|
|
(orte_dss_copy_fn_t)orte_rmgr_base_copy_attr_list,
|
|
|
|
(orte_dss_compare_fn_t)orte_rmgr_base_compare_attr_list,
|
|
|
|
(orte_dss_size_fn_t)orte_rmgr_base_size_attr_list,
|
|
|
|
(orte_dss_print_fn_t)orte_rmgr_base_print_attr_list,
|
|
|
|
(orte_dss_release_fn_t)orte_rmgr_base_std_obj_release,
|
|
|
|
ORTE_DSS_STRUCTURED,
|
|
|
|
"ORTE_ATTR_LIST", &tmp))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open up all available components */
|
2006-02-07 06:32:36 +03:00
|
|
|
|
|
|
|
if (ORTE_SUCCESS !=
|
2005-08-15 22:25:35 +04:00
|
|
|
mca_base_components_open("rmgr", orte_rmgr_base.rmgr_output,
|
2006-02-07 06:32:36 +03:00
|
|
|
mca_rmgr_base_static_components,
|
2005-04-13 07:19:48 +04:00
|
|
|
&orte_rmgr_base.rmgr_components, true)) {
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|