Per request from Andy Rieb, add ability to pass PATH and LD_LIBRARY_PATH elements to ssh command
Этот коммит содержится в:
родитель
6f227f8564
Коммит
278324c52a
@ -64,6 +64,8 @@ struct orte_plm_rsh_component_t {
|
||||
bool assume_same_shell;
|
||||
bool pass_environ_mca_params;
|
||||
char *ssh_args;
|
||||
char *pass_path;
|
||||
char *pass_libpath;
|
||||
};
|
||||
typedef struct orte_plm_rsh_component_t orte_plm_rsh_component_t;
|
||||
|
||||
|
@ -208,7 +208,23 @@ static int rsh_component_register(void)
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
& mca_plm_rsh_component.ssh_args);
|
||||
&mca_plm_rsh_component.ssh_args);
|
||||
|
||||
mca_plm_rsh_component.pass_path = NULL;
|
||||
(void) mca_base_component_var_register (c, "pass_path",
|
||||
"Prepend the specified path to the remote shell's path",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&mca_plm_rsh_component.pass_path);
|
||||
|
||||
mca_plm_rsh_component.pass_libpath = NULL;
|
||||
(void) mca_base_component_var_register (c, "pass_libpath",
|
||||
"Prepend the specified library path to the remote shell's LD_LIBRARY_PATH",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&mca_plm_rsh_component.pass_libpath);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -339,7 +339,8 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
int rc;
|
||||
int i, j;
|
||||
bool found;
|
||||
|
||||
char *lib_base, *bin_base;
|
||||
|
||||
/* Figure out the basenames for the libdir and bindir. This
|
||||
requires some explanation:
|
||||
|
||||
@ -440,7 +441,23 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
orted_cmd = opal_argv_join_range(orted_argv, orted_index, opal_argv_count(orted_argv), ' ');
|
||||
}
|
||||
opal_argv_free(orted_argv); /* done with this */
|
||||
|
||||
/* if the user specified a path to pass, set it up now */
|
||||
value = opal_basename(opal_install_dirs.bindir);
|
||||
if (NULL != mca_plm_rsh_component.pass_path) {
|
||||
asprintf(&bin_base, "%s:%s/%s", mca_plm_rsh_component.pass_path, prefix_dir, value);
|
||||
} else {
|
||||
asprintf(&bin_base, "%s/%s", prefix_dir, value);
|
||||
}
|
||||
|
||||
/* if the user specified a library path to pass, set it up now */
|
||||
value = opal_basename(opal_install_dirs.libdir);
|
||||
if (NULL != mca_plm_rsh_component.pass_path) {
|
||||
asprintf(&lib_base, "%s:%s/%s", mca_plm_rsh_component.pass_libpath, prefix_dir, value);
|
||||
} else {
|
||||
asprintf(&lib_base, "%s/%s", prefix_dir, value);
|
||||
}
|
||||
|
||||
/* we now need to assemble the actual cmd that will be executed - this depends
|
||||
* upon whether or not a prefix directory is being used
|
||||
*/
|
||||
@ -451,9 +468,7 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
*/
|
||||
char *opal_prefix = getenv("OPAL_PREFIX");
|
||||
char* full_orted_cmd = NULL;
|
||||
char *lib_base, *bin_base;
|
||||
|
||||
bin_base = opal_basename(opal_install_dirs.bindir);
|
||||
|
||||
if (NULL != orted_cmd) {
|
||||
if (0 == strcmp(orted_cmd, "orted")) {
|
||||
@ -466,8 +481,6 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
free(orted_cmd);
|
||||
}
|
||||
|
||||
lib_base = opal_basename(opal_install_dirs.libdir);
|
||||
|
||||
if (ORTE_PLM_RSH_SHELL_SH == remote_shell ||
|
||||
ORTE_PLM_RSH_SHELL_KSH == remote_shell ||
|
||||
ORTE_PLM_RSH_SHELL_ZSH == remote_shell ||
|
||||
@ -477,16 +490,14 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
* we have to insert the orted_prefix in the right place
|
||||
*/
|
||||
(void)asprintf (&final_cmd,
|
||||
"%s%s%s PATH=%s/%s:$PATH ; export PATH ; "
|
||||
"LD_LIBRARY_PATH=%s/%s:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH ; "
|
||||
"DYLD_LIBRARY_PATH=%s/%s:$DYLD_LIBRARY_PATH ; export DYLD_LIBRARY_PATH ; "
|
||||
"%s%s%s PATH=%s:$PATH ; export PATH ; "
|
||||
"LD_LIBRARY_PATH=%s:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH ; "
|
||||
"DYLD_LIBRARY_PATH=%s:$DYLD_LIBRARY_PATH ; export DYLD_LIBRARY_PATH ; "
|
||||
"%s %s",
|
||||
(opal_prefix != NULL ? "OPAL_PREFIX=" : " "),
|
||||
(opal_prefix != NULL ? opal_prefix : " "),
|
||||
(opal_prefix != NULL ? " ; export OPAL_PREFIX;" : " "),
|
||||
prefix_dir, bin_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
bin_base, lib_base, lib_base,
|
||||
(orted_prefix != NULL ? orted_prefix : " "),
|
||||
(full_orted_cmd != NULL ? full_orted_cmd : " "));
|
||||
} else if (ORTE_PLM_RSH_SHELL_TCSH == remote_shell ||
|
||||
@ -504,28 +515,25 @@ static int setup_launch(int *argcptr, char ***argvptr,
|
||||
* we have to insert the orted_prefix in the right place
|
||||
*/
|
||||
(void)asprintf (&final_cmd,
|
||||
"%s%s%s set path = ( %s/%s $path ) ; "
|
||||
"%s%s%s set path = ( %s $path ) ; "
|
||||
"if ( $?LD_LIBRARY_PATH == 1 ) "
|
||||
"set OMPI_have_llp ; "
|
||||
"if ( $?LD_LIBRARY_PATH == 0 ) "
|
||||
"setenv LD_LIBRARY_PATH %s/%s ; "
|
||||
"setenv LD_LIBRARY_PATH %s ; "
|
||||
"if ( $?OMPI_have_llp == 1 ) "
|
||||
"setenv LD_LIBRARY_PATH %s/%s:$LD_LIBRARY_PATH ; "
|
||||
"setenv LD_LIBRARY_PATH %s:$LD_LIBRARY_PATH ; "
|
||||
"if ( $?DYLD_LIBRARY_PATH == 1 ) "
|
||||
"set OMPI_have_dllp ; "
|
||||
"if ( $?DYLD_LIBRARY_PATH == 0 ) "
|
||||
"setenv DYLD_LIBRARY_PATH %s/%s ; "
|
||||
"setenv DYLD_LIBRARY_PATH %s ; "
|
||||
"if ( $?OMPI_have_dllp == 1 ) "
|
||||
"setenv DYLD_LIBRARY_PATH %s/%s:$DYLD_LIBRARY_PATH ; "
|
||||
"setenv DYLD_LIBRARY_PATH %s:$DYLD_LIBRARY_PATH ; "
|
||||
"%s %s",
|
||||
(opal_prefix != NULL ? "setenv OPAL_PREFIX " : " "),
|
||||
(opal_prefix != NULL ? opal_prefix : " "),
|
||||
(opal_prefix != NULL ? " ;" : " "),
|
||||
prefix_dir, bin_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
prefix_dir, lib_base,
|
||||
bin_base, lib_base, lib_base,
|
||||
lib_base, lib_base,
|
||||
(orted_prefix != NULL ? orted_prefix : " "),
|
||||
(full_orted_cmd != NULL ? full_orted_cmd : " "));
|
||||
} else {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user