This commit cleans up the AMCA parameter implementation a bit.
* Remove the 'opal_mca_base_param_use_amca_sets' global variable * Harness the fact that you can (read should) call the cmd_line functions before initializing opal_init_util(). This pushes the MCA/GMCA/AMCA command line options into the environment before OPAL inits and starts to use these values. By putting the cmd_line parse before opal_init_util in orterun and orted we only parse the *MCA parameter files once, and correctly (alleviating the need to 'recache' the files on init.) * Small bits of cleanup. This commit was SVN r15219.
Этот коммит содержится в:
родитель
dada472c13
Коммит
f88aa6c273
@ -47,16 +47,6 @@
|
|||||||
#include "opal/constants.h"
|
#include "opal/constants.h"
|
||||||
#include "opal/util/output.h"
|
#include "opal/util/output.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* A boolean to temporarily skip over the Aggregate MCA Paramater Set
|
|
||||||
* reading.
|
|
||||||
* We need to do this as a global variable since all other entry
|
|
||||||
* functions to the _param_ funcitons make sure that the init function
|
|
||||||
* has been called. By calling init the system will pick up the
|
|
||||||
* wrong files
|
|
||||||
*/
|
|
||||||
bool opal_mca_base_param_use_amca_sets = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public variables
|
* Public variables
|
||||||
*
|
*
|
||||||
@ -74,7 +64,7 @@ static const char *mca_prefix = "OMPI_MCA_";
|
|||||||
static char *home = NULL;
|
static char *home = NULL;
|
||||||
static char *cwd = NULL;
|
static char *cwd = NULL;
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
static char * force_agg_path = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* local functions
|
* local functions
|
||||||
@ -203,8 +193,25 @@ int mca_base_param_recache_files(bool rel_path_search)
|
|||||||
id = mca_base_param_reg_string_name("mca", "base_param_file_path",
|
id = mca_base_param_reg_string_name("mca", "base_param_file_path",
|
||||||
"Aggregate MCA parameter Search path",
|
"Aggregate MCA parameter Search path",
|
||||||
false, false, agg_default_path, &new_agg_path);
|
false, false, agg_default_path, &new_agg_path);
|
||||||
|
|
||||||
if( opal_mca_base_param_use_amca_sets && NULL != new_agg_files ) {
|
id = mca_base_param_reg_string_name("mca", "base_param_file_path_force",
|
||||||
|
"Forced Aggregate MCA parameter Search path",
|
||||||
|
false, false, NULL, &force_agg_path);
|
||||||
|
|
||||||
|
if( NULL != force_agg_path ) {
|
||||||
|
char *tmp_str = NULL;
|
||||||
|
if( NULL == new_agg_path ) {
|
||||||
|
new_agg_path = strdup(force_agg_path);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmp_str = strdup(new_agg_path);
|
||||||
|
free(new_agg_path);
|
||||||
|
asprintf(&new_agg_path, "%s%c%s", force_agg_path, OPAL_ENV_SEP, tmp_str);
|
||||||
|
free(tmp_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( NULL != new_agg_files ) {
|
||||||
char *tmp_str = NULL;
|
char *tmp_str = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -867,6 +874,11 @@ int mca_base_param_finalize(void)
|
|||||||
cwd = NULL;
|
cwd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( NULL != force_agg_path ) {
|
||||||
|
free(force_agg_path);
|
||||||
|
force_agg_path = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
initialized = false;
|
initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -911,7 +923,14 @@ static int fixup_files(char **file_list, char * path, bool rel_path_search) {
|
|||||||
* - ow warn/error
|
* - ow warn/error
|
||||||
*/
|
*/
|
||||||
else if (!rel_path_search && NULL != strchr(files[i], OPAL_PATH_SEP[0]) ) {
|
else if (!rel_path_search && NULL != strchr(files[i], OPAL_PATH_SEP[0]) ) {
|
||||||
if( NULL == (tmp_file = opal_path_access(files[i], cwd, mode) ) ) {
|
if( NULL != force_agg_path ) {
|
||||||
|
tmp_file = opal_path_access(files[i], force_agg_path, mode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmp_file = opal_path_access(files[i], cwd, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( NULL == tmp_file ) {
|
||||||
opal_show_help("help-mca-param.txt", "missing-param-file",
|
opal_show_help("help-mca-param.txt", "missing-param-file",
|
||||||
true, getpid(), files[i], cwd);
|
true, getpid(), files[i], cwd);
|
||||||
exit_status = OPAL_ERROR;
|
exit_status = OPAL_ERROR;
|
||||||
|
@ -120,13 +120,6 @@ typedef struct mca_base_param_info_t mca_base_param_info_t;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Whether or not to temporarily skip over the Aggregate MCA Paramater Set
|
|
||||||
* reading. This is useful when we know the MCA parameters it will use
|
|
||||||
* are incorrect which occurs with some support tools.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC extern bool opal_mca_base_param_use_amca_sets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a real object for the info
|
* Make a real object for the info
|
||||||
*/
|
*/
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
#include "orte_config.h"
|
#include "orte_config.h"
|
||||||
#include "orte/orte_constants.h"
|
#include "orte/orte_constants.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "opal/util/argv.h"
|
#include "opal/util/argv.h"
|
||||||
#include "opal/util/opal_environ.h"
|
#include "opal/util/opal_environ.h"
|
||||||
#include "opal/mca/base/mca_base_param.h"
|
#include "opal/mca/base/mca_base_param.h"
|
||||||
@ -90,6 +94,7 @@ int orte_pls_base_orted_append_basic_args(int *argc, char ***argv,
|
|||||||
int loc_id;
|
int loc_id;
|
||||||
char * amca_param_path = NULL;
|
char * amca_param_path = NULL;
|
||||||
char * amca_param_prefix = NULL;
|
char * amca_param_prefix = NULL;
|
||||||
|
char * tmp_force = NULL;
|
||||||
|
|
||||||
/* check for debug flags */
|
/* check for debug flags */
|
||||||
orte_pls_base_mca_argv(argc, argv);
|
orte_pls_base_mca_argv(argc, argv);
|
||||||
@ -173,14 +178,21 @@ int orte_pls_base_orted_append_basic_args(int *argc, char ***argv,
|
|||||||
opal_argv_append(argc, argv, amca_param_path);
|
opal_argv_append(argc, argv, amca_param_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the ORTED hint 'path' param */
|
/* Add the 'path' param */
|
||||||
loc_id = mca_base_param_find("mca", NULL, "base_param_file_path_orted");
|
loc_id = mca_base_param_find("mca", NULL, "base_param_file_path_force");
|
||||||
mca_base_param_lookup_string(loc_id, &amca_param_path);
|
mca_base_param_lookup_string(loc_id, &tmp_force);
|
||||||
if( NULL != amca_param_path ) {
|
if( NULL == tmp_force ) {
|
||||||
opal_argv_append(argc, argv, "-mca");
|
/* Get the current working directory */
|
||||||
opal_argv_append(argc, argv, "mca_base_param_file_path_orted");
|
tmp_force = (char *) malloc(sizeof(char) * OMPI_PATH_MAX);
|
||||||
opal_argv_append(argc, argv, amca_param_path);
|
if( NULL == (tmp_force = getcwd(tmp_force, OMPI_PATH_MAX) )) {
|
||||||
|
tmp_force = strdup("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
opal_argv_append(argc, argv, "-mca");
|
||||||
|
opal_argv_append(argc, argv, "mca_base_param_file_path_force");
|
||||||
|
opal_argv_append(argc, argv, tmp_force);
|
||||||
|
|
||||||
|
free(tmp_force);
|
||||||
|
|
||||||
if( NULL != amca_param_path ) {
|
if( NULL != amca_param_path ) {
|
||||||
free(amca_param_path);
|
free(amca_param_path);
|
||||||
|
@ -189,32 +189,13 @@ int main(int argc, char *argv[])
|
|||||||
char log_file[PATH_MAX];
|
char log_file[PATH_MAX];
|
||||||
char *jobidstring;
|
char *jobidstring;
|
||||||
int i;
|
int i;
|
||||||
char * orted_amca_param_path = NULL;
|
|
||||||
|
|
||||||
/* initialize the globals */
|
/* initialize the globals */
|
||||||
memset(&orted_globals, 0, sizeof(orted_globals_t));
|
memset(&orted_globals, 0, sizeof(orted_globals_t));
|
||||||
|
|
||||||
/* Need to set this so that the orted does not throw a warning message
|
|
||||||
* about missing AMCA param files that are located in the relative or
|
|
||||||
* absolute paths (e.g., not in the package directory).
|
|
||||||
*/
|
|
||||||
opal_mca_base_param_use_amca_sets = false;
|
|
||||||
|
|
||||||
/* Ensure that enough of OPAL is setup for us to be able to run */
|
|
||||||
if (OPAL_SUCCESS != opal_init_util()) {
|
|
||||||
fprintf(stderr, "OPAL failed to initialize -- orted aborting\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* save the environment for use when launching application processes */
|
/* save the environment for use when launching application processes */
|
||||||
orted_globals.saved_environ = opal_argv_copy(environ);
|
orted_globals.saved_environ = opal_argv_copy(environ);
|
||||||
|
|
||||||
/* setup mca param system
|
|
||||||
* Do not parse the Aggregate Parameter Sets in this pass.
|
|
||||||
* we will get to them in a moment
|
|
||||||
*/
|
|
||||||
mca_base_param_init();
|
|
||||||
|
|
||||||
/* setup to check common command line options that just report and die */
|
/* setup to check common command line options that just report and die */
|
||||||
cmd_line = OBJ_NEW(opal_cmd_line_t);
|
cmd_line = OBJ_NEW(opal_cmd_line_t);
|
||||||
opal_cmd_line_create(cmd_line, orte_cmd_line_opts);
|
opal_cmd_line_create(cmd_line, orte_cmd_line_opts);
|
||||||
@ -235,58 +216,10 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
mca_base_cmd_line_process_args(cmd_line, &environ, &environ);
|
mca_base_cmd_line_process_args(cmd_line, &environ, &environ);
|
||||||
|
|
||||||
/*
|
/* Ensure that enough of OPAL is setup for us to be able to run */
|
||||||
* orterun may have given us an additional path to use when looking for
|
if (OPAL_SUCCESS != opal_init_util()) {
|
||||||
* Aggregate MCA parameter sets. Look it up, and prepend it to the
|
fprintf(stderr, "OPAL failed to initialize -- orted aborting\n");
|
||||||
* search list.
|
exit(1);
|
||||||
*/
|
|
||||||
mca_base_param_reg_string_name("mca", "base_param_file_path_orted",
|
|
||||||
"[INTERNAL] Current working directory from MPIRUN to help in finding Aggregate MCA parameters",
|
|
||||||
true, false,
|
|
||||||
NULL,
|
|
||||||
&orted_amca_param_path);
|
|
||||||
|
|
||||||
if( NULL != orted_amca_param_path ) {
|
|
||||||
int loc_id;
|
|
||||||
char * amca_param_path = NULL;
|
|
||||||
char * tmp_str = NULL;
|
|
||||||
|
|
||||||
/* Lookup the current Aggregate MCA Parameter set path */
|
|
||||||
loc_id = mca_base_param_find("mca", NULL, "base_param_file_path");
|
|
||||||
mca_base_param_lookup_string(loc_id, &amca_param_path);
|
|
||||||
|
|
||||||
asprintf(&tmp_str, "%s%c%s", orted_amca_param_path, OPAL_ENV_SEP, amca_param_path);
|
|
||||||
|
|
||||||
mca_base_param_set_string(loc_id, tmp_str);
|
|
||||||
|
|
||||||
loc_id = mca_base_param_find("mca", NULL, "base_param_file_path");
|
|
||||||
mca_base_param_lookup_string(loc_id, &amca_param_path);
|
|
||||||
|
|
||||||
if( NULL != amca_param_path) {
|
|
||||||
free(amca_param_path);
|
|
||||||
amca_param_path = NULL;
|
|
||||||
}
|
|
||||||
if( NULL != orted_amca_param_path) {
|
|
||||||
free(orted_amca_param_path);
|
|
||||||
orted_amca_param_path = NULL;
|
|
||||||
}
|
|
||||||
if( NULL != tmp_str) {
|
|
||||||
free(tmp_str);
|
|
||||||
tmp_str = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Need to recache the files since the user might have given us
|
|
||||||
* Aggregate MCA parameters that need to be reinitalized.
|
|
||||||
*/
|
|
||||||
/* GMS not sure what this does or where it went? */
|
|
||||||
opal_mca_base_param_use_amca_sets = true;
|
|
||||||
|
|
||||||
mca_base_param_recache_files(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
opal_mca_base_param_use_amca_sets = true;
|
|
||||||
mca_base_param_recache_files(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for help request */
|
/* check for help request */
|
||||||
|
@ -321,7 +321,7 @@ static void signal_forward_callback(int fd, short event, void *arg);
|
|||||||
static int create_app(int argc, char* argv[], orte_app_context_t **app,
|
static int create_app(int argc, char* argv[], orte_app_context_t **app,
|
||||||
bool *made_app, char ***app_env);
|
bool *made_app, char ***app_env);
|
||||||
static int init_globals(void);
|
static int init_globals(void);
|
||||||
static int parse_globals(int argc, char* argv[]);
|
static int parse_globals(int argc, char* argv[], opal_cmd_line_t *cmd_line);
|
||||||
static int parse_locals(int argc, char* argv[]);
|
static int parse_locals(int argc, char* argv[]);
|
||||||
static int parse_appfile(char *filename, char ***env);
|
static int parse_appfile(char *filename, char ***env);
|
||||||
static void job_state_callback(orte_jobid_t jobid, orte_proc_state_t state);
|
static void job_state_callback(orte_jobid_t jobid, orte_proc_state_t state);
|
||||||
@ -337,57 +337,34 @@ int orterun(int argc, char *argv[])
|
|||||||
opal_list_t attributes;
|
opal_list_t attributes;
|
||||||
opal_list_item_t *item;
|
opal_list_item_t *item;
|
||||||
uint8_t flow;
|
uint8_t flow;
|
||||||
char * cwd = NULL;
|
opal_cmd_line_t cmd_line;
|
||||||
|
|
||||||
/* Setup MCA params
|
|
||||||
* Do not parse the Aggregate Parameter Sets in this pass.
|
|
||||||
* we will get to them in a moment
|
|
||||||
*/
|
|
||||||
opal_mca_base_param_use_amca_sets = true;
|
|
||||||
|
|
||||||
/* Need to initialize OPAL so that install_dirs are filled in */
|
|
||||||
|
|
||||||
opal_init_util();
|
|
||||||
|
|
||||||
/* Setup MCA params */
|
|
||||||
|
|
||||||
mca_base_param_init();
|
|
||||||
orte_register_params(false);
|
|
||||||
|
|
||||||
/* find our basename (the name of the executable) so that we can
|
/* find our basename (the name of the executable) so that we can
|
||||||
use it in pretty-print error messages */
|
use it in pretty-print error messages */
|
||||||
orterun_basename = opal_basename(argv[0]);
|
orterun_basename = opal_basename(argv[0]);
|
||||||
|
|
||||||
/* Check for some "global" command line params */
|
/* Setup and parse the command line */
|
||||||
|
init_globals();
|
||||||
parse_globals(argc, argv);
|
opal_cmd_line_create(&cmd_line, cmd_line_init);
|
||||||
|
mca_base_cmd_line_setup(&cmd_line);
|
||||||
/* If we're still here, parse each app */
|
if (ORTE_SUCCESS != (ret = opal_cmd_line_parse(&cmd_line, true,
|
||||||
|
argc, argv)) ) {
|
||||||
parse_locals(argc, argv);
|
return ret;
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the current working directory
|
|
||||||
*/
|
|
||||||
cwd = (char *) malloc(sizeof(char) * MAXPATHLEN);
|
|
||||||
if( NULL == (cwd = getcwd(cwd, MAXPATHLEN) )) {
|
|
||||||
cwd = strdup("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Need to initialize OPAL so that install_dirs are filled in */
|
||||||
* Need to recache the files since the user might have given us
|
opal_init_util();
|
||||||
* Aggregate MCA parameters that need to be reinitalized.
|
|
||||||
* In addition we need to let the orted know about the current working
|
/* Setup MCA params */
|
||||||
* directory so that it has another place to look for any Aggregate MCA
|
orte_register_params(false);
|
||||||
* parameter set files
|
|
||||||
*/
|
|
||||||
mca_base_param_reg_string_name("mca", "base_param_file_path_orted",
|
/* Check for some "global" command line params */
|
||||||
"[INTERNAL] Current working directory from MPIRUN to help in finding Aggregate MCA parameters",
|
parse_globals(argc, argv, &cmd_line);
|
||||||
true, false,
|
OBJ_DESTRUCT(&cmd_line);
|
||||||
cwd,
|
|
||||||
&cwd);
|
/* If we're still here, parse each app */
|
||||||
opal_mca_base_param_use_amca_sets = true;
|
parse_locals(argc, argv);
|
||||||
mca_base_param_recache_files(false);
|
|
||||||
|
|
||||||
/* Convert the list of apps to an array of orte_app_context_t
|
/* Convert the list of apps to an array of orte_app_context_t
|
||||||
pointers */
|
pointers */
|
||||||
@ -1048,20 +1025,9 @@ static int init_globals(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int parse_globals(int argc, char* argv[])
|
static int parse_globals(int argc, char* argv[], opal_cmd_line_t *cmd_line)
|
||||||
{
|
{
|
||||||
opal_cmd_line_t cmd_line;
|
int id;
|
||||||
int id, ret;
|
|
||||||
|
|
||||||
/* Setup and parse the command line */
|
|
||||||
|
|
||||||
init_globals();
|
|
||||||
opal_cmd_line_create(&cmd_line, cmd_line_init);
|
|
||||||
mca_base_cmd_line_setup(&cmd_line);
|
|
||||||
if (ORTE_SUCCESS != (ret = opal_cmd_line_parse(&cmd_line, true,
|
|
||||||
argc, argv)) ) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* print version if requested. Do this before check for help so
|
/* print version if requested. Do this before check for help so
|
||||||
that --version --help works as one might expect. */
|
that --version --help works as one might expect. */
|
||||||
@ -1081,7 +1047,6 @@ static int parse_globals(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for help request */
|
/* Check for help request */
|
||||||
|
|
||||||
if (1 == argc || orterun_globals.help) {
|
if (1 == argc || orterun_globals.help) {
|
||||||
char *args = NULL;
|
char *args = NULL;
|
||||||
char *project_name = NULL;
|
char *project_name = NULL;
|
||||||
@ -1090,7 +1055,7 @@ static int parse_globals(int argc, char* argv[])
|
|||||||
} else {
|
} else {
|
||||||
project_name = "OpenRTE";
|
project_name = "OpenRTE";
|
||||||
}
|
}
|
||||||
args = opal_cmd_line_get_usage_msg(&cmd_line);
|
args = opal_cmd_line_get_usage_msg(cmd_line);
|
||||||
opal_show_help("help-orterun.txt", "orterun:usage", false,
|
opal_show_help("help-orterun.txt", "orterun:usage", false,
|
||||||
orterun_basename, project_name, OPAL_VERSION,
|
orterun_basename, project_name, OPAL_VERSION,
|
||||||
orterun_basename, args,
|
orterun_basename, args,
|
||||||
@ -1139,7 +1104,6 @@ static int parse_globals(int argc, char* argv[])
|
|||||||
wait_for_job_completion = false;
|
wait_for_job_completion = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJ_DESTRUCT(&cmd_line);
|
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user