[petsc-users] Adapting MatMult and PCMG functions in matrix-free method.

Barry Smith bsmith at mcs.anl.gov
Fri Jul 6 10:46:39 CDT 2012


   
On Jul 6, 2012, at 12:00 AM, domenico lahaye wrote:

> Thank you for the additional feedback. 
> 
> What you suggest was my first guess. I did not 
> see a way however to define the restriction operator 
> as a product of two operators, in casu the operators 
> A and M. This then lead to my question of defining 
> the approximate solve with M inside the MatMult 
> routine. 
> 
     MATSHELL is the way to construct custom MatMults.  If that is your question.

    Barry

> Does this make sense? 
> 
> Domenico. 
> 
> ----- Original Message -----
> From: Barry Smith <bsmith at mcs.anl.gov>
> To: PETSc users list <petsc-users at mcs.anl.gov>
> Cc: domenico lahaye <domenico_lahaye at yahoo.com>; Abdul Hanan Sheikh <hanangul12 at yahoo.co.uk>
> Sent: Friday, July 6, 2012 2:54 AM
> Subject: Re: [petsc-users] Adapting MatMult and PCMG functions in matrix-free method.
> 
> 
> On Jul 5, 2012, at 4:41 PM, Jed Brown wrote:
> 
> > On Thu, Jul 5, 2012 at 10:38 AM, domenico lahaye <domenico_lahaye at yahoo.com> wrote:
> > Hi Jed, 
> > 
> >  Thank you for your reply. The Algorithm II is described in the paper 
> > 
> > @ARTICLE{yoginabben1,
> >  author = {Erlangga, Y.A. and R. Nabben},
> >  title = {On a multilevel {K}rylov Method for the {H}elmholtz Equation preconditioned
> >     by Shifted {L}aplacian},
> >  journal = {Electronic Transaction on Num. Analysis (ETNA)},
> >  year = {2008},
> >  volume = {31},
> >  pages = {403--424},
> >  }
> > 
> > As I interpret this method, you have custom interpolation operators and a Krylov smoother that is itself a multigrid cycle with the shifted operator. In PETSc parlance, you have two matrices, the operator A and the preconditioning matrix M. Here M would be the shifted matrix and smoothing would involve MG cycles with coarsened approximations of M. I would start with the PCMG interface, use a Krylov method as the smoother, and perhaps use PCComposite or PCShell as the preconditioner for the Krylov smoother. Eventually the preconditioner for your Krylov smoother will call the "other" MG cycle (a standard method applied to M).
> 
>   Note this shouldn't require "hacking" or manually modifying the PCMG code that currently exists. It would just involve clever use of a different PCMG inside the PC of the original PCMG. 
> 
>   Barry
> 
> > 
> > Note that this method involves an enormous number of synchronization points as well as high operator complexity, so you may find the cost to be quite high even though the iteration count is not bad.
> >  
> > 
> >  Kind wishes, Domenico.
> > 
> > From: Jed Brown <jedbrown at mcs.anl.gov>
> > To: domenico lahaye <domenico_lahaye at yahoo.com>; PETSc users list <petsc-users at mcs.anl.gov> 
> > Cc: Abdul Hanan Sheikh <hanangul12 at yahoo.co.uk> 
> > Sent: Thursday, July 5, 2012 7:47 PM
> > 
> > Subject: Re: [petsc-users] Adapting MatMult and PCMG functions in matrix-free method.
> > 
> > Can you reference a paper or some notes on the algorithm?
> > 
> > On Thu, Jul 5, 2012 at 8:40 AM, domenico lahaye <domenico_lahaye at yahoo.com> wrote:
> > Dear PETSc developers, 
> > 
> >  Thank you for your support to Abdul. 
> > 
> >    We are in the process of developing a multilevel 
> > Krylov solver for the Helmholtz equation. Abdul 
> > has implemented Algorithm I for this purpose. 
> > We next would like to implement Algorithm II. 
> > Algorithm || amounts to replacing every occurrence 
> > of the system matrix $A$ in Algorithm I by 
> > $M^{-1} A$. This replacement should occur on all 
> > levels. We thought of two ways to realize this 
> > replacement. 
> > 
> > 1) We thought of adopting a matrix-free approach, 
> > and to plug in the operation with  $M^{-1}$ there. 
> > This would require a ksp context inside MatMult.    
> > We wonder whether this a approach is feasible to 
> > take. 
> > 
> > 2) The other approach would by to implement a 
> > customized pcmg preconditioner that we can adapt 
> > to our needs. This could be a more elegant approach, 
> > at the cost of doing more work. Is the assumption 
> > that the second approach is more elegant correct 
> > and would you be able to give advice on how to tackle 
> > this approach? 
> > 
> >  Kind wishes, Domenico. 
> > 
> > 
> > 
> > 
> > ----- Forwarded Message -----
> > From: Matthew Knepley <knepley at gmail.com>
> > To: Abdul Hanan Sheikh <hanangul12 at yahoo.co.uk>; PETSc users list <petsc-users at mcs.anl.gov> 
> > Sent: Thursday, 5 July 2012, 15:45
> > Subject: Re: [petsc-users] Adapting MatMult and PCMG functions in matrix-free method.
> > 
> > On Thu, Jul 5, 2012 at 7:34 AM, Abdul Hanan Sheikh <hanangul12 at yahoo.co.uk> wrote:
> > Dear developers and users,
> > Summer greetings.
> > We have few question listen below: 
> > 
> > 1. 
> > The first question is about adapting " MatMult " function in matrix-free method.
> > We intend to incorporate a KSP context inside "MatMult" . The immediate question is how to
> > provide more than one matrices as input. 
> > 
> > You provide extra data through the context for the MATSHELL
> >  
> > Is this idea of incorporating a KSP context inside "MatMult" function workable ? Does it make any confrontation 
> > with philosophy of development of Petsc. ? 
> > 
> > I am not sure you want this. Do you think PCKSP can do what you want? There is not enough information here to help us answer.
> >  
> > 2. 
> > An other advance level feedback is needed. 
> >  Re-implementing PCMG function { mg.c } will lead any violation of philosophy of Petsc-development ??
> > 
> > Again, there is not enough information. Can you do what you want by just replacing the monitors?
> > 
> >  Thanks,
> > 
> >      Matt
> >  
> > 3. 
> > Which one of the above both is more elegant and feasible to work on ? 
> > 
> > 
> > Thanking in anticipation, 
> > Abdul 
> > 
> > 
> > 
> > 
> > 
> > -- 
> > 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
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 



More information about the petsc-users mailing list