Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] environment variables and MPI_Comm_spawn
From: tom fogal (tfogal_at_[hidden])
Date: 2013-12-11 15:10:36

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.