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

asma haouech asma_i4 at hotmail.fr
Sat Feb 1 12:04:43 CST 2014


 Dear all,

 

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. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140201/3be8849a/attachment.html>


More information about the petsc-users mailing list