[petsc-users] PETSc-MUMPS interface, numeric and symbolic factorisation
Y. Shidi
ys453 at cam.ac.uk
Fri May 4 14:54:52 CDT 2018
Dear Matt,
Thank you very much for your reply!
So what you mean is that I can just do the KSPSolve() every iteration
once the MUMPS is set?
That means inside the KSPSolve() the numerical factorization is
performed. If that is the case, it seems that the ksp object is
not changed when the values in the matrix are changed.
Or do I need to call both KSPSetOperators() and KSPSolve()?
On 2018-05-04 14:44, Matthew Knepley wrote:
> On Fri, May 4, 2018 at 9:40 AM, Y. Shidi <ys453 at cam.ac.uk> wrote:
>
>> Dear PETSc users,
>>
>> I am currently using MUMPS to solve linear systems directly.
>> Generally, we use ICNTL(7) or ICNTL(29) to do the preprocessing
>> step and then solve the system.
>>
>> In my code, the values in the matrix is changed in each iteration,
>> but the structure of the matrix stays the same, which means the
>> performance can be improved if symbolic factorisation is only
>> performed once. Hence, it is necessary to split the symbolic
>> and numeric factorisation. However, I cannot find a specific step
>> (control parameter) to perform the numeric factorisation.
>> I have used ICNTL(3) and ICNTL(4) to print the MUMPS information,
>> it seems that the symbolic and numeric factorisation always perform
>> together.
>
> If you use KSPSolve instead, it will automatically preserve the
> symbolic
> factorization.
>
> Thanks,
>
> Matt
>
>> So I am wondering if anyone has an idea about it.
>>
>> Below is how I set up MUMPS solver:
>> PC pc;
>> PetscBool flg_mumps, flg_mumps_ch;
>> flg_mumps = PETSC_FALSE;
>> flg_mumps_ch = PETSC_FALSE;
>> PetscOptionsGetBool(NULL, NULL, "-use_mumps_lu", &flg_mumps,
>> NULL);
>> PetscOptionsGetBool(NULL, NULL, "-use_mumps_ch", &flg_mumps_ch,
>> NULL);
>> if(flg_mumps ||flg_mumps_ch)
>> {
>> KSPSetType(_ksp, KSPPREONLY);
>> PetscInt ival,icntl;
>> PetscReal val;
>> KSPGetPC(_ksp, &pc);
>> /// Set preconditioner type
>> if(flg_mumps)
>> {
>> PCSetType(pc, PCLU);
>> }
>> else if(flg_mumps_ch)
>> {
>> MatSetOption(A, MAT_SPD, PETSC_TRUE);
>> PCSetType(pc, PCCHOLESKY);
>> }
>> PCFactorSetMatSolverPackage(pc, MATSOLVERMUMPS);
>> PCFactorSetUpMatSolverPackage(pc);
>> PCFactorGetMatrix(pc, &_F);
>> icntl = 7; ival = 0;
>> MatMumpsSetIcntl( _F, icntl, ival );
>> MatMumpsSetIcntl(_F, 3, 6);
>> MatMumpsSetIcntl(_F, 4, 2);
>> }
>> KSPSetUp(_ksp);
>>
>> Kind Regards,
>> Shidi
>
> --
>
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which
> their experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/ [1]
>
>
> Links:
> ------
> [1] http://www.caam.rice.edu/~mk51/
More information about the petsc-users
mailing list