[petsc-users] Parallel LU decomposition

Jed Brown jed at 59A2.org
Mon May 31 12:08:54 CDT 2010


On Tue, 1 Jun 2010 00:50:35 +0800, "Gong Ding" <gdiso at ustc.edu> wrote:

> Any detailed example?
> I'd like to use PETSC routine to build parallel AIJ matrix A and parallel vector b.
> and then how to call MUMPS to do the factorization?

Almost all examples assemble a parallel matrix and vector.  To solve
multiple systems, just call KSPSolve() multiple times, the factorization
(or other setup) will only be redone after you call KSPSetOperators().
In this case, the parallel solve is

  -ksp_type preonly -pc_type lu -pc_factor_mat_solver_package mumps

The equivalent code is

    PC pc;
    ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr);
    ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
    ierr = PCSetType(pc,PCLU);CHKERRQ(ierr);
    ierr = PCFactorSetMatSolverPackage(pc,MATSOLVERMUMPS);CHKERRQ(ierr);

if you are allergic to the options database.

A complete example is

  src/ksp/ksp/examples/tutorials/ex16.c

I recommend using this interface rather than the lower level interfaces
that deal directly with the factors.

Jed


More information about the petsc-users mailing list