[petsc-users] Questions about memory usage in Petsc
Barry Smith
bsmith at petsc.dev
Wed Dec 3 15:18:45 CST 2025
Unix/Linux has never had a good API for tracking process memory usage. PetscMemoryGetCurrentUsage() gets what it can from the OS, but the exact number should not be considered a true measure of process memory usage at that point in time. Jumps up and down are not accurate measures of changes in memory usage.
PetscMallocGetCurrentUsage() and the number from MUMPS are (assuming no bugs in our code and MUMPS counting space) accurate values of memory usage. You should use these to see how memory usage is scaling with your problem size.
Barry
> On Dec 3, 2025, at 4:00 PM, neil liu <liufield at gmail.com> wrote:
>
> Dear users and developers,
>
> I am recently running a large system from Nedelec element, 14 million dofs (complex number).
> A little confused about the memory there. Then I tried a small system (34,000 dofs) to see the memory usage. It was solved with MUMPS with 1 rank.
> Then I used PetscMemoryGetCurrentUsage() to show the memory used there.
> The pseudocode is
> PetscMemoryGetCurrentUsage (Memory 1: 64.237M)
> KSPset
> KSPsolve (INFOG(18) (size of all MUMPS internal data allocated during factorization: value on the most memory consuming processor): Memory 2: 408 MB)
> PetscMemoryGetCurrentUsage (Memory 3: 54.307M)
>
> [0] Maximum memory PetscMalloc()ed 49.45MB maximum size of entire process 424MB (Memory 4: 54.307M)
> The following is my understanding, please correct me if I am wrong,
> It seems the difference between Memory 1 and 3 is approximately the size of 30 Krylov vectors (complex).
> It seems Memory 4 is not the summation of Memory 2 and 3; but on the same order of magnitude. It is a little confusing here.
>
> Thanks,
> Xiaodong
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20251203/6d8b2d73/attachment.html>
More information about the petsc-users
mailing list