← Back to team overview

dolfin team mailing list archive

Re: Preconditioner interface

 

On Tue, 2006-07-04 at 11:24 +0200, Anders Logg wrote:
> On Tue, Jul 04, 2006 at 09:12:48AM +0200, Anders Logg wrote:
> > I'm wondering about how to specify the interface for uBlas
> > preconditioners. I think the natural would be
> > 
> >     void solve(DenseVector& x, const DenseVector& b);
> > 
> > but it seems that the Krylov solver prefers an in-place
> > 
> >     void solve(DenseVector& x);
> > 
> > where x = b before the call.
> > 
> > I think we need to have just one interface. There are two
> > options. Either we force the solve(x, b) interface, which I think
> > we can do without sacrificing performance, or we force the solve(x)
> > interface, which might not be natural for all types of
> > preconditioners.
> > 
> > A Jacobi preconditioner would need to store a separate vector and make
> > an additional copy which seems unnessary.
> > 
> > /Anders
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
> 
> I have modified the uBlas preconditioning interface and moved the ILU
> preconditioner to a separate class. Here are the timings for the
> benchmark, before and after the change:
> 
> Before change
> -------------
> 
> Solving linear system of size 38809 x 38809 (Krylov solver).
> Krylov solver (gmres, ilu) converged in 2851 iterations.
> norm(x) 12.2
> PETSc Krylov solve time = 33.2
> uBlas assembly time = 0.29
> Solving linear system of size 38809 x 38809 (uBlas Krylov solver).
> Krylov solver converged in 2771 iterations.
> norm(x) 12.2
> uBlas Krylov solve time = 26.7
> Factor ( < 1 mean uBlas is faster ) 0.805
> 
> After change
> ------------
> 
> Solving linear system of size 38809 x 38809 (Krylov solver).
> Krylov solver (gmres, ilu) converged in 2851 iterations.
> norm(x) 12.2
> PETSc Krylov solve time = 33.2
> uBlas assembly time = 0.3
> Solving linear system of size 38809 x 38809 (uBlas Krylov solver).
> Krylov solver converged in 2744 iterations.
> norm(x) 12.2
> uBlas Krylov solve time = 27
> Factor ( < 1 mean uBlas is faster ) 0.814
> 
> Some more work (a few extra copies) is made so it might be marginally
> slower than yesterday (26.7 --> 27.0, about 1%).
> 
> Here's the new interface for solving with GMRES and ILU
> preconditioning:
> 
>   uBlasKrylovSolver solver(uBlasKrylovSolver::gmres);
>   uBlasILUPreconditioner pc(A);
>   solver.solve(A, x, b, pc);
> 
> Garth, take a look and see if you like it. I'll keep my hands of the
> linear algebra now for a while so if you want to do the templating and
> renaming of the matrix/vector classes, please go ahead.
> 

Looks fine.

Garth.

> It should now be "easy" to move the ODE solvers from PETSc to uBlas.
> 
> /Anders
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev



Follow ups

References