1
1
openmpi/src/mca/ns/base/ns_base_nds_env.c

209 строки
6.1 KiB
C
Исходник Обычный вид История

/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*/
/** @file:
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "util/proc_info.h"
#include "util/ompi_environ.h"
#include "mca/base/mca_base_param.h"
#include "mca/ns/ns.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/base/base.h"
#include "mca/ns/base/ns_base_nds.h"
int orte_ns_nds_env_get(void)
{
int rc;
int id;
int vpid_start;
int num_procs;
char* name_string = NULL;
id = mca_base_param_register_string("ns", "nds", "name", NULL, NULL);
mca_base_param_lookup_string(id, &name_string);
if(name_string != NULL) {
if (ORTE_SUCCESS != (rc = orte_ns_base_convert_string_to_process_name(
&(orte_process_info.my_name),
name_string))) {
ORTE_ERROR_LOG(rc);
free(name_string);
return rc;
}
free(name_string);
} else {
orte_cellid_t cellid;
orte_jobid_t jobid;
orte_vpid_t vpid;
char* cellid_string;
char* jobid_string;
char* vpid_string;
id = mca_base_param_register_string("ns", "nds", "cellid", NULL, NULL);
mca_base_param_lookup_string(id, &cellid_string);
if (NULL == cellid_string) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
return ORTE_ERR_NOT_FOUND;
}
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_cellid(&cellid, cellid_string))) {
ORTE_ERROR_LOG(rc);
return(rc);
}
id = mca_base_param_register_string("ns", "nds", "jobid", NULL, NULL);
mca_base_param_lookup_string(id, &jobid_string);
if (NULL == jobid_string) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
return ORTE_ERR_NOT_FOUND;
}
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_jobid(&jobid, jobid_string))) {
ORTE_ERROR_LOG(rc);
return(rc);
}
id = mca_base_param_register_string("ns", "nds", "vpid", NULL, NULL);
mca_base_param_lookup_string(id, &vpid_string);
if (NULL == vpid_string) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
return ORTE_ERR_NOT_FOUND;
}
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_vpid(&vpid, vpid_string))) {
ORTE_ERROR_LOG(rc);
return(rc);
}
if (ORTE_SUCCESS != (rc = orte_ns.create_process_name(
&(orte_process_info.my_name),
cellid,
jobid,
vpid))) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
id = mca_base_param_register_int("ns", "nds", "vpid_start", NULL, -1);
mca_base_param_lookup_int(id, &vpid_start);
if (vpid_start < 0) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
return ORTE_ERR_NOT_FOUND;
}
id = mca_base_param_register_int("ns", "nds", "num_procs", NULL, -1);
mca_base_param_lookup_int(id, &num_procs);
if (num_procs < 0) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
return ORTE_ERR_NOT_FOUND;
}
orte_process_info.vpid_start = vpid_start;
orte_process_info.num_procs = num_procs;
return ORTE_SUCCESS;
}
int orte_ns_nds_env_put(const orte_process_name_t* name,
orte_vpid_t vpid_start, size_t num_procs,
char ***env)
{
char* param;
char* cellid;
char* jobid;
char* vpid;
char* value;
int rc;
if(ORTE_SUCCESS != (rc = orte_ns.get_cellid_string(&cellid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.get_jobid_string(&jobid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.get_vpid_string(&vpid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* set the mode to env */
if(NULL == (param = mca_base_param_environ_variable("ns","nds",NULL))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
ompi_setenv(param, "env", true, env);
free(param);
/* not a seed */
if(NULL == (param = mca_base_param_environ_variable("seed",NULL,NULL))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
ompi_unsetenv(param, env);
free(param);
/* setup the name */
if(NULL == (param = mca_base_param_environ_variable("ns","nds","cellid"))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
ompi_setenv(param, cellid, true, env);
free(param);
free(cellid);
if(NULL == (param = mca_base_param_environ_variable("ns","nds","jobid"))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
ompi_setenv(param, jobid, true, env);
free(param);
free(jobid);
if(NULL == (param = mca_base_param_environ_variable("ns","nds","vpid"))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
ompi_setenv(param, vpid, true, env);
free(param);
free(vpid);
asprintf(&value, "%d", vpid_start);
if(NULL == (param = mca_base_param_environ_variable("ns","nds","vpid_start"))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
ompi_setenv(param, value, true, env);
free(param);
free(value);
Fix a subtle bug in the registry callback system that was manifesting itself in the singleton case and (randomly) in the multiprocess case. Update the unit-test-status matrix to include priority. Add several new registry diagnostics that helped track down the above bug. M test/mca/gpr/gpr_triggers.c M test/Unit-Test-Status.xls M test/Unit-Test-Status.pdf M src/mpi/runtime/ompi_mpi_init.c M src/mca/oob/base/oob_base_xcast.c M src/mca/ns/base/ns_base_nds_env.c M src/mca/gpr/replica/api_layer/gpr_replica_dump_api.c M src/mca/gpr/replica/api_layer/gpr_replica_api.h M src/mca/gpr/replica/communications/gpr_replica_comm.h M src/mca/gpr/replica/communications/gpr_replica_remote_msg.c M src/mca/gpr/replica/communications/gpr_replica_cmd_processor.c M src/mca/gpr/replica/communications/gpr_replica_dump_cm.c M src/mca/gpr/replica/gpr_replica_component.c M src/mca/gpr/replica/gpr_replica.h M src/mca/gpr/replica/functional_layer/gpr_replica_dump_fn.c M src/mca/gpr/replica/functional_layer/gpr_replica_fn.h M src/mca/gpr/replica/functional_layer/gpr_replica_trig_ops_fn.c M src/mca/gpr/replica/functional_layer/gpr_replica_messaging_fn.c M src/mca/gpr/replica/functional_layer/gpr_replica_segment_fn.c M src/mca/gpr/proxy/gpr_proxy_dump.c M src/mca/gpr/proxy/gpr_proxy.h M src/mca/gpr/proxy/gpr_proxy_component.c M src/mca/gpr/gpr_types.h M src/mca/gpr/base/base.h M src/mca/gpr/base/unpack_api_response/gpr_base_dump_notify.c M src/mca/gpr/base/pack_api_cmd/gpr_base_pack_dump.c M src/mca/gpr/gpr.h This commit was SVN r5080.
2005-03-28 22:37:54 +00:00
asprintf(&value, "%d", (int)num_procs);
if(NULL == (param = mca_base_param_environ_variable("ns","nds","num_procs"))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
ompi_setenv(param, value, true, env);
free(param);
free(value);
return ORTE_SUCCESS;
}