MPI_REDUCE causes a memory leak

I recently encountered dam behavior. If I run the following code on my machine (using the latest version of cygwin, Open MPI version 1.8.6), I get a ramp up memory usage that quickly overloads my computer.

program memoryTest

use mpi

implicit none

integer            :: ierror,errorStatus      ! error codes
integer            :: my_rank                 ! rank of process
integer            :: p                       ! number of processes
integer            :: i,a,b

call MPI_Init(ierror)
call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierror)
call MPI_Comm_size(MPI_COMM_WORLD, p, ierror)

b=0
do i=1,10000000
    a=1*my_rank
    call MPI_REDUCE(a,b,1,MPI_INTEGER,MPI_MAX,0,MPI_COMM_WORLD,errorStatus)
end do

call MPI_Finalize(ierror)

stop
end program memoryTest

Any idea what could be the problem? The code looks great for my newbies. Compilation line

mpif90 -O2 -o memoryTest.exe memoryTest.f90
+4
source share
2 answers

This has been discussed in a related topic here .

, , . , root , . MPI_BARRIER MPI_REDUCE, .

MPI : " ( ) , . . . () (.  3,7 ). , . , ( ). , , . , , ".

+3

macelee: MPICH / MPICH, . , valgrind

==12866== HEAP SUMMARY:
==12866==     in use at exit: 0 bytes in 0 blocks
==12866==   total heap usage: 20,001,601 allocs, 20,000,496 frees, 3,369,410,210 bytes allocated
==12866== 
==12866== All heap blocks were freed -- no leaks are possible
==12866== 
+1

Source: https://habr.com/ru/post/1616192/


All Articles