Ick - I agree that's portable, but truly ugly.

Would it make sense to implement this as an MPI extension, and then perhaps propose something to the Forum for this purpose?

Just hate to see such a complex, time-consuming method when the info is already available on every process.

On Dec 10, 2010, at 3:36 AM, Terry Dontje wrote:

A more portable way of doing what you want below is to gather each processes processor_name given by MPI_Get_processor_name, have the root who gets this data assign unique numbers to each name and then scatter that info to the processes and have them use that as the color to a MPI_Comm_split call.  Once you've done that you can do a MPI_Comm_size to find how many are on the node and be able to send to all the other processes on that node using the new communicator. 

Good luck,

On 12/09/2010 08:18 PM, Ralph Castain wrote:
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
users mailing list

<Mail Attachment.gif>
Terry D. Dontje | Principal Software Engineer
Developer Tools Engineering | +1.781.442.2631
Oracle - Performance Technologies
95 Network Drive, Burlington, MA 01803
Email terry.dontje@oracle.com

users mailing list