[petsc-users] Speed up KSPSolve of dense matrix

Jed Brown jed at jedbrown.org
Thu Nov 6 02:52:37 CST 2014


Florian Lindner <mailinglists at xgm.de> writes:
> I'm more or less aware of that, but I'm surprised that the performance is such poor.

If you've ever written a naive triply-nested loop dgemm, you'd know that
it gives up orders of magnitude.

> I changed the format of matrixC to dense now, but the runtime is still poor. Overall time is now around 9s with 95% spent in KSPSolve and exact the same number of MatMult executions, taking 65% of time.

Your solver is broken.  It takes 10000 iterations and presumably returns
KSP_DIVERGED_ITS (use -ksp_converged_reason to check).  This could be
due to GMRES restarts.  You might have better results with -ksp_type cg
(if your matrix is symmetric) or -ksp_type bcgs for nonsymmetric.  But
the bottom line is that you need a good preconditioner (or
well-conditioned system) for iterative methods to make sense for dense
matrices.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141106/d0ed638f/attachment.pgp>


More information about the petsc-users mailing list