[petsc-users] Doubts on direct solver with mumps

Emmanuel Ayala juaneah at gmail.com
Tue Mar 4 13:02:12 CST 2025


Hello everyone.

I'm trying to solve a linear system (which comes from 3D FEM with
structured DM mesh) with a direct solver. I configured petsc installation
with mumps (–download-mumps –download-scalapack –download-parmetis
–download-metis, --download-hwloc, without ptscotch) and I have the
following functions:

    // K is the stiffness matrix, assembly correctly
    // U is the solution vector
    // RHS is the right hand side of the linear equation

    Mat Kfactor;

    ierr = MatGetFactor(K,MATSOLVERMUMPS, MAT_FACTOR_CHOLESKY, &Kfactor);
CHKERRQ(ierr);
    ierr = MatCholeskyFactorSymbolic(Kfactor,K,0,0); CHKERRQ(ierr);
    ierr = MatCholeskyFactorNumeric(Kfactor,K,0); CHKERRQ(ierr);
    ierr = MatSolve(Kfactor,RHS,U);

    and run with options:
    -pc_type cholesky -pc_factor_mat_solver_type mumps -mat_mumps_icntl_1 1
-mat_mumps_icntl_13 0 -mat_mumps_icntl_28 2 -mat_mumps_icntl_29 2

PROBLEM:
I got the correct solution, but the function MatCholeskyFactorNumeric( )
takes too much time to be completed. MatCholeskyFactorSymbolic() and
MatSolve() are very fast. The test uses a square K matrix of 700k dofs, and
the MatCholeskyFactorNumeric() takes around 14 minutes, while an iterative
solver (KSPCG/PCJACOBI) takes 5 seconds to get the solution. Any
suggestions?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250304/6d7cb3b6/attachment.html>


More information about the petsc-users mailing list