Dear all:
I'm using mpi_iprobe to serve as a way to send signals
between different mpi executables. I'm using the following test codes
(fortran):
#1
program send
implicit none
include
'mpif.h'
real*8 :: vec(20000)=1.0
integer :: ierr,i=0,request(1)
call mpi_init(ierr)
do
call
mpi_isend(vec,20000,mpi_real8,
0,1,mpi_comm_world,request(1),ierr)
i=i+1
print *,i
vec=-vec
call usleep_fortran(2.d0)
call
mpi_wait(request(1),MPI_STATUS_IGNORE,ierr)
end do
end
program send
--------------------------------------------------
#2
program send
implicit none
include 'mpif.h'
real*8
:: vec(20000)
integer :: ierr
call mpi_init(ierr)
do
if(key_present()) then
call mpi_recv(vec,20000,mpi_real8,1,1,mpi_comm_world,MPI_STATUS_IGNORE,ierr)
end if
call usleep_fortran(0.05d0)
end do
contains
function key_present()
implicit none
logical :: key_present
key_present = .false.
call mpi_iprobe(1,1,mpi_comm_world,key_present,MPI_STATUS_IGNORE,ierr)
print *, key_present
end function key_present
end program
send
-----------------------------------
The usleep_fortran
is a routine I've written to pause the program for that amount of time
(in seconds). As you can see, on the receiving end I'm probing to see
whether the message has being received every 0.05 seconds, where each
probing would result a print of the probing result; while the sending is
once every 2 seconds.
Doing
mpirun -np 1 recv : -np 1 send
Naturally I expect the
output to be something like:
1
(fourty or so F)
T
2
(another
fourty or so F)
T
3
however this is the output I get:
1
(fourty or so F)
T
2
(about a two second delay)
T
3
It
seems to me that after the first set of probes, once the message was
received, the non-blocking mpi probe becomes blocking for some strange
reason. I'm using mpi_iprobe for the first time, so I'm not sure if I'm
doing something blatantly wrong.
--
David Zhang
University of California, San Diego