[petsc-users] Out of memory while using /src/src/ksp/example/tutorial/ex45.c

Alan Z. Wei zhenglun.wei at gmail.com
Mon Sep 30 17:40:14 CDT 2013

Dear all,
I hope you're having a nice day.
I came across a memory problem while using ex45.c to solve 3D Poisson
equation. As recommended while using 2D Poisson solver (e.g
/src/src/ksp/example/tutorial/ex29.c), I used the multigrid
preconditioner and the setting is listed here:
mpiexec -np 8 ./ex45 -pc_type mg -ksp_type cg -da_refine 2
-pc_mg_galerkin -ksp_rtol 1.0e-7 -mg_levels_pc_type jacobi
-mg_levels_ksp_type chebyshev
If I apply the same settings to ex45 with np = 32 and it results a 'out
of memory' error. The case has grid size = 801*385*385. Of course, if I
reduced the grid size to very small, it would work well. For the test
case, I tried to play with
1, doubleing the number of process (by using np =64, total avaiable
memory should be aroud 128G)
2, reducing the grid size to half
3, reducing the level of the MG to 1
They do not help at all. What should I output in order to detect the

BTW, the ex45 works well with the same amount of DoF with GAMG and the
following settings however it is slow,
mpiexec -np 32 ./ex45 -pc_type gamg -ksp_type cg -pc_gamg_agg_nsmooths 1
-mg_levels_ksp_max_it 1 -mg_levels_ksp_type richardson -ksp_rtol 1.0e-7.
I understand that MG requires more memory than GAMG; yet, is there any
way I can approximately calculate the memory required?

Thanks in advance,

More information about the petsc-users mailing list