Thomas Jahns <ja...@dkrz.de> writes: > just a side-note: the correct way to query the hostname is in this > thread on stackoverflow and various Unix/POSIX/Linux books in C: > > <http://stackoverflow.com/questions/504810/how-do-i-find-the-current-machines-full-hostname-in-c-hostname-and-domain-info> > > I'd suggest you wrap that in Fortran's ISO C bindings and use that > instead of some fragile environment variable that requires an > environment variable to be set up. The process is still not entirely > robust because you might end up on a non-RFC-compliant system where > name lookup doesn't work.
I doubt it's relevant to the original post, but why is anything more correct than using the MPI call provided for doing that? At least in OMPI, it uses gethostname; that's probably what your batch system does, and you probably to be consistent with it on multi-homed systems.