fortran90 - Fortran 90 and MPI error -


i writing small program understand mpi (mpich implementation) , fortran 90. unfortunately code not running when executed "-np 2".

this code:

program main     use mpi     implicit none      integer :: ierr, npe, mynpe     integer :: istatus(mpi_status_size)     real :: aa      call mpi_init(ierr)     call mpi_comm_size(mpi_comm_world, npe, ierr)     call mpi_comm_rank(mpi_comm_world, mynpe, ierr)      if (mynpe == 0)         read(*,*) aa         call  mpi_send(aa, 1, mpi_real, 1, 99, mpi_comm_world, ierr)     else if (mynpe == 1)         call mpi_recv(aa, 1, mpi_real, 0, 99, mpi_comm_world, istatus, ierr)         write(*,*) "ho ricevuto il numero ", aa     end if      call mpi_finalize(ierr) end program 

i compiling mpif90 mpi_2.f90 -o output , when execute mpirun -np 2 output following error:

at line 14 of file mpi_2.f90 (unit = 5, file = 'stdin') fortran runtime error: end of file 

the shell still waits input , if insert number (e.g. 11) following output:

11 fatal error in mpi_send: invalid rank, error stack: mpi_send(173): mpi_send(buf=0xbff4783c, count=1, mpi_real, dest=1, tag=99, mpi_comm_world) failed mpi_send(98).: invalid rank has value 1 must nonnegative , less 1 -------------------------------------------------------------------------- mpirun noticed job aborted, has no info process caused situation. -------------------------------------------------------------------------- 

thank help!

two different mpi implementations mixed in case. run-time mpi environment comes different implementation 1 used compile program , therefore both processes behave mpi singletons, i.e. each of them forms separate mpi_comm_world communicator , becomes rank 0 in it. result first branch of conditional executes in both processes. on other side mpirun performs input redirection first process while other standard input closed or connected /dev/null. mpi_send fails same reason - in singleton universe of each mpi process there no rank 1.

the frequent cause such behaviour mpirun , mpif90 come different mpi libraries. in case have mpich mixed open mpi. indeed, following error message:

mpi_send(173): mpi_send(buf=0xbff4783c, count=1, mpi_real, dest=1, tag=99, mpi_comm_world) failed mpi_send(98).: invalid rank has value 1 must nonnegative , less 1 

is in error format of mpich. therefore mpif90 comes mpich.

but next error message:

-------------------------------------------------------------------------- mpirun noticed job aborted, has no info process caused situation. -------------------------------------------------------------------------- 

is in error format used openrte framework of open mpi. therefore mpirun comes open mpi , not mpich.

this happen if have installed development package mpich, provides mpicc, mpif90, , on, you've installed run-time package open mpi. make sure have packages 1 kind of mpi installed. if have compiled mpich source, make sure path binaries first element of $path.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -