[petsc-users] Doubts on direct solver with mumps
Jed Brown
jed at jedbrown.org
Tue Mar 4 13:27:54 CST 2025
Yup, this is expected for direct solvers: numeric factorization for a 3D problem scales as O(n^2) while solving with the factors is only O(n^{4/3}). So you expect it to be slow to factor and fast to solve.
Iterative methods with good preconditioners can be O(n), and tend to be the choice for large problems any time they can be sufficiently robust (which is both a science and an art, but is available for many problem classes).
Emmanuel Ayala <juaneah at gmail.com> writes:
> 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.
More information about the petsc-users
mailing list