LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Brian Barrett (brbarret_at_[hidden])
Date: 2007-03-06 00:13:31


On Mar 1, 2007, at 9:26 AM, Peter Kjellstrom wrote:

> On Thursday 01 March 2007, Milind Dumbare wrote:
>> Sorry, for this newbie question.
>>
>> Hi I have written an application which prints usage if incorrect
>> command
>> line is given. It meant to be working on 3 nodes 1 master and 2
>> slaves.
>> But when I run it with "mpirun -np 3 <utility_name>" and incorrect
>> commands it displays three usage messages obviously due to 3
>> processes
>> running.
>>
>> What could be the best way to solve this problem?
>
> if (rank == 0) {
> printf("...

Peter's suggestion is correct, but with the note that there's no way
to get the rank of a given process before calling MPI_INIT. Of
course, you really shouldn't be looking at argv/argc until after you
pass them through MPI_INIT, so the restriction on when you can call
MPI_COMM_RANK should not be a problem for options parsing.

Brian

-- 
   Brian Barrett
   LAM/MPI developer and all around nice guy
   Have a LAM/MPI day: http://www.lam-mpi.org/