From: raja@rsn.hp.com (Raja Daoud)
Newsgroups: comp.parallel.mpi
Subject: Re: Environment variables under MPI()?
Date: 22 Aug 1998 18:30:11 -0500
Organization: Hewlett-Packard Co.
Message-Id: <6rnka3$m69@tbag.rsn.hp.com>
References: <35DDC41C.167E@dao.gsfc.nasa.gov>


Jing, let's split the env var issue into two parts:

1- using getenv() for initialization before MPI_Init()

2- doing initialization after MPI_Init()

For #1, the bigger issue is the lack of a standard behavior for code
that precedes MPI_Init().  It could be executed a different # of times
depending on the implementation (typically either 1 or N times, in some
cases N+1 times).  For this reason, users are discouraged from having
meaningful code before MPI_Init().  A safer solution is to map it to
case #2.

For #2, MPI can be used to help in the initialization, broadcasting the
data from some "root" process that can somehow be selected.  Here it's
an issue of which of the functionalities not mandated by the MPI std do
you want to rely on, and have more confidence in its portability:

a- Use the environment of a root process, assume that it is inherited
   from the user's environment.

b- Get the info from the command line, assuming that at least a root
   process gets the correct argc/argv set by MPI_Init().

c- Store the info in a file and assume that it is accessible from a root
   process.

d- Assume that at least a root process can read stdin.

etc.  I would guess that 'b' is the most portable solution.  'c' may be
as portable, but has the added hassle of managing an extra file.  If the
filename isn't hardcoded, then you're passing it via the command line
and assuming 'b' as well, or via the 'a' or 'd' mechanisms.  I think 'd'
is the least portable.

Regards,

--Raja

[plug:  in HP MPI, the user can set optional lists of VAR=VALUE tuples
for the processes (per host/binary/#copies combination) to be visible
before MPI_Init().  Example:

-h host1 -np 16 -e FOO=foo -e BAR=bar  a.out [args....]
-h host2 -np 16 -e FOO=toto -e BAR=lala  b.out [args....]

BTW, HP MPI uses rsh (remsh) to start remote processes.]

-=-
Raja Daoud				Hewlett-Packard Co.
raja@rsn.hp.com				http://www.hp.com/go/mpi

