On Sat, 7 Oct 2017, Allin Cottrell wrote:
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".
After some reading on this topic it seems you just got lucky with
OpenMPI on Linux, and in general this is something you are not
supposed to do in MPI (send/receive with the same process as
destination and source). Anyway it's pointless, just cluttering the
message space.
https://stackoverflow.com/questions/20132570/mpi-can-not-send-data-to-one...
Allin