[petsc-users] How to measure the memory usage of the application built on the Petsc?

Jed Brown jedbrown at mcs.anl.gov
Wed May 29 08:08:52 CDT 2013


Fande Kong <fande.kong at colorado.edu> writes:

> Last, I got:
>
>
> 5279056 bytes MatLUFactorSymbolic_SeqAIJ() line 380 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aijfact.c
> 5279040 bytes MatLUFactorSymbolic_SeqAIJ() line 392 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aijfact.c
> 2592848 bytes MatSeqAIJSetPreallocation_SeqAIJ() line 3439 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aij.c
> 2592848 bytes MatSeqAIJSetPreallocation_SeqAIJ() line 3439 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aij.c
> 1167392 bytes MatSeqAIJSetPreallocation_SeqAIJ() line 3439 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aij.c
> 1167392 bytes MatSeqAIJSetPreallocation_SeqAIJ() line 3439 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aij.c
> 651264 bytes MatSeqAIJSetPreallocation_SeqAIJ() line 3439 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aij.c
> 651264 bytes MatSeqAIJSetPreallocation_SeqAIJ() line 3439 in
> /home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aij.c

Fine-grid matrix, interpolation, coarse grid matrix, and LU factors for
coarse grid matrix.  Each of these has two large allocations when
running in debug mode:

    ierr    = PetscMalloc3(nz,PetscScalar,&b->a,nz,PetscInt,&b->j,B->rmap->n+1,PetscInt,&b->i);CHKERRQ(ierr);

In optimized mode (which you should *always* use when measuring
performance), PetscMalloc3 is implemented with only one malloc.

Add '-malloc' to get a tracing malloc when running with an optimized
build of PETSc.


More information about the petsc-users mailing list