Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] environment variables and MPI_Comm_spawn
From: Ralph Castain (rhc_at_[hidden])
Date: 2013-12-12 10:47:35


It would have to be done via MPI_Info arguments, and we never had a request
to do so (and hence, don't define such an argument). It would be easy
enough to do so (look in the ompi/mca/dpm/orte/dpm_orte.c code).

MPI implementations generally don't forcibly propagate envars because it is
so hard to know which ones to handle - it is easy to propagate a system
envar that causes bad things to happen on the remote end.

One thing you could do, of course, is add that envar to your default shell
setup (.bashrc or whatever). This would set the variable by default on your
remote locations (assuming you are using rsh/ssh for your launcher), and
then any process you start would get it. However, that won't help if this
is an envar intended only for the comm_spawned process.

I can add this capability to the OMPI trunk, and port it to the 1.7 release
- but we don't go all the way back to the 1.4 series any more.

On Wed, Dec 11, 2013 at 2:10 PM, tom fogal <tfogal_at_[hidden]> wrote:

> Hi all,
>
> I'm developing on Open MPI 1.4.5-ubuntu2 on Ubuntu 13.10 (so, Ubuntu's
> packaged Open MPI) at the moment.
>
> I'd like to pass environment variables to processes started via
> MPI_Comm_spawn. Unfortunately, the MPI 3.0 standard (at least) does
> not seem to specify a way to do this; thus I have been searching for
> implementation-specific ways to accomplish my task.
>
> I have tried setting the environment variable using the POSIX setenv(3)
> call, but it seems that Open MPI comm-spawn'd processes do not inherit
> environment variables. See the attached 2 C99 programs; one prints
> out the environment it receives, and one sets the MEANING_OF_LIFE
> environment variable, spawns the previous 'env printing' program, and
> exits. I run via:
>
> $ env -i HOME=/home/tfogal \
> PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin \
> mpirun -x TJFVAR=testing -n 5 ./mpienv ./envpar
>
> and expect (well, hope) to find the MEANING_OF_LIFE in 'envpar's
> output. I do see TJFVAR, but the MEANING_OF_LIFE sadly does not
> propagate. Perhaps I am asking the wrong question...
>
> I found another MPI implementation which allowed passing such
> information via the MPI_Info argument, however I could find no
> documentation of similar functionality in Open MPI.
>
> Is there a way to accomplish what I'm looking for? I could even be
> convinced to hack source, but a starting pointer would be appreciated.
>
> Thanks,
>
> -tom
>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>