[mpich-discuss] best/fastest way to get a node communicator

Jim Dinan dinan at mcs.anl.gov
Tue Jan 17 13:58:25 CST 2012


Jeff,

AFAIK, this is how it's done right now.  You could look into
MPI_Get_processor_name() as a more portable alternative to gethostname().

 ~Jim.

On 01/17/2012 01:24 PM, Jeff Hammond wrote:
> I'm interested in being able to create a communicator for each node.
> I have custom APIs for this on Blue Gene and Cray, but that doesn't
> help on clusters.
> 
> I was thinking of doing the following:
> - call gethostname on each rank
> - gather these values to root
> - sort the array and assign a different color number for each unique
> value in a new array
> - scatter the color array and call comm_split
> 
> Does anyone know of a better/faster way to do this?  I assume that the
> sort is rarely necessary, i.e. the ranks are ordered by node already,
> but I don't want to assume this.
> 
> Are there settings where gethostname is not specific enough to
> distinguish nodes?
> 
> Thanks,
> 
> Jeff
> 



More information about the mpich-discuss mailing list