[petsc-users] Growing memory use with VecGhostUpdate

Jed Brown jed at jedbrown.org
Tue Dec 26 08:03:59 CST 2017


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)?

Praveen C <cpraveen at gmail.com> writes:

> Dear all
>
> I have a fortran CFD code, 3d, unstructured grid.
>
> I run the following code
>
>    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)
>    enddo
>
> and monitor memory usage using “top”. I find that the memory used by the processes increases continuously.
>
> The vector p%v_u was created like this
>
>       call VecCreateGhostBlockWithArray(PETSC_COMM_WORLD, nvar, nvar*g%nvl, &
>                                         PETSC_DECIDE, g%nvg, g%vghost, &
>                                         s%u(1,1), p%v_u, ierr); CHKERRQ(ierr)
>
> where I use a preallocated array s%u(nvar, g%nvl + g%nvg).
>
> I have observed this memory issue on Linux with Petsc 3.8.3 and Openmpi 3.0.0, gcc-7.2.1, gfortran-7.2.1
>
> On my macbook using clang and gfortran, I do not see this growing memory issue.
>
> Can you suggest some way to debug this problem ?
>
> Thank you
> praveen


More information about the petsc-users mailing list