Michael Povolotskyi <[email protected]> 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.)

Attachment: pgp5ak3WmAHCi.pgp
Description: PGP signature

Reply via email to