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 \
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.