[petsc-users] Multiple solves with PCMG fail

Mark Adams mfadams at lbl.gov
Tue Oct 21 17:29:03 CDT 2014


Humm,  GAMG works fine form (like you said), but with MG (with or without
Galerkin) on 1 or 4 procs I get:

[0]PETSC ERROR: KSPComputeEigenvalues() line 119 in
/Users/markadams/Codes/petsc/src/ksp/ksp/interface/itfunc.c Null Pointer:
Parameter # 3

Can you tell me exactly what you get with:

./test1 -pc_type mg

I get:

[0]PETSC ERROR: KSPComputeEigenvalues() line 119 in
/Users/markadams/Codes/petsc/src/ksp/ksp/interface/itfunc.c Null Pointer:
Parameter # 3
[0]PETSC ERROR: PETSC: Attaching /usr/bin/gdb to ./test1 of pid 50433 on
display /tmp/launch-ikNsM1/org.macosforge.xquartz:0 on machine
Macintosh-6.local

And, it seems that the RHS is all zeros on one processor.

I am using a debug build.  Try to do the same.




On Tue, Oct 21, 2014 at 2:50 AM, Filippo Leonardi <
filippo.leonardi at sam.math.ethz.ch> wrote:

> Here,
>
> run this e.g. with
> mpirun -np 4 ./test1 -draw_pause -1 -pc_type mg -pc_mg_galerkin
>
> In Debug mode it crashes, in standard mode it fails. Using Petsc current.
>
> Run without mg and works!
>
> Hope it's not me being stupid and doing something terribly wrong!
>
> Best,
> Filippo
>
> On Monday 20 October 2014 07:29:04 Barry Smith wrote:
> >   Can you send us the code: to petsc-maint at mcs.anl.gov or
> > petsc-users at mcs.anl.gov ? Or something that reproduces the problem?
> >
> >   Barry
> >
> > > On Oct 20, 2014, at 3:31 AM, Filippo Leonardi
> > > <filippo.leonardi at sam.math.ethz.ch> wrote:
> > >
> > > Hi,
> > >
> > > I have a very specific problem that I cannot figure out with PCMG and
> > > multiple solves. I got a linear system that I solve many times, with
> same
> > > matrix but different RHS. I can successfully solve the system with
> > > standard techniques, such as default solver or LU or PCGAMG. Even MG
> > > works if I destroy the ksp each time or I recompute the matrices at
> each
> > > time. But when I try and go to MG and not recomputing the matrices each
> > > time the solver fails. Any idea?
> > >
> > > Here some detail: the setup:
> > > ierr = KSPSetDMActive(ksp, PETSC_FALSE); CHKERRQ(ierr);
> > > ierr = KSPSetDM(ksp,  da); CHKERRQ(ierr);
> > > ierr = KSPSetComputeOperators(ksp, ComputeMatrix, ctx); CHKERRQ(ierr);
> > > ierr = KSPSetComputeRHS(ksp, ComputeRHS, ctx); CHKERRQ(ierr);
> > > ierr = KSPSetFromOptions(ksp); CHKERRQ(ierr);
> > >
> > > Then I solve as usual, for a large number of time steps:
> > > ierr = KSPSolve(ksp, NULL, NULL); CHKERRQ(ierr);
> > > ierr = KSPGetSolution(ksp, &phi);
> > >
> > > The solver converges and does that in a reasonable number of
> iterations:
> > > Linear solve converged due to CONVERGED_RTOL iterations 7
> > > And ksp_view and ksp_monitor do not show any weird stuff.
> > >
> > > - Weirdly enough using any solver (for instance cg+bjacobi or gamg)
> > > everything works (So the matrix and RHS are working fine).
> > > - But the problem persists with Galerkin matrices (-pc_mg_galerkin)
> (So is
> > > not a ComputeMatrix problem).
> > > - If I do:
> > > ierr = KSPSetComputeOperators(ksp, ComputeMatrix, this); CHKERRQ(ierr);
> > > between each solve or destroy the ksp entirely each time the solution
> is
> > > also perfect (So is not a boundary scaling or other stuff problem).
> > > - If I run MG with only 2 levels (so just coarse) I also get a fine
> > > result.
> > >
> > > Setup RHS is called each time as expected, setup matrix is called just
> > > once, also as expected.
> > >
> > > The only thing I can think is that MG does not update some value that
> > > actually needs to be recomputed.
> > >
> > > Any idea?
> > >
> > > The solution is not that different from:
> > >
> http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/
> > > ex29.c.html
> > >
> > > Best,
> > > Filippo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141021/cf0ca044/attachment.html>


More information about the petsc-users mailing list