[petsc-users] Growing memory use with VecGhostUpdate

Jed Brown jed at jedbrown.org
Tue Dec 26 11:33:18 CST 2017


PETSc isn't calling MPI_Alloc_mem.  You should run with valgrind
--tool=massif or use a debugger and set a breakpoint on malloc (or
possibly other allocation functions) inside that loop.  If you don't
want to debug it, use a different MPI.

Praveen C <cpraveen at gmail.com> writes:

> I did this
>
>    do i=1,10000000
>    call VecGhostUpdateBegin(p%v_u, INSERT_VALUES, SCATTER_FORWARD, &
>                             ierr); CHKERRQ(ierr)
>    call VecGhostUpdateEnd  (p%v_u, INSERT_VALUES, SCATTER_FORWARD, &
>                             ierr); CHKERRQ(ierr)
>    call PetscMallocGetCurrentUsage(space, ierr); CHKERRQ(ierr)
>    if(rank==0) print*,space
>    enddo
>
> and the value printed is zero, so this means the problem must come from mpi. Since I am not directly using MPI, what should I look for with valgrind and how will that help to solve this ?
>
> There is a recent issue related to memory leak
>
> https://github.com/open-mpi/ompi/issues/4567 <https://github.com/open-mpi/ompi/issues/4567>
>
> Thank you
> praveen
>
>> On 26-Dec-2017, at 7:33 PM, Jed Brown <jed at jedbrown.org> wrote:
>> 
>> First check PetscMallocGetCurrentUsage() in the loop to confirm that
>> there is no leak of PetscMalloc()'ed memory.  That would mean the leak
>> comes from elsewhere, maybe MPI.
>> 
>> Then get a stack trace for the leaking memory (e.g., using valgrind
>> --tool=massif or a debugger)?


More information about the petsc-users mailing list