The answer is yes - sort of...
In OpenMPI, every process has information about not only its own local rank, but the local rank of all its peers regardless of what node they are on. We use that info internally for a variety of things.
Now the "sort of". That info isn't exposed via an MPI API at this time. If that doesn't matter, then I can tell you how to get it - it's pretty trivial to do.
On Dec 9, 2010, at 6:14 PM, David Mathog wrote:
> 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
> users mailing list