Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] Method for worker to determine its "rank" on a single machine?
From: David Mathog (mathog_at_[hidden])
Date: 2010-12-09 20:14:01

Is it possible through MPI for a worker to determine:

  1. how many MPI processes are running on the local machine
  2. within that set its own "local rank"


For instance, a quad core with 4 processes might be hosting ranks 10,
14, 15, 20, in which case the "local ranks" would be 1,2,3,4. The idea
being to use this information so that a program could selectively access
different local resources. Simple example: on this 4 worker machine
reside telephone directories for Los Angeles, San Diego, San Jose, and
Sacramento. Each worker is to open one database and search it when the
master sends a request. With the "local rank" number this would be as
easy as naming the databases file1, file2, file3, and file4. Without it
the 4 processes would have to communicate with each other somehow to
sort out which is to use which database. And that could get ugly fast,
especially if they don't all start at the same time.


David Mathog
Manager, Sequence Analysis Facility, Biology Division, Caltech