This approach is cleaner than the previous one -- use a temporary
shell variable to avoid setting the OMPI $libpath twice in $LD_LIBRARY_PATH. Many thanks to Glenn Morris. This commit was SVN r8883.
Этот коммит содержится в:
родитель
87a871c35b
Коммит
abc67a257f
@ -801,58 +801,28 @@ int orte_pls_rsh_launch(orte_jobid_t jobid)
|
||||
prefix_dir,
|
||||
prefix_dir, mca_pls_rsh_component.orted);
|
||||
}
|
||||
/*
|
||||
* This needs cleanup:
|
||||
* Only if the LD_LIBRARY_PATH is set, prepend our prefix/lib to it....
|
||||
*/
|
||||
if (remote_csh) {
|
||||
/* This requires some explanation. :-)
|
||||
Optimally, we would like to be able to
|
||||
execute the following [pseudocode] in a
|
||||
single csh-based line:
|
||||
|
||||
if (not_set(LD_LIBRARY_PATH)) setenv LD_LIBRARY_PATH <path> else setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<path> endif
|
||||
|
||||
But we can't because tcsh will try to
|
||||
evaluate the entire string at once --
|
||||
so if LD_LIBRARY_PATH is not yet
|
||||
defined, the ${LD_LIBRARY_PATH} in the
|
||||
else clause will cause an error.
|
||||
Specifically, tcsh is not smart enough
|
||||
to *not* interpret the "else" clause if
|
||||
the conditional is true (hence, the
|
||||
error).
|
||||
|
||||
The only way to make tcsh not error (in
|
||||
a portable way) is to force
|
||||
LD_LIBRARY_PATH to have a value. :-(
|
||||
|
||||
Specifically: if LD_LIBRARY_PATH is
|
||||
*not* set, then set it to the correct
|
||||
value. At this point in execution,
|
||||
we'll know that LD_LIBRARY_PATH is
|
||||
guaranteed to have a value (because
|
||||
either we just set it, or it already
|
||||
had a value). So we can safely prefix
|
||||
LD_LIBRARY_PATH with the correct value.
|
||||
|
||||
In the case where LD_LIBRARY_PATH was
|
||||
not already set, the end result is that
|
||||
it will contain Open MPI's libdir
|
||||
twice. This is hardly elegant, but is
|
||||
avoids this messy tcsh evaluation
|
||||
issue. :-(
|
||||
*/
|
||||
/* [t]csh is a bit more challenging -- we
|
||||
have to check whether LD_LIBRARY_PATH
|
||||
is already set before we try to set it.
|
||||
Must be very careful about obeying
|
||||
[t]csh's order of evaluation and not
|
||||
using a variable before it is defined.
|
||||
See this thread for more details:
|
||||
http://www.open-mpi.org/community/lists/users/2006/01/0517.php. */
|
||||
asprintf (&argv[local_exec_index],
|
||||
"set path = ( %s/bin $path ) ; "
|
||||
"if ( \"$?LD_LIBRARY_PATH\" == 0 ) "
|
||||
"setenv LD_LIBRARY_PATH %s/lib ; "
|
||||
"setenv LD_LIBRARY_PATH %s/lib:$LD_LIBRARY_PATH ; "
|
||||
"%s/bin/%s",
|
||||
prefix_dir,
|
||||
prefix_dir,
|
||||
prefix_dir,
|
||||
prefix_dir, mca_pls_rsh_component.orted);
|
||||
"set path = ( %s/bin $path ) ; "
|
||||
"if ( $?LD_LIBRARY_PATH == 1 ) "
|
||||
"set OMPI_have_llp ; "
|
||||
"if ( $?LD_LIBRARY_PATH == 0 ) "
|
||||
"setenv LD_LIBRARY_PATH %s/lib ; "
|
||||
"if ( $?OMPI_have_llp == 1 ) "
|
||||
"setenv LD_LIBRARY_PATH %s/lib:$LD_LIBRARY_PATH ; "
|
||||
"%s/bin/%s",
|
||||
prefix_dir,
|
||||
prefix_dir,
|
||||
prefix_dir,
|
||||
prefix_dir, mca_pls_rsh_component.orted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user