Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: George Bosilca (bosilca_at_[hidden])
Date: 2007-07-19 16:20:16


Sorry, you're right. You store them in the launch environment, which
will be used later by the ODLS to setup the environment for the child.

   george.

On Jul 19, 2007, at 3:46 PM, Ralph H Castain wrote:

> I believe you may have misunderstood the change. I don't change
> anyone's
> path in the middle of the run. I only alter the environment that
> the odls
> uses to launch the child processes, and that gets applied to the
> child at
> execve time. Mpirun's environment remains unchanged.
>
> So I'm not sure I understand your issue...
>
>
> On 7/19/07 1:23 PM, "George Bosilca" <bosilca_at_[hidden]> wrote:
>
>> I have a *BIG DOUBT* about this approach. The problem will lead to
>> some really strange situations, as we change the LD_LIBRARY_PATH of a
>> process in the middle of the run. As a result the place from where we
>> load dynamic libraries before and after this call will potentially
>> became different.
>>
>> It looks to me that the correct fix should set the PATH and
>> LD_LIBRARY_PATH only after the fork that will execve the child
>> process and not before. So, instead of having this code in the
>> orterun, we should have it in the ODLS ... But then the ODLS will
>> have to different behaviors: the case where the ODLS inherit the
>> environment from the orted [and then everything is already correctly
>> set because the orted did it] and the case it inherit the environment
>> from the orterun [and where the PATH and LD_LIBRARY_PATH are not yet
>> set].
>>
>> george.
>>
>>
>> On Jul 19, 2007, at 3:00 PM, rhc_at_[hidden] wrote:
>>
>>> Author: rhc
>>> Date: 2007-07-19 15:00:06 EDT (Thu, 19 Jul 2007)
>>> New Revision: 15516
>>> URL: https://svn.open-mpi.org/trac/ompi/changeset/15516
>>>
>>> Log:
>>> Ensure that the LD_LIBRARY_PATH and PATH get properly set for procs
>>> locally spawned by mpirun.
>>>
>>> Text files modified:
>>> trunk/orte/tools/orterun/orterun.c | 55 ++++++++++++++++++++++
>>> +++++++++++++++--
>>> 1 files changed, 52 insertions(+), 3 deletions(-)
>>>
>>> Modified: trunk/orte/tools/orterun/orterun.c
>>> ====================================================================
>>> ==
>>> ========
>>> --- trunk/orte/tools/orterun/orterun.c (original)
>>> +++ trunk/orte/tools/orterun/orterun.c 2007-07-19 15:00:06 EDT
>>> (Thu, 19 Jul 2007)
>>> @@ -22,6 +22,8 @@
>>> */
>>>
>>> #include "orte_config.h"
>>> +#include "orte/orte_constants.h"
>>> +
>>>
>>> #include <stdio.h>
>>> #ifdef HAVE_UNISTD_H
>>> @@ -61,8 +63,7 @@
>>>
>>> #include "opal/version.h"
>>> #include "opal/runtime/opal.h"
>>> -
>>> -#include "orte/orte_constants.h"
>>> +#include "opal/util/os_path.h"
>>>
>>> #include "orte/class/orte_pointer_array.h"
>>> #include "orte/util/proc_info.h"
>>> @@ -351,7 +352,6 @@
>>>
>>> /* Setup MCA params */
>>>
>>> -
>>> /* Check for some "global" command line params */
>>> parse_globals(argc, argv, &cmd_line);
>>> OBJ_DESTRUCT(&cmd_line);
>>> @@ -400,6 +400,55 @@
>>> return rc;
>>> }
>>>
>>> + /* If we have a prefix, then modify the PATH and
>>> + LD_LIBRARY_PATH environment variables in our copy. This
>>> + will ensure that any locally-spawned children will
>>> + have our executables and libraries in their path
>>> +
>>> + For now, default to the prefix_dir provided in the first
>>> app_context.
>>> + Since there always MUST be at least one app_context, we
>>> are safe in
>>> + doing this.
>>> + */
>>> + if (NULL != apps[0]->prefix_dir) {
>>> + char *oldenv, *newenv, *lib_base, *bin_base;
>>> +
>>> + lib_base = opal_basename(opal_install_dirs.libdir);
>>> + bin_base = opal_basename(opal_install_dirs.bindir);
>>> +
>>> + /* Reset PATH */
>>> + newenv = opal_os_path( false, apps[0]->prefix_dir,
>>> bin_base, NULL );
>>> + oldenv = getenv("PATH");
>>> + if (NULL != oldenv) {
>>> + char *temp;
>>> + asprintf(&temp, "%s:%s", newenv, oldenv );
>>> + free( newenv );
>>> + newenv = temp;
>>> + }
>>> + opal_setenv("PATH", newenv, true, &orte_launch_environ);
>>> + if (orte_debug_flag) {
>>> + opal_output(0, "%s: reset PATH: %s", orterun_basename,
>>> newenv);
>>> + }
>>> + free(newenv);
>>> + free(bin_base);
>>> +
>>> + /* Reset LD_LIBRARY_PATH */
>>> + newenv = opal_os_path( false, apps[0]->prefix_dir,
>>> lib_base, NULL );
>>> + oldenv = getenv("LD_LIBRARY_PATH");
>>> + if (NULL != oldenv) {
>>> + char* temp;
>>> + asprintf(&temp, "%s:%s", newenv, oldenv);
>>> + free(newenv);
>>> + newenv = temp;
>>> + }
>>> + opal_setenv("LD_LIBRARY_PATH", newenv, true,
>>> &orte_launch_environ);
>>> + if (orte_debug_flag) {
>>> + opal_output(0, "%s: reset LD_LIBRARY_PATH: %s",
>>> + orterun_basename, newenv);
>>> + }
>>> + free(newenv);
>>> + free(lib_base);
>>> + }
>>> +
>>> /* since we are a daemon, we should *always* yield the
>>> processor when idle */
>>> opal_progress_set_yield_when_idle(true);
>>>
>>> _______________________________________________
>>> svn mailing list
>>> svn_at_[hidden]
>>> http://www.open-mpi.org/mailman/listinfo.cgi/svn
>>
>> _______________________________________________
>> devel mailing list
>> devel_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel