[petsc-users] About MatMumpsSetIcntl function

Matthew Knepley knepley at gmail.com
Wed Nov 30 08:26:23 CST 2022


On Wed, Nov 30, 2022 at 9:20 AM 김성익 <ksi2443 at gmail.com> wrote:

> In my code there are below.
> PetscCall(KSPCreate(PETSC_COMM_WORLD, &ksp));
> PetscCall(KSPSetOperators(ksp, xGK, xGK));
> PetscCall(KSPGetPC(ksp, &pc));
> PetscCall(PCSetType(pc, PCLU));
> PetscCall(PCFactorSetMatSolverType(pc, MATSOLVERMUMPS));
> PetscCall(KSPSetFromOptions(ksp));
>
> and my runtime options are as below.
> mpirun -np 3 ./app -mpi_linear_solver_server
> -mpi_linear_solver_server_view -pc_type mpi -ksp_type preonly
> -mpi_ksp_monitor -mpi_ksp_converged_reason -mpi_pc_type lu
> -pc_mpi_always_use_server -mat_mumps_icntl_7 5
>

1) Get rid of the all server stuff until we see what is wrong with your code

2) Always run in serial until it works

  ./app -pc_type lu -ksp_type preonly -ksp_monitor_true_residual
-ksp_converged_reason -ksp_view -mat_mumps_icntl_7 5

Send the output so we can see what the solver is.

  Thanks,

     Matt

