MPI: getting the number of nodes (not processes) in the communicator

I work with MPI programs on an SMP supercomputer. I would like to determine which processes use the same node, for example, by setting an integer key equal in all processes to the same node and different from node to another. The goal is to use this key to separate the communicator and the presence of sub-communicators that collect only processes in the same node.

So the function will look like

int identify_node(MPI_Comm* comm); // returns a key characterizing a node

Assuming a simple distribution of processes such as 0,1,2,3 on node_1, 4,5,6,7 on node_2, etc., this is a matter of a simple formula, but I would like to achieve the same result without assuming distribution.

I have an idea how to do this using MPI_Get_processor_name: calculating the hash of the name and not assuming that no two names will get the same hash (I don't like this, because if one day I have two names with the same hash, there will be it’s difficult to track down the problem) or use some kind of coordination algorithm between processes (which I don’t know yet).

How would you do it (efficiently, if possible)?

Mathieu

+5
source share
1 answer

You are correct that the distribution assumption would be unreasonable, since reordering the ranks is actually a promising method for increasing productivity due to this regularity.

MPI_Get_processor_name , , , MPI_Gatherv .

, .

+3

All Articles