> 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.
Please tell me how to do this using the internal information.
For now I will use that to write these functions (which might at some
point correspond to standard functions, or not)
my_MPI_Local_size(MPI_Comm comm, int *lmax, int *lactual)
my_MPI_Local_rank(MPI_Comm comm, int *lrank)
These will return N for lmax, a value M in 1->N for lactual, and a value
in 1->M for lrank, for any worker on a machine corresponding to a
hostfile line like:
As usual, this could get complicated. There are probably race
conditions on lactual vs. lrank as the workers start, but I'm guessing
the lrank to lmax relationship won't have that problem. Similarly, the
meaning of "local" is pretty abstract. For now all that is intended is
"a group of equivalent cores within a single enclosure, where
communication between them is strictly internal to the enclosure, and
where all have equivalent access to the local disks and the network
interface(s)". Other ways to define "local" might make more sense on
more complex hardware.
Another function that logically belongs with these is:
my_MPI_Local_list(MPI_Comm comm, int *llist, int *lactual)
I don't need it now, but can imagine applications that would. This
would return the (current) lactual value and the corresponding list of
rank numbers of all the local workers. The array llist must be of size
Manager, Sequence Analysis Facility, Biology Division, Caltech