[petsc-users] Reducing the time needed to solve linear systems using matrix ordering

Matthew Knepley knepley at gmail.com
Sat Feb 1 12:49:52 CST 2014


On Sat, Feb 1, 2014 at 12:04 PM, asma haouech <asma_i4 at hotmail.fr> wrote:

>  Dear all,
>
>
For any solver question, you need to send the output of -ksp_view for all
runs

   Matt


> I am new in PETSC. I am trying to test the impact of matrix ordering on
> the time needed for solving linear systems. It is known that ordering
> matrix reduces the fill-in so solving time decreases also. I use direct
> package solver 'superLU' and I tested different orderings but I've always
> found very close execution time values. Here is the code:
>
>
>
> ierr= KSPCreate(PETSC_COMM_WORLD,&ksp);CHKERRQ(ierr);
>
> ierr= KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
>
> ierr= KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr);
>
> ierr= KSPGetPC(ksp,&pc);CHKERRQ(ierr);
>
> ierr= PCSetType(pc,PCLU);CHKERRQ(ierr);
>
> ierr= PCFactorSetMatSolverPackage(pc,MATSOLVERSUPERLU);CHKERRQ(ierr);
>
> ierr= PCFactorSetUpMatSolverPackage(pc);CHKERRQ(ierr);
>
> ierr = MatGetOrdering(A,MATORDERINGRCM,&perm,&cperm);CHKERRQ(ierr);
>
> ierr = MatGetFactor(A,MATSOLVERSUPERLU,MAT_FACTOR_LU,&F);CHKERRQ(ierr);
>
> ierr = MatLUFactorSymbolic(F,A,perm,cperm,PETSC_NULL);CHKERRQ(ierr);
>
> ierr = MatLUFactorNumeric(F,A,PETSC_NULL);CHKERRQ(ierr);
>
> ierr = PCFactorGetMatrix(pc,&F);CHKERRQ(ierr);
>
> ierr= KSPSolve(ksp,b,x);CHKERRQ(ierr);
>
>
>
> I execute the program with this options : -mat_superlu_colperm NATURAL
> -mat_superlu_rowperm  NOROWPERM.
>
> Please tell me what is the problem in my code.
>
>
>
> Kind Regards,
>
> Asma.
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140201/98edb079/attachment.html>


More information about the petsc-users mailing list