Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Porblem/Bug for GET_ENVIRONMENT_VARIABLE with MPI

$
0
0

Dear Fortran !!

In the following (a hello world kind) program, I try to read the processor's name where images are running.

Each process can read the processor's name with a EXECUTE_COMMAND_LINE("echo $HOSTNAME")

but with GET_ENVIRONMENT_VARIABLE(...), nothing is read (ios /=0)

Note that a single image works well  (mpiexec.hydra -genvuser ./Hello_world_mpi.exe  is Ok)

Executable is made with :

ifort -I/softs/intel/impi/5.0.1.035/intel64/include/ Hello_world_mpi.f90 -o Hello_world_mpi.exe -L/softs/intel/impi/5.0.1.035/intel64/l
ib/ -lmpifort -lmpi

We have ifort 15.0.0 and mpi 5.0 (as shown above)

We use mpiexec.hydra with OAR

Bernard

==========================   source code ==============================

Program WHERE_I_AM
   USE mpi
   USE ISO_FORTRAN_ENV, Only: Output => Output_unit
   Implicit None
   Integer :: nb_procs, rank, code, ios = 1
   Character(Len=20) :: env_name, env_value
   !
   Call MPI_INIT(code)
   Call MPI_COMM_SIZE ( MPI_COMM_WORLD , nb_procs , code )
   Call MPI_COMM_RANK ( MPI_COMM_WORLD , rank , code )
   !
   env_name = "HOSTNAME"
   !
   Call EXECUTE_COMMAND_LINE("echo $"//TRIM(env_name))
   !
   Call GET_ENVIRONMENT_VARIABLE(TRIM(env_name),env_value,status=ios)
   If ( ios /= 0 ) Then
      Write(Output,*) "I am the processor WITHOUT NAME number ", rank, " among ", nb_procs
   Else
      Write(Output,"(A,A,A,I2,A,I2)") "I am the processor with name ", TRIM(env_value), "   with rank ", rank, "  among ", nb_procs
   End If
   !
   call MPI_FINALIZE (code)
   STOP " Done !! "
   !
End Program WHERE_I_AM

=========================== an example of bad output ==================================

Note : Images are running on nodes n024, n024, n044 and n048 (4 nodes=

n044
n024
n044
 I am the processor WITHOUT NAME number           29  among           49
 I am the processor WITHOUT NAME number           37  among           49
 I am the processor WITHOUT NAME number           38  among           49
n048
n048
n048
n048
n048
n048
 I am the processor WITHOUT NAME number           26  among           49
 I am the processor WITHOUT NAME number           30  among           49
 I am the processor WITHOUT NAME number           44  among           49
 I am the processor WITHOUT NAME number           25  among           49
n024
 I am the processor WITHOUT NAME number           48  among           49
 I am the processor WITHOUT NAME number           46  among           49
 I am the processor WITHOUT NAME number           47  among           49
 I am the processor WITHOUT NAME number           45  among           49
n010
 I am the processor WITHOUT NAME number           43  among           49
n024
n024
 I am the processor WITHOUT NAME number           17  among           49
 I am the processor WITHOUT NAME number           18  among           49
 I am the processor WITHOUT NAME number           16  among           49
n024
 I am the processor WITHOUT NAME number           28  among           49
n024
 I am the processor WITHOUT NAME number           35  among           49
n024
 

 


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>