LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2003-07-09 06:41:41


On Wed, 9 Jul 2003, Maiko Wessel wrote:

> I try to access environment virables under Linux in a function with
> getenv. When i start a standalone program i get the value, but when i do
> the call in a MPI programm i get only NULL.

Check out the mpirun(1) man page; it talks about the environment of MPI
programs in detail.

Short version:

1. Processes initiated by mpirun always inherit the environment from their
LAM daemon. On the origin node (i.e., where you executed lamboot), the
LAM daemon will likely inherit the environment from the shell where you
invoked lamboot. On remote nodes, it depends on the boot SSI module that
you used; if you're using the rsh boot module (for example), the remote
LAM daemons will have an environment that is dictated by your "dot"
files (e.g., $HOME/.bashrc and so on).

2. mpirun automatically exports all variables that begin with "LAM_MPI_".
So if you set an environment variable such as LAM_MPI_foo before invoking
mpirun, it will automatically be propogated out to all MPI processes by
mpirun.

3. You can manually export certain environment variables with the -x
switch to mpirun.

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/