I am trying to make an implementation using MPI and Fortran that separates processes wich are on the same node to groups. Does MPI have a routine that can identify that?
I had the idea of separating these processes by their hostnames, that are the same on the nodes of the machine I am using. But I don't know if it is general for all clusters.
You probably want to check out MPI_COMM_SPLIT_TYPE. It will allow you to split an existing communicator based on the split_type
you pass in as a parameter:
int MPI_Comm_split_type(MPI_Comm comm, int split_type, int key,
MPI_Info info, MPI_Comm *newcomm)
Right now, the only split_type is MPI_COMM_TYPE_SHARED
, defined in the standard as:
This type splits the communicator into subcommunicators, each of which can create a shared memory region.
This is usually the same thing as what you're asking, but you'll have to double check that it's true on your machine.
The other thing you need to know is that this is a new function in MPI-3 so it might not be available in all implementations of MPI. I know that it's available for MPICH and it's derivatives. AFAIK, it's not available in the last release of Open MPI. So make sure you have a version of MPI that actually supports it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With