[petsc-dev] Telescope usage

Loïc Gouarin loic.gouarin at polytechnique.edu
Tue May 17 11:44:59 CDT 2022


17 mai 2022 17:53:46 Matthew Knepley <knepley at gmail.com>:

> On Tue, May 17, 2022 at 4:53 AM Dave May <dave.mayhem23 at gmail.com> wrote:
>> Dear Loic,
>>
>> I can confirm that PCTELESCOPE works nicely when using KSPSetComputeOperators.
>> Here is an example
>>
>> petsc-3.17.1/src/ksp/ksp/tutorials $ mpiexec -n 4 ./ex29 -pc_type mg -pc_mg_levels 2 -ksp_view -mg_coarse_pc_type telescope -mg_coarse_pc_telescope_reduction_factor 4 -da_grid_x  65 -da_grid_y 65 -mg_coarse_telescope_pc_type mg -mg_coarse_telescope_pc_mg_levels 2
>>
>> There is no special code in ex29.c to make the above options run.
>>
>> I must also apologize for sending you down the garden path with COARSEDM. That really isn't what you want to use - I am sorry for the confusion on my part.
>> COARSEDM is intended for the case when YOU (or rather your coarse DM) define the sub-communicator, rather than having  PCTELESCOPE define the sub-communicator.
>>
>> I believe that PCTELESCOPE should works with DMKSPSetComputeOperators().
>>
>> The function you provide to DMKSPSetComputeOperators() is unusual in my opinion.
>> Normally the method provided to DMKSPSetComputeOperators() just "assembles" (assembles meaning insert non-zero values for an AIJ or just calls MatAssemblyBegin/End for a matrix-free operator).
>> However your method seems to set sizes, set methods and call SetFromOptions. These are typically things which should done when the matrix is created - not when it is being "assembled".
>>
>> Maybe this is part of the reason your code isn't playing nicely with telescope.
>> I think the code would be cleaner and if you overloaded your DMCreateMatrix() with a method which would return your matrix-free MATSHELL.
>>
>> Yes I realize I am not directly helping solve your problem but maybe indirectly I am. Matt?
>
> Yes, I agree with Dave. This refactoring, even if it does not solve the problem, should allow us to understand it better.
> Does the change make sense?
Yes I think!
Thanks,
Loïc

>
>   Thanks,
>
>      Matt
>  
>> Cheers,
>> Dave
>>
>>
>> On Tue, 17 May 2022 at 13:18, Loic Gouarin <loic.gouarin at polytechnique.edu> wrote:
>>>
>>>
>>> Le 17/05/2022 à 12:03, Dave May a écrit :
>>>
>>>
>>> On Tue 17. May 2022 at 11:56, Loic Gouarin <loic.gouarin at polytechnique.edu> wrote:
>>>>
>>>> Hi Dave,
>>>>
>>>> could you explain what you mean by state ?
>>>>
>>>
>>> Ah - by state Matt and I mean any auxiliary data stored in the user context passed to KSPSetComputeOperators which is required to define your operator and is distributed. For example, a Vec which is used store coefficients of your PDE.
>>>
>>> Yes, I have a context which gives the operators (mult and diagonal) and some other informations to build the matrix free on each multigrid level.
>>>
>>> You can find the idea here: https://github.com/gouarin/cafes/blob/master/cafes/problem/stokes.hpp#L49-L91
>>>
>>> It's the definition of the operator used inside DMKSPComputeOperators.
>>>
>>> Loic
>>>
>>>
>>>
>>>
>>>> Thanks,
>>>>
>>>> Loic
>>>>
>>>> Le 17/05/2022 à 11:50, Dave May a écrit :
>>>>>
>
> --
> 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-dev/attachments/20220517/a64d09f9/attachment.html>


More information about the petsc-dev mailing list