2

Anyone knows how to get the current host name from a Cray Fortran program? I want basically the output of UNIX gethostname(). After scouring Craydocs pages, I see that the PXF* functions do not seem to contain this information.

Wirawan

dogbane
  • 266,786
  • 75
  • 396
  • 414
Wirawan Purwanto
  • 3,613
  • 3
  • 28
  • 28

3 Answers3

5

Cray Fortran is quite ahead in modern Fortran features. You can call the gethostname() using C interoperability features of Fortran 2003. The name would be null terminated. You can also probably use GET_ENVIRONMENT_VARIABLE intrinsic subroutine from Fortran 2003.

0

Try using PXFGETENV to get the value of the HOSTNAME environment variable.

dogbane
  • 266,786
  • 75
  • 396
  • 414
  • 1
    This is what I implemented in the mean time. But that var depends on BASH shell environment, IIRC. If you use csh or (worse yet) archaic SH, is HOSTNAME set? In minimal environment like CLE (Cray Linux Environment) of Cray XT/XE/XK systems, is HOSTNAME set properly? – Wirawan Purwanto Nov 16 '12 at 16:04
0

Since all Cray machines have MPI, you can use MPI_Get_processor_name from any dialect of Fortran.

Jeff Hammond
  • 5,374
  • 3
  • 28
  • 45