New changes for CG set type in 2.3.1-p7 ?
Satish Balay
balay at mcs.anl.gov
Thu Feb 23 16:10:31 CST 2006
Sorry - the test code had SetFromOptions after KSPCGSetType()
Satish
---
call KSPCreate(PETSC_COMM_WORLD,ksp,ierr)
call KSPSetType(ksp,KSPCG,ierr)
call KSPCGSetType(ksp,KSP_CG_SYMMETRIC,ierr)
call KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN,ierr)
call KSPSetFromOptions(ksp,ierr)
call KSPSolve(ksp,b,x,ierr)
On Thu, 23 Feb 2006, Barry Smith wrote:
>
> What about calling SetFromOptions after the call to KSPCGSetType()?
>
> Thanks
> Barry
>
>
> On Thu, 23 Feb 2006, Satish Balay wrote:
>
> >
> > I just tried the following [with both c & fortran examples
> > ksp/examples/tutorials/ex2.c, ex2f.F] And I get the expected behavior.
> >
> > Maybe KSPSetType() was not called before KSPCGSetType()?
> >
> > Satish
> >
> > --------
> >
> > > > >
> > call KSPCreate(PETSC_COMM_WORLD,ksp,ierr)
> > call KSPSetType(ksp,KSPCG,ierr)
> > call KSPCGSetType(ksp,KSP_CG_SYMMETRIC,ierr)
> > call KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN,ierr)
> > > > >
> >
> > asterix:/home/balay/spetsc/src/ksp/ksp/examples/tutorials>./ex2f -ksp_view
> > KSP Object:
> > type: cg
> > CG or CGNE: variant SYMMETRIC
> > maximum iterations=10000, initial guess is zero
> > tolerances: relative=1e-05, absolute=1e-50, divergence=10000
> > left preconditioning
> > PC Object:
> > type: ilu
> > ILU: 0 levels of fill
> > ILU: max fill ratio allocated 1
> > ILU: tolerance for zero pivot 1e-12
> > out-of-place factorization
> > matrix ordering: natural
> > Factored matrix follows
> > Matrix Object:
> > type=aij, rows=9, cols=9
> > total: nonzeros=33, allocated nonzeros=45
> > not using I-node routines
> > linear system matrix = precond matrix:
> > Matrix Object:
> > type=aij, rows=9, cols=9
> > total: nonzeros=33, allocated nonzeros=45
> > not using I-node routines
> > Norm of error 0.1215E-05 iterations 4
> > asterix:/home/balay/spetsc/src/ksp/ksp/examples/tutorials>
> >
> >
> > On Thu, 23 Feb 2006, Barry Smith wrote:
> >
> > >
> > > Satish,
> > >
> > > Can you please check this? We should be able to
> > > call KSPCGSetType() either before or afterwards. It could
> > > be that KSPSetFromOptions_CG() wrongly resets to the default
> > > value. I looked at the code and didn't see any wrong logic.
> > > Probably it may be easiest to just run in the debugger and
> > > check if it wrongly reset.
> > >
> > > Thanks
> > >
> > > Barry
> > >
> > >
> > > On Thu, 23 Feb 2006, abdul-rahman at tu-harburg.de wrote:
> > >
> > > >
> > > >
> > > > On Wed, 22 Feb 2006, Satish Balay wrote:
> > > >
> > > > I know where I did wrong now: the call below:
> > > >
> > > > > > > > call KSPCGSetType( ksp, KSP_CG_SYMMETRIC, ierr )
> > > >
> > > > should have come _after_:
> > > >
> > > > call KSPSetFromOptions(ksp,ierr)
> > > >
> > > > Otherwise it just goes with the default Hermitian even if I don't set
> > > > the
> > > > switch to Hermitian.
> > > >
> > > >
> > > > > You should be able to verify if the correct type is used with
> > > > > '-ksp_view' option.
> > > > >
> > > > > Satish
> > > > >
> > > >
> > > > Thank you again
> > > >
> > > >
> > > > Razi
> > > >
> > > >
> > >
> > >
> >
> >
>
>
More information about the petsc-users
mailing list