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: Nicolas Deladerriere (nicolas.deladerriere_at_[hidden])
Date: 2009-03-02 04:02:00


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

> 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" .......*

Regards
Nicolas

2009/2/28 Jeff Squyres <jsquyres_at_[hidden]>

> 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.
> Specifically, instead of:
>
> mpirun ... my_mpi_app
>
> you would do
>
> mpirun ... script.sh
>
> and script.sh would be something like Matt mentioned; it constructs the
> GMON_OUT_PREFIX environment variable and then launches my_mpi_app.
>
> Additionally, note that mpirun's -x option *can* set environment variable.
> For example:
>
> -----
> shell$ cat run
> #!/bin/sh
> echo $FOO
> shell$ mpirun -np 1 -x FOO=bar ./run : -np 1 -x FOO=yow ./run
> bar
> yow
> shell$
> -----
>
>
> On Feb 27, 2009, at 2:36 PM, Nicolas Deladerriere wrote:
>
> Matt,
>>
>> Thanks for your solution, but I thought about that and it is not really
>> convenient in my configuration to change the executable on each node.
>> I would like to change only mpirun command.
>>
>>
>>
>> 2009/2/27 Matt Hughes <matt.c.hughes+ompi_at_[hidden]<matt.c.hughes%2Bompi_at_[hidden]>
>> >
>> 2009/2/27 Nicolas Deladerriere <nicolas.deladerriere_at_[hidden]>:
>> > I am looking for a way to set environment variable with different value
>> on
>> > each node before running MPI executable. (not only export the
>> environment
>> > variable !)
>>
>> I typically use a script for things like this. So instead of
>> specifying your executable directly on the mpirun command line,
>> instead specify the script. The script can set the environment
>> variable, then launch your executable.
>>
>> #!/bin/csh
>> setenv GMON_OUT_PREFIX 'gmon.out_'`/bin/uname -n`
>> myexe
>>
>> mpirun -np 2 --bynode --hostfile CLUSTER_NODES myscript
>>
>> I'm not sure if that csh syntax is right, but you get the idea.
>>
>> mch
>> _______________________________________________
>> users mailing list
>> users_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>>
>> _______________________________________________
>> users mailing list
>> users_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>>
>
>
> --
> Jeff Squyres
> Cisco Systems
>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>