Cleanup the prefix handling by mpirun. Important note: we do NOT support per-app_context prefixes!!
Don't let app_files trump given prefix values. Assign according to following precedence rules: 1. absolute path to mpirun, if given 2. --prefix value, if given to mpirun 3. default prefix, if configured with --enable-orterun-prefix-default 4. prefix from first app in app_file, if given 5. no prefix This commit was SVN r26081.
Этот коммит содержится в:
родитель
8791ade293
Коммит
6c93dd13b0
@ -161,6 +161,17 @@ Only one should be specified to avoid potential version
|
|||||||
confusion. Operation will continue, but the -prefix option will be
|
confusion. Operation will continue, but the -prefix option will be
|
||||||
ignored.
|
ignored.
|
||||||
#
|
#
|
||||||
|
[orterun:app-prefix-conflict]
|
||||||
|
Both a prefix or absolute path was given for %s, and a different
|
||||||
|
prefix provided for the first app_context:
|
||||||
|
|
||||||
|
Mpirun prefix: %s
|
||||||
|
App prefix: %s
|
||||||
|
|
||||||
|
Only one should be specified to avoid potential version
|
||||||
|
confusion. Operation will continue, but the applicaton's prefix
|
||||||
|
option will be ignored.
|
||||||
|
#
|
||||||
[orterun:empty-prefix]
|
[orterun:empty-prefix]
|
||||||
A prefix was supplied to %s that only contained slashes.
|
A prefix was supplied to %s that only contained slashes.
|
||||||
|
|
||||||
|
@ -533,7 +533,8 @@ int orterun(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
opal_cmd_line_t cmd_line;
|
opal_cmd_line_t cmd_line;
|
||||||
char * tmp_env_var = NULL;
|
char *tmp_env_var = NULL;
|
||||||
|
char *param;
|
||||||
orte_job_t *daemons;
|
orte_job_t *daemons;
|
||||||
int32_t ljob;
|
int32_t ljob;
|
||||||
orte_app_context_t *app, *dapp;
|
orte_app_context_t *app, *dapp;
|
||||||
@ -562,6 +563,88 @@ int orterun(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
mca_base_cmd_line_process_args(&cmd_line, &environ, &environ);
|
mca_base_cmd_line_process_args(&cmd_line, &environ, &environ);
|
||||||
|
|
||||||
|
/* may look strange, but the way we handle prefix is a little weird
|
||||||
|
* and probably needs to be addressed more fully at some future point.
|
||||||
|
* For now, we have a conflict between app_files and cmd line usage.
|
||||||
|
* Since app_files are used by the C/R system, we will make an
|
||||||
|
* adjustment here to avoid perturbing that system.
|
||||||
|
*
|
||||||
|
* We cannot just have the cmd line parser place any found value
|
||||||
|
* in the global struct as the app_file parser would replace it.
|
||||||
|
* So handle this specific cmd line option manually.
|
||||||
|
*/
|
||||||
|
orterun_globals.prefix = NULL;
|
||||||
|
orterun_globals.path_to_mpirun = NULL;
|
||||||
|
if (opal_cmd_line_is_taken(&cmd_line, "prefix") ||
|
||||||
|
'/' == argv[0][0] || want_prefix_by_default) {
|
||||||
|
size_t param_len;
|
||||||
|
|
||||||
|
if ('/' == argv[0][0]) {
|
||||||
|
char* tmp_basename = NULL;
|
||||||
|
/* If they specified an absolute path, strip off the
|
||||||
|
/bin/<exec_name>" and leave just the prefix */
|
||||||
|
orterun_globals.path_to_mpirun = 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 */
|
||||||
|
tmp_basename = opal_basename(orterun_globals.path_to_mpirun);
|
||||||
|
if (0 == strcmp("bin", tmp_basename)) {
|
||||||
|
char* tmp = orterun_globals.path_to_mpirun;
|
||||||
|
orterun_globals.path_to_mpirun = opal_dirname(tmp);
|
||||||
|
free(tmp);
|
||||||
|
} else {
|
||||||
|
free(orterun_globals.path_to_mpirun);
|
||||||
|
orterun_globals.path_to_mpirun = NULL;
|
||||||
|
}
|
||||||
|
free(tmp_basename);
|
||||||
|
}
|
||||||
|
/* if both are given, check to see if they match */
|
||||||
|
if (opal_cmd_line_is_taken(&cmd_line, "prefix") && NULL != orterun_globals.path_to_mpirun) {
|
||||||
|
/* if they don't match, then that merits a warning */
|
||||||
|
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
||||||
|
if (0 != strcmp(param, orterun_globals.path_to_mpirun)) {
|
||||||
|
orte_show_help("help-orterun.txt", "orterun:double-prefix",
|
||||||
|
true, orte_basename,
|
||||||
|
param, orterun_globals.path_to_mpirun);
|
||||||
|
/* let the path-to-mpirun take precedence since we
|
||||||
|
* know that one is being used
|
||||||
|
*/
|
||||||
|
free(param);
|
||||||
|
param = orterun_globals.path_to_mpirun;
|
||||||
|
} else {
|
||||||
|
/* since they match, just use param */
|
||||||
|
free(orterun_globals.path_to_mpirun);
|
||||||
|
}
|
||||||
|
} else if (NULL != orterun_globals.path_to_mpirun) {
|
||||||
|
param = orterun_globals.path_to_mpirun;
|
||||||
|
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
|
||||||
|
/* must be --prefix alone */
|
||||||
|
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
||||||
|
} else {
|
||||||
|
/* --enable-orterun-prefix-default was given to orterun */
|
||||||
|
param = strdup(opal_install_dirs.prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != param) {
|
||||||
|
/* "Parse" the param, aka remove superfluous path_sep. */
|
||||||
|
param_len = strlen(param);
|
||||||
|
while (0 == strcmp (OPAL_PATH_SEP, &(param[param_len-1]))) {
|
||||||
|
param[param_len-1] = '\0';
|
||||||
|
param_len--;
|
||||||
|
if (0 == param_len) {
|
||||||
|
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
|
||||||
|
true, orte_basename, orte_basename);
|
||||||
|
return ORTE_ERR_FATAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
orterun_globals.prefix = strdup(param);
|
||||||
|
free(param);
|
||||||
|
}
|
||||||
|
want_prefix_by_default = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* Ensure that enough of OPAL is setup for us to be able to run */
|
/* Ensure that enough of OPAL is setup for us to be able to run */
|
||||||
/*
|
/*
|
||||||
* NOTE: (JJH)
|
* NOTE: (JJH)
|
||||||
@ -1571,81 +1654,68 @@ static int create_app(int argc, char* argv[],
|
|||||||
app->user_specified_cwd = false;
|
app->user_specified_cwd = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check to see if the user explicitly wanted to disable automatic
|
/* if this is the first app_context, check for prefix directions.
|
||||||
--prefix behavior */
|
* We only do this for the first app_context because the launchers
|
||||||
|
* only look at the first one when setting the prefix - we do NOT
|
||||||
if (opal_cmd_line_is_taken(&cmd_line, "noprefix")) {
|
* support per-app_context prefix settings!
|
||||||
want_prefix_by_default = false;
|
*/
|
||||||
}
|
if (0 == total_num_apps) {
|
||||||
|
/* Check to see if the user explicitly wanted to disable automatic
|
||||||
/* Did the user specify a specific prefix for this app_context_t
|
--prefix behavior */
|
||||||
or provide an absolute path name to argv[0]? */
|
|
||||||
if (opal_cmd_line_is_taken(&cmd_line, "prefix") ||
|
if (opal_cmd_line_is_taken(&cmd_line, "noprefix")) {
|
||||||
'/' == argv[0][0] || want_prefix_by_default) {
|
want_prefix_by_default = false;
|
||||||
size_t param_len;
|
|
||||||
char *path_to_mpirun=NULL;
|
|
||||||
|
|
||||||
if ('/' == argv[0][0]) {
|
|
||||||
char* tmp_basename = NULL;
|
|
||||||
/* If they specified an absolute path, strip off the
|
|
||||||
/bin/<exec_name>" and leave just the prefix */
|
|
||||||
path_to_mpirun = 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 */
|
|
||||||
tmp_basename = opal_basename(path_to_mpirun);
|
|
||||||
if (0 == strcmp("bin", tmp_basename)) {
|
|
||||||
char* tmp = path_to_mpirun;
|
|
||||||
path_to_mpirun = opal_dirname(tmp);
|
|
||||||
free(tmp);
|
|
||||||
} else {
|
|
||||||
free(path_to_mpirun);
|
|
||||||
path_to_mpirun = NULL;
|
|
||||||
}
|
|
||||||
free(tmp_basename);
|
|
||||||
}
|
|
||||||
/* if both are given, check to see if they match */
|
|
||||||
if (opal_cmd_line_is_taken(&cmd_line, "prefix") && NULL != path_to_mpirun) {
|
|
||||||
/* if they don't match, then that merits a warning */
|
|
||||||
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
|
||||||
if (0 != strcmp(param, path_to_mpirun)) {
|
|
||||||
orte_show_help("help-orterun.txt", "orterun:double-prefix",
|
|
||||||
true, orte_basename, orte_basename, param, path_to_mpirun);
|
|
||||||
/* let the path-to-mpirun take precedence since we
|
|
||||||
* know that one is being used
|
|
||||||
*/
|
|
||||||
free(param);
|
|
||||||
param = path_to_mpirun;
|
|
||||||
} else {
|
|
||||||
/* since they match, just use param */
|
|
||||||
free(path_to_mpirun);
|
|
||||||
}
|
|
||||||
} else if (NULL != path_to_mpirun) {
|
|
||||||
param = path_to_mpirun;
|
|
||||||
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
|
|
||||||
/* must be --prefix alone */
|
|
||||||
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
|
||||||
} else {
|
|
||||||
/* --enable-orterun-prefix-default was given to orterun */
|
|
||||||
param = strdup(opal_install_dirs.prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != param) {
|
/* Did the user specify a prefix, or want prefix by default? */
|
||||||
/* "Parse" the param, aka remove superfluous path_sep. */
|
if (opal_cmd_line_is_taken(&cmd_line, "prefix") || want_prefix_by_default) {
|
||||||
param_len = strlen(param);
|
size_t param_len;
|
||||||
while (0 == strcmp (OPAL_PATH_SEP, &(param[param_len-1]))) {
|
/* if both the prefix was given and we have a prefix
|
||||||
param[param_len-1] = '\0';
|
* given above, check to see if they match
|
||||||
param_len--;
|
*/
|
||||||
if (0 == param_len) {
|
if (opal_cmd_line_is_taken(&cmd_line, "prefix") &&
|
||||||
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
|
NULL != orterun_globals.prefix) {
|
||||||
true, orte_basename, orte_basename);
|
/* if they don't match, then that merits a warning */
|
||||||
return ORTE_ERR_FATAL;
|
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
||||||
|
if (0 != strcmp(param, orterun_globals.prefix)) {
|
||||||
|
orte_show_help("help-orterun.txt", "orterun:app-prefix-conflict",
|
||||||
|
true, orte_basename, orterun_globals.prefix, param);
|
||||||
|
/* let the global-level prefix take precedence since we
|
||||||
|
* know that one is being used
|
||||||
|
*/
|
||||||
|
free(param);
|
||||||
|
param = orterun_globals.prefix;
|
||||||
|
} else {
|
||||||
|
/* since they match, just use param */
|
||||||
|
free(orterun_globals.prefix);
|
||||||
|
orterun_globals.prefix = NULL;
|
||||||
}
|
}
|
||||||
|
} else if (NULL != orterun_globals.prefix) {
|
||||||
|
param = orterun_globals.prefix;
|
||||||
|
} else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){
|
||||||
|
/* must be --prefix alone */
|
||||||
|
param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0));
|
||||||
|
} else {
|
||||||
|
/* --enable-orterun-prefix-default was given to orterun */
|
||||||
|
param = strdup(opal_install_dirs.prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
app->prefix_dir = strdup(param);
|
if (NULL != param) {
|
||||||
free(param);
|
/* "Parse" the param, aka remove superfluous path_sep. */
|
||||||
|
param_len = strlen(param);
|
||||||
|
while (0 == strcmp (OPAL_PATH_SEP, &(param[param_len-1]))) {
|
||||||
|
param[param_len-1] = '\0';
|
||||||
|
param_len--;
|
||||||
|
if (0 == param_len) {
|
||||||
|
orte_show_help("help-orterun.txt", "orterun:empty-prefix",
|
||||||
|
true, orte_basename, orte_basename);
|
||||||
|
return ORTE_ERR_FATAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app->prefix_dir = strdup(param);
|
||||||
|
free(param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ struct orterun_globals_t {
|
|||||||
bool wait_for_server;
|
bool wait_for_server;
|
||||||
int server_wait_timeout;
|
int server_wait_timeout;
|
||||||
char *stdin_target;
|
char *stdin_target;
|
||||||
|
char *prefix;
|
||||||
|
char *path_to_mpirun;
|
||||||
#if OPAL_ENABLE_FT_CR == 1
|
#if OPAL_ENABLE_FT_CR == 1
|
||||||
char *sstore_load;
|
char *sstore_load;
|
||||||
#endif
|
#endif
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user