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

Barry Smith bsmith at mcs.anl.gov
Thu Jul 5 13:37:25 CDT 2012


On Jul 5, 2012, at 11:40 AM, domenico lahaye 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. 

   If you truly are simply replacing a multiply by A everywhere with a approx. multiply by M^{-1}A then 1 is the easier AND more elegant approach. Simply create a MATSHELL and put in its context a struct continuing the A and the KSP used so approximately solve the M^{-1}A. 
> 
> 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