1
1

Now it's time to update ORTE. Cleanup most of the ORTE tools. Force them

to use opal_basename and opal_dirname. Don't create the path manually. Use
the specialized opal functions instead.

This commit was SVN r11345.
Этот коммит содержится в:
George Bosilca 2006-08-23 02:35:00 +00:00
родитель b621313653
Коммит b4732f557a
7 изменённых файлов: 62 добавлений и 53 удалений

Просмотреть файл

@ -66,8 +66,6 @@
#include "opal/runtime/opal.h"
#include "orte/runtime/runtime.h"
extern char **environ;
/******************
* Local Functions
******************/
@ -148,6 +146,13 @@ main(int argc, char *argv[])
orte_universe_t *search_result;
search_result = (orte_universe_t *) item;
/*
* Avoid cleaning our own universe.
*/
if( (0 == strcmp(search_result->name, orte_universe_info.name)) &&
(strlen(search_result->name) == strlen(orte_universe_info.name)) ) {
continue;
}
/*
* Try to connect to the universe
*/
@ -182,6 +187,9 @@ main(int argc, char *argv[])
OBJ_RELEASE(item);
}
orte_finalize();
opal_finalize();
return exit_status;
}
@ -217,8 +225,7 @@ static int parse_args(int argc, char *argv[]) {
}
opal_setenv(mca_base_param_env_var("crs_base_is_tool"),
"1",
true, &environ);
"1", true, NULL);
/**
* Now start parsing our specific arguments
@ -244,8 +251,7 @@ static int orte_clean_init(void) {
* attach no matter if it is identified as private or not.
*/
opal_setenv(mca_base_param_env_var("universe_console"),
"1",
true, &environ);
"1", true, NULL);
/***************************
* We need all of OPAL
@ -316,7 +322,7 @@ static int orte_clean_universe(orte_universe_t *universe) {
/********************
* If the session directory is empty, then remove that too
********************/
asprintf(&session_dir, "%s/%s", prefix, frontend);
session_dir = opal_os_path( false, prefix, frontend, NULL );
opal_os_dirpath_destroy(session_dir, false, NULL );
/********************
@ -339,7 +345,8 @@ static int orte_clean_universe(orte_universe_t *universe) {
return exit_status;
}
static int orte_clean_check_universe(orte_universe_t *universe) {
static int orte_clean_check_universe(orte_universe_t *universe)
{
int ret, exit_status = ORTE_SUCCESS;
struct timeval ping_wait = {2, 0};

Просмотреть файл

@ -71,9 +71,6 @@
#include "opal/runtime/opal.h"
#include "orte/runtime/runtime.h"
extern char **environ;
/*******************
* Universe/job/vpid information Objects
*******************/
@ -93,8 +90,6 @@ struct orte_ps_vpid_info_t {
};
typedef struct orte_ps_vpid_info_t orte_ps_vpid_info_t;
OBJ_CLASS_DECLARATION(orte_ps_vpid_info_t);
void orte_ps_vpid_info_construct(orte_ps_vpid_info_t *obj);
void orte_ps_vpid_info_destruct( orte_ps_vpid_info_t *obj);
@ -129,8 +124,6 @@ struct orte_ps_job_info_t {
};
typedef struct orte_ps_job_info_t orte_ps_job_info_t;
OBJ_CLASS_DECLARATION(orte_ps_job_info_t);
void orte_ps_job_info_construct(orte_ps_job_info_t *obj);
void orte_ps_job_info_destruct( orte_ps_job_info_t *obj);
@ -155,8 +148,6 @@ struct orte_ps_universe_info_t {
};
typedef struct orte_ps_universe_info_t orte_ps_universe_info_t;
OBJ_CLASS_DECLARATION(orte_ps_universe_info_t);
void orte_ps_universe_info_construct(orte_ps_universe_info_t *obj);
void orte_ps_universe_info_destruct( orte_ps_universe_info_t *obj);
@ -404,6 +395,7 @@ main(int argc, char *argv[])
return ret;
}
}
opal_finalize();
return exit_status;
}
@ -481,8 +473,7 @@ static int orte_ps_init(void) {
* attach no matter if it is identified as private or not.
*/
opal_setenv(mca_base_param_env_var("universe_console"),
"1",
true, &environ);
"1", true, NULL);
/***************************
* We need all of OPAL
@ -805,8 +796,8 @@ static int pretty_print_vpids(orte_ps_job_info_t *job) {
/*
* Caculate segment lengths
*/
len_o_proc_name = strlen("ORTE Name");
len_proc_name = strlen("Process Name");
len_o_proc_name = (int)strlen("ORTE Name");
len_proc_name = (int)strlen("Process Name");
len_rank = 6;
len_pid = 6;
len_state = 0;
@ -940,8 +931,7 @@ static int connect_to_universe(orte_universe_t universe_info) {
* Set the environment universe information
*/
opal_setenv(mca_base_param_env_var("universe"),
univ_mca_param,
true, &environ);
univ_mca_param, true, NULL);
/*
* Restart ORTE in the requested universe

Просмотреть файл

@ -68,8 +68,6 @@
#include "orte/tools/orted/orted.h"
extern char **environ;
orted_globals_t orted_globals;
static struct opal_event term_handler;
@ -171,9 +169,6 @@ opal_cmd_line_init_t orte_cmd_line_opts[] = {
NULL, OPAL_CMD_LINE_TYPE_NULL, NULL }
};
extern char **environ;
int main(int argc, char *argv[])
{
int ret = 0;
@ -220,13 +215,13 @@ int main(int argc, char *argv[])
*/
if (orted_globals.name) {
if (ORTE_SUCCESS != (ret = opal_setenv("OMPI_MCA_ns_nds",
"env", true, &environ))) {
"env", true, NULL))) {
opal_show_help("help-orted.txt", "orted:environ", false,
"OMPI_MCA_ns_nds", "env", ret);
return ret;
}
if (ORTE_SUCCESS != (ret = opal_setenv("OMPI_MCA_ns_nds_name",
orted_globals.name, true, &environ))) {
orted_globals.name, true, NULL))) {
opal_show_help("help-orted.txt", "orted:environ", false,
"OMPI_MCA_ns_nds_name", orted_globals.name, ret);
return ret;
@ -236,13 +231,13 @@ int main(int argc, char *argv[])
* requires that they be set
*/
if (ORTE_SUCCESS != (ret = opal_setenv("OMPI_MCA_ns_nds_vpid_start",
orted_globals.vpid_start, true, &environ))) {
orted_globals.vpid_start, true, NULL))) {
opal_show_help("help-orted.txt", "orted:environ", false,
"OMPI_MCA_ns_nds_vpid_start", orted_globals.vpid_start, ret);
return ret;
}
if (ORTE_SUCCESS != (ret = opal_setenv("OMPI_MCA_ns_nds_num_procs",
orted_globals.num_procs, true, &environ))) {
orted_globals.num_procs, true, NULL))) {
opal_show_help("help-orted.txt", "orted:environ", false,
"OMPI_MCA_ns_nds_num_procs", orted_globals.num_procs, ret);
return ret;
@ -250,8 +245,7 @@ int main(int argc, char *argv[])
}
if (orted_globals.ns_nds) {
if (ORTE_SUCCESS != (ret = opal_setenv("OMPI_MCA_ns_nds",
orted_globals.ns_nds, true,
&environ))) {
orted_globals.ns_nds, true, NULL))) {
opal_show_help("help-orted.txt", "orted:environ", false,
"OMPI_MCA_ns_nds", "env", ret);
return ret;
@ -347,7 +341,7 @@ int main(int argc, char *argv[])
if (orted_globals.mpi_call_yield > 0) {
char *var;
var = mca_base_param_environ_variable("mpi", NULL, "yield_when_idle");
opal_setenv(var, "1", true, &environ);
opal_setenv(var, "1", true, NULL);
}
/* setup callback on jobid */

Просмотреть файл

@ -30,6 +30,10 @@
#include "opal/util/cmd_line.h"
#include "opal/mca/mca.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Definitions needed for communication
*/
@ -93,5 +97,8 @@ extern orted_globals_t orted_globals;
/* extern char *path_pkglibdir; */
/* extern char *path_sysconfdir; */
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTED_H */

Просмотреть файл

@ -31,6 +31,10 @@
#include "opal/mca/mca.h"
#include "orte/tools/orted/orted.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Globals
*/
@ -48,4 +52,8 @@ typedef struct {
extern orteprobe_globals_t orteprobe_globals;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTEPROBE_H */

Просмотреть файл

@ -71,11 +71,6 @@
#include "orterun.h"
#include "totalview.h"
/*
* The environment
*/
extern char** environ;
/*
* Globals
*/
@ -263,7 +258,9 @@ opal_cmd_line_init_t cmd_line_init[] = {
NULL, OPAL_CMD_LINE_TYPE_NULL, NULL }
};
#if !defined(__WINDOWS__)
extern char** environ;
#endif /* !defined(__WINDOWS__) */
/*
* Local functions
*/
@ -306,7 +303,7 @@ int orterun(int argc, char *argv[])
/* Convert the list of apps to an array of orte_app_context_t
pointers */
array_size = orte_pointer_array_get_size(apps_pa);
apps = malloc(sizeof(orte_app_context_t *) * array_size);
apps = (orte_app_context_t**)malloc(sizeof(orte_app_context_t *) * array_size);
if (NULL == apps) {
opal_show_help("help-orterun.txt", "orterun:call-failed",
true, orterun_basename, "system", "malloc returned NULL", errno);
@ -328,7 +325,7 @@ int orterun(int argc, char *argv[])
true, orterun_basename);
exit(1);
}
proc_infos = malloc(sizeof(struct proc_info_t) * j);
proc_infos = (struct proc_info_t*)malloc(sizeof(struct proc_info_t) * j);
if (NULL == proc_infos) {
opal_show_help("help-orterun.txt", "orterun:call-failed",
true, orterun_basename, "system", "malloc returned NULL", errno);
@ -359,7 +356,7 @@ int orterun(int argc, char *argv[])
false, false, (int)false, &iparam);
if (iparam) {
char *tmp = mca_base_param_environ_variable("orte", "debug", "daemons");
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, &environ))) {
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, NULL))) {
opal_show_help("help-orterun.txt", "orterun:environ", false,
orterun_basename, tmp, "1", rc);
free(tmp);
@ -372,7 +369,7 @@ int orterun(int argc, char *argv[])
false, false, 0, &iparam);
if (iparam) {
char *tmp = mca_base_param_environ_variable("orte", NULL, "debug");
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, &environ))) {
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, NULL))) {
opal_show_help("help-orterun.txt", "orterun:environ", false,
orterun_basename, tmp, "1", rc);
free(tmp);
@ -386,7 +383,7 @@ int orterun(int argc, char *argv[])
if (iparam) {
char *tmp = mca_base_param_environ_variable("orte", "debug",
"daemons_file");
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, &environ))) {
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, NULL))) {
opal_show_help("help-orterun.txt", "orterun:environ", false,
orterun_basename, tmp, "1", rc);
free(tmp);
@ -400,7 +397,7 @@ int orterun(int argc, char *argv[])
if (iparam) {
char *tmp = mca_base_param_environ_variable("orte", NULL,
"no_daemonize");
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, &environ))) {
if (ORTE_SUCCESS != (rc = opal_setenv(tmp, "1", true, NULL))) {
opal_show_help("help-orterun.txt", "orterun:environ", false,
orterun_basename, tmp, "1", rc);
free(tmp);
@ -751,7 +748,7 @@ static void abort_signal_callback(int fd, short flags, void *arg)
*/
static void signal_forward_callback(int fd, short event, void *arg)
{
struct opal_event *signal = arg;
struct opal_event *signal = (struct opal_event*)arg;
int signum, ret;
OPAL_TRACE(1);
@ -1103,7 +1100,6 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
int i, j, count, rc;
char *param, *value, *value2;
orte_app_context_t *app = NULL;
extern char **environ;
#if 0 /* Used only in the C/N notion case, remove to silence compiler warnings */
orte_std_cntr_t l, len;
#endif
@ -1307,19 +1303,24 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
if (opal_cmd_line_is_taken(&cmd_line, "prefix")) {
param = opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0);
} else {
char* tmp_basename = NULL;
/* If they specified an absolute path, strip off the
/bin/<exec_name>" and leave just the prefix */
param = strdup(dirname(argv[0]));
param = opal_dirname(argv[0]);
/* Quick sanity check to ensure we got
something/bin/<exec_name> and that the installation
tree is at least more or less what we expect it to
be */
if (0 == strcmp("bin", basename(param))) {
param = dirname(param);
tmp_basename = opal_basename(param);
if (0 == strcmp("bin", tmp_basename)) {
char* tmp = param;
param = opal_dirname(tmp);
free(tmp);
} else {
free(param);
param = NULL;
}
free(tmp_basename);
}
if (NULL != param) {
@ -1344,7 +1345,7 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
if (opal_cmd_line_is_taken(&cmd_line, "rawmap")) {
j = opal_cmd_line_get_ninsts(&cmd_line, "rawmap");
app->map_data = malloc(sizeof(orte_app_context_map_t*) * j);
app->map_data = (orte_app_context_map_t**)malloc(sizeof(orte_app_context_map_t*) * j);
if (NULL == app->map_data) {
rc = ORTE_ERR_OUT_OF_RESOURCE;
goto cleanup;

Просмотреть файл

@ -52,7 +52,9 @@
/*
* The environment
*/
#if !defined(__WINDOWS__)
extern char **environ;
#endif /* !defined(__WINDOWS__) */
#include "opal/util/opal_environ.h"
#include "opal/util/output.h"