1
1

Grr...get the prefix right - need to strip the bin out of absolute path to mpirun.

This commit was SVN r24658.
Этот коммит содержится в:
Ralph Castain 2011-04-28 22:20:55 +00:00
родитель 6af2677fb8
Коммит 0ff0d20e72

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

@ -1558,43 +1558,46 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
if (opal_cmd_line_is_taken(&cmd_line, "prefix") ||
'/' == argv[0][0] || want_prefix_by_default) {
size_t param_len;
char *path_to_mpirun;
char *path_to_mpirun=NULL;
/* if both are given, check to see if they match */
if (opal_cmd_line_is_taken(&cmd_line, "prefix") && '/' == argv[0][0]) {
/* if they don't match, then that merits a warning */
param = opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0);
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 ('/' == argv[0][0]) {
char* tmp_basename = NULL;
/* If they specified an absolute path, strip off the
/bin/<exec_name>" and leave just the prefix */
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 */
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);
} 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));