[petsc-users] calling lapack for LU decomposition
Jed Brown
jedbrown at mcs.anl.gov
Mon Nov 4 14:37:26 CST 2013
Michael Povolotskyi <mpovolot at purdue.edu> writes:
> Dear Petsc developers,
> in my work I need to measure the multi threading performance of LAPACK
> function dgetrf
>
> Since all matrices are of PETSc type I'd like to call Petsc functions
> for the LU decomposition.
> My code reads like this
>
> Mat A; //serial dense matrix
>
> PetscErrorCode ierr;
> KSP ksp;
> Mat F;
> PC pc;
>
> ierr = KSPCreate(comm, &ksp);
> ierr = KSPSetOperators(ksp, A, A, SAME_PRECONDITIONER);
> ierr = KSPSetType(ksp, KSPPREONLY);
> ierr = KSPGetPC(ksp, &pc);
> ierr = PCSetType(pc, PCLU);
> ierr = PCFactorSetMatSolverPackage(pc, "petsc");
This is the default.
> ierr = KSPSetUp(ksp);
> ierr = PCFactorGetMatrix(pc, &F);
This function is not needed.
> Is this a correct way to call dgetrf ?
Yeah, run with -log_summary and look for the time spent in the
MatLUFactorNumeric event.
(You _can_ call the low-level MatLUFactor() directly, but I recommend
what you have written because it is more general-purpose so you can
easily switch to other methods.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131104/ead8f427/attachment.pgp>
More information about the petsc-users
mailing list