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

Fande Kong fande.kong at colorado.edu
Thu May 30 01:10:55 CDT 2013


Thanks Jed,

I understood what you said. If I switch to use another run script which is
used to set up two-level preconditioner, I have another question.

Without changing the source code, I used the following script:

  mpirun -n 1 ./ex29  -ksp_type fgmres -pc_type mg -pc_mg_levels 2
-pc_mg_cycle_type v -pc_mg_type multiplicative -mg_levels_1_ksp_type
richardson -mg_levels_1_ksp_max_it 1 -mg_levels_1_pc_type asm
-mg_levels_1_sub_ksp_type preonly -mg_levels_1_sub_pc_type ilu
-mg_levels_1_sub_pc_factor_levels 2
-mg_levels_1_sub_pc_factor_mat_ordering_type rcm -mg_coarse_ksp_type gmres
-mg_coarse_ksp_rtol 0.1  -mg_coarse_ksp_max_it 10 -mg_coarse_pc_type asm
-mg_coarse_sub_ksp_type preonly -mg_coarse_sub_pc_type ilu
-mg_coarse_sub_pc_factor_levels 2
-mg_coarse_sub_pc_factor_mat_ordering_type rcm -ksp_view  -pc_mg_log
-da_refine 1 -log_summary >printresult

then I got:

4653296 bytes MatILUFactorSymbolic_SeqAIJ() line 1867 in
/home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aijfact.c
4653296 bytes MatILUFactorSymbolic_SeqAIJ() line 1840 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
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
1165376 bytes MatILUFactorSymbolic_SeqAIJ() line 1840 in
/home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aijfact.c
1165360 bytes MatILUFactorSymbolic_SeqAIJ() line 1867 in
/home/fdkong/math/petsc-3.3-p7/src/mat/impls/aij/seq/aijfact.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
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
520208 bytes VecScatterCreate() line 1008 in
/home/fdkong/math/petsc-3.3-p7/src/vec/vec/utils/vscat.c
520208 bytes VecCreate_Seq() line 40 in
/home/fdkong/math/petsc-3.3-p7/src/vec/vec/impls/seq/bvec3.c
520208 bytes VecCreate_Seq() line 40 in
/home/fdkong/math/petsc-3.3-p7/src/vec/vec/impls/seq/bvec3.c
520208 bytes VecCreate_Seq() line 40 in
/home/fdkong/math/petsc-3.3-p7/src/vec/vec/impls/seq/bvec3.c


In this case, we have four MatSeqAIJSetPreallocations ( for fine matrix and
coarse matrix respectively) rather than two. I want to set up
preconditioner from options. Are there some things wrong for the script?


On Wed, May 29, 2013 at 7:08 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> 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.
>
>


-- 
Fande Kong
Department of Computer Science
University of Colorado at Boulder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130530/98e7bd29/attachment.html>


More information about the petsc-users mailing list