#1162: Slowdown due to gethostbyname ---------------------+------------------------------------------------------ Reporter: hinder | Owner: Type: defect | Status: new Priority: minor | Milestone: Component: Cactus | Version: Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by eschnett):
Util_GetHostName is called by Formaline, and by Carpet's I/O routines. The latter call it for every file.
Yes, caching its output (in Util_GetHostName) would make sense.
An alternative would be to use MPI_Get_processor_name, if MPI is available. In fact, Carpet itself does not call Util_GetHostName any more because this may have led to crashes, possibly related to calling fork().
Upon startup, Carpet determines the host names of all nodes, to see which MPI processes share a node. This is stored in a mapping (see file Hosts.cc); we could add a routine to return the current MPI processe's host name.