On Sat, 7 Oct 2017, Marcin Błażejowski wrote:
Hi,
simple script:
<hansl>
set verbose off
function void foo (void)
printf "Value from node %d: %d\n", $mpirank, $mpirank+1
mpisend($mpirank+1, 0)
end function
mpi --send-functions
# Call function
foo()
# Collect results
if ($mpirank == 0)
scalar Sum = 0
loop for i=0..$mpisize-1 --quiet
Sum += mpirecv(i)
endloop
printf "\nSum of received values: %d\n", Sum
endif
end mpi
</hansl>
Above code runs on Linux with either OpenMPI or MPICH, but crashes on
Windows with MS-MPI. The error code is: "DEADLOCK: attempting to send a
message to the local process without a prior matching receiv".
The problem is with sending an object (here: scalar) from root proces to
itself. When we give 2 conditions:
1. we call foo() if $mpirank !=0,
2. we receive from all nodes except root,
the code works.
Is an MPI_send() with dest=i matched by MPI_recv() with source=i
a well-defined operation in the MPI spec?
I can look into this, but what you're doing here looks very much
like a case for mpireduce, not send/receive.
Allin