Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [OMPI users] Newbie question continues, a step toward real app
From: Gus Correa (gus_at_[hidden])
Date: 2011-01-13 17:40:13


Tena Sakai wrote:
> Hi,
>
> I have a script I call fib.r. It looks like:
>
> #!/usr/bin/env r
>
> fib <- function( n ) {
> a <- 0
> b <- 1
> for ( i in 1:n ) {
> t <- b
> b <- a
> a <- a + t
> }
> a
> }
>
> print( fib(argv[1]) )
>
> When I run this script with a parameter, it generates a fibonocci number:
>
> $ fib.r 5
> 5
> $ fib.r 6
> 8
>
> and if I stick this into <program> part of MIMD example I have used
> previously:
>
> $ mpirun -H vixen -np 1 hostname : --hostfile myhosts -np 8 fib.r 7
>
> I get:
>
> vixen.egcrc.org
> [1] 13
> [1] 13
> [1] 13
> [1] 13
> [1] 13
> [1] 13
> [1] 13
> [1] 13
>
> This is good as proof of concept, but what I really want to do is to
> have that 7
> different for each (slave) process. Ie., I want to run “rfib 5” on node
> 0, “rfib 6”
> on node 1, “rfib 7” on node 2, and so on. Is there any way to give a
> different
> parameter(s) to different process/slot?
>
> I thought maybe I can use –rf option to do this, but I am leaning toward
> –app
> option. Unfortunately, I see no example for the application context
> file. Would
> someone kindly explain how I can do what I describe?
>
> Thank you.
>
> Tena Sakai
> tsakai_at_[hidden]
>

Hi Tena

We ran MPMD/MIMD programs here using in the past.
Coupled climate modes: atmosphere, ocean, sea ice, etc, each one one
executable, communicating via MPI.
Actually this was with MPICH1, somewhat different syntax than OpenMPI,
the flag/file was called '-pgfile' not '-app',
but I see no reason why it shouldn't work in your case with OpenMPI.

I think if you create a 'appfile' with this content:

-H node0 -np 1 rfib 5
-H node0 -np 1 rfib 6
...

and launch mpirun with

mpirun -app appfile

it is likely to work.

Under Torque I cannot test this very easily,
because I need to parse the Torque file that gives me the nodes,
then write down the 'appfile' on the fly (which is what I used to
do for the coupled climate models).

However, I tried on a standalone machine (where the -H nodename didn't
make sense, and was not used) and it worked.
My appfile test was like this:
-np 1 ls appfile
-np 1 hostname
-np 2 date
-np 4 who

You can add your -H nodename to each line.

I hope this helps,
Gus Correa
---------------------------------------------------------------------
Gustavo Correa
Lamont-Doherty Earth Observatory - Columbia University
Palisades, NY, 10964-8000 - USA
---------------------------------------------------------------------