Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] defining different values for same environment variable
From: Josh Hursey (jjhursey_at_[hidden])
Date: 2009-03-02 09:01:19

On Mar 2, 2009, at 8:41 AM, Jeff Squyres wrote:

> On Mar 2, 2009, at 4:02 AM, Nicolas Deladerriere wrote:
>> > I think you missed Matt's point -- he was suggesting writing a
>> single script that just reacts accordingly to which host it is on
>> and sets > the environment variable before launching your back-end
>> MPI executable.
>> I got it, but I would like to be able to do it without creating/
>> copying new script on all nodes.
> Don't you already need to make your MPI executable available on all
> nodes?
> You could also use OMPI's "filem" mechanism to copy the script out
> to all nodes. I actually never remember the details on this; Josh
> -- can you fill in here?

You can distribute the binary target of mpirun to all nodes using the
--preload-binary option to mpirun:
   shell$ mpirun --preload-binary my-script

You can also distribute other files and directories using the --
preload-files option to mpirun:
   shell$ mpirun --preload-files=foo.txt,../bar.txt,/home/fred/mydir

Note that this feature is available on the Open MPI trunk, and in the
upcoming v1.3.1 (there was a bug in the v1.3.0 release that prevented
it from working correctly).

The documentation on this feature is lacking, I'll file a ticket to
remind me to write a FAQ on this option.

-- Josh

>> > Additionally, note that mpirun's -x option *can* set environment
>> variable.
>> yes but with the following syntax, the $HOST environment variable
>> is interpretated on all first node (where mpirun command is
>> launched) and then exported to all other nodes.
>> mpirun -np 2 -x FOO="yow_$HOST"
>> Is there another syntax to use ?
>> I could then use similar syntax than your previous example, but it
>> is not really conveniant for 128 nodes ! :
>> mpirun -np 1 -x FOO="yow_n001" : -np 1 -x FOO="yow_n002" .......
> You can do a similar syntax in a file -- instead of using :'s to
> delimit the stanzas, you put each stanza on a separate line.
> --
> Jeff Squyres
> Cisco Systems
> _______________________________________________
> users mailing list
> users_at_[hidden]