2022년 11월 30일 (수) 오후 11:16, Matthew Knepley <knepley at gmail.com>님이 작성:
>
>> On Wed, Nov 30, 2022 at 9:10 AM 김성익 <ksi2443 at gmail.com> wrote:
>>
>>> When I adopt icntl by using option, the outputs are as below.
>>>
>>> WARNING! There are options you set that were not used!
>>> WARNING! could be spelling mistake, etc!
>>> There is one unused database option. It is:
>>> Option left: name:-mat_mumps_icntl_7 value: 5
>>>
>>> Is it work??
>>>
>>
>> Are you calling KSPSetFromOptions() after the PC is created?
>>
>>   -pc_type lu -pc_factor_mat_solver_type mumps -mat_mumps_icntl_7 3
>>
>>   Thanks,
>>
>>      Matt
>>
>>
>>> Thanks,
>>> Hyung Kim
>>>
>>> 2022년 11월 30일 (수) 오후 11:04, Matthew Knepley <knepley at gmail.com>님이 작성:
>>>
>>>> On Wed, Nov 30, 2022 at 8:58 AM 김성익 <ksi2443 at gmail.com> wrote:
>>>>
>>>>> I'm working on FEM.
>>>>>   When I used mumps alone, I fount it efficient to use mumps with
>>>>> metis.
>>>>> So my purpose is using MUMPSsolver with METIS.
>>>>>
>>>>> I tried to set metis (by icntl_7 : 5) after global matrix assembly and
>>>>> just before kspsolve.
>>>>> However there is error because of 'pcfactorgetmatrix' and
>>>>> 'matmumpsseticntl'.
>>>>>
>>>>> How can I fix this?
>>>>>
>>>>
>>>> Give the Icntrl as an option.
>>>>
>>>>   Thanks,
>>>>
>>>>      Matt
>>>>
>>>>
>>>>> Thanks,
>>>>> Hyung Kim
>>>>>
>>>>> 2022년 11월 30일 (수) 오후 10:44, Matthew Knepley <knepley at gmail.com>님이 작성:
>>>>>
>>>>>> On Wed, Nov 30, 2022 at 8:40 AM 김성익 <ksi2443 at gmail.com> wrote:
>>>>>>
>>>>>>> Following your comments,
>>>>>>>
>>>>>>> After matrix assembly end,
>>>>>>> PetscCall(KSPGetPC(ksp,&pc));
>>>>>>> PetscCall(KSPSetFromOptions(ksp));
>>>>>>> PetscCall(KSPSetUp(ksp));
>>>>>>> PetscCall(PCFactorGetMatrix(pc,&xGK));
>>>>>>>
>>>>>>> However there is another error as below.
>>>>>>> [0]PETSC ERROR: Object is in wrong state
>>>>>>> [0]PETSC ERROR: Not for factored matrix
>>>>>>>
>>>>>>
>>>>>> The error message is telling you that you cannot alter values in the
>>>>>> factored matrix. This is because
>>>>>> the direct solvers use their own internal storage formats which we
>>>>>> cannot alter, and you should probably
>>>>>> not alter either.
>>>>>>
>>>>>> What are you trying to do?
>>>>>>
>>>>>>   Thanks,
>>>>>>
>>>>>>      Matt
>>>>>>
>>>>>>
>>>>>>> [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble
>>>>>>> shooting.
>>>>>>> [0]PETSC ERROR: Petsc Release Version 3.18.1, unknown
>>>>>>> [0]PETSC ERROR: ./app on a arch-linux-c-debug named ubuntu by
>>>>>>> ksi2443 Wed Nov 30 05:37:52 2022
>>>>>>> [0]PETSC ERROR: Configure options -download-mumps
>>>>>>> -download-scalapack -download-parmetis -download-metis
>>>>>>> [0]PETSC ERROR: #1 MatZeroEntries() at
>>>>>>> /home/ksi2443/petsc/src/mat/interface/matrix.c:6024
>>>>>>> [0]PETSC ERROR: #2 main() at /home/ksi2443/Downloads/coding/a1.c:339
>>>>>>> [0]PETSC ERROR: No PETSc Option Table entries
>>>>>>>
>>>>>>> How can I fix this?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Hyung Kim
>>>>>>>
>>>>>>>
>>>>>>> 2022년 11월 30일 (수) 오후 4:18, Jose E. Roman <jroman at dsic.upv.es>님이 작성:
>>>>>>>
>>>>>>>> You have to call PCFactorGetMatrix() first. See any of the examples
>>>>>>>> that use MatMumpsSetIcntl(), for instance
>>>>>>>> https://petsc.org/release/src/ksp/ksp/tutorials/ex52.c.html
>>>>>>>>
>>>>>>>> Jose
>>>>>>>>
>>>>>>>>
>>>>>>>> > El 30 nov 2022, a las 6:52, 김성익 <ksi2443 at gmail.com> escribió:
>>>>>>>> >
>>>>>>>> > Hello,
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > I tried to adopt METIS option in MUMPS by using
>>>>>>>> > ' PetscCall(MatMumpsSetIcntl(Mat, 7, 5));'
>>>>>>>> >
>>>>>>>> > However, there is an error as follows
>>>>>>>> >
>>>>>>>> > [0]PETSC ERROR: Object is in wrong state
>>>>>>>> > [0]PETSC ERROR: Only for factored matrix
>>>>>>>> > [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble
>>>>>>>> shooting.
>>>>>>>> > [0]PETSC ERROR: Petsc Release Version 3.18.1, unknown
>>>>>>>> > [0]PETSC ERROR: ./app on a arch-linux-c-debug named ubuntu by
>>>>>>>> ksi2443 Tue Nov 29 21:12:41 2022
>>>>>>>> > [0]PETSC ERROR: Configure options -download-mumps
>>>>>>>> -download-scalapack -download-parmetis -download-metis
>>>>>>>> > [0]PETSC ERROR: #1 MatMumpsSetIcntl() at
>>>>>>>> /home/ksi2443/petsc/src/mat/impls/aij/mpi/mumps/mumps.c:2478
>>>>>>>> > [0]PETSC ERROR: #2 main() at
>>>>>>>> /home/ksi2443/Downloads/coding/a1.c:149
>>>>>>>> > [0]PETSC ERROR: No PETSc Option Table entries
>>>>>>>> >
>>>>>>>> > How can I fix this error?
>>>>>>>> >
>>>>>>>> > Thank you for your help.
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > Hyung Kim
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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/
>>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> 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/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>>
>> --
>> 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/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

-- 
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/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221130/c182fc03/attachment-0001.html>


More information about the petsc-users mailing list