[Trilinos-Users] Segmentation fault when using setPrecOperator and user defined preconditoner

Heroux, Mike MHeroux at CSBSJU.EDU
Sun Jun 4 16:24:40 EDT 2017


Hi John,

Sorry for my late reply.  If you want to provide your own preconditioner for AztecOO, you need to implement the ApplyInverse() method in your adapter for the Epetra_Operator class. This method is what will be called by AztecOO when it wants to apply your preconditioner.

The Apply() method is called if you register your operator with the UserOperator() method.

You can use a single adapter class for Epetra Operator that supports both the Apply() (for computing y = Ax) and the ApplyInverse() (for computing z = M^{-1}r).  Please note that your ApplyInverse() implementation must support the case where z and r are the same vector.

There is probably a better design that this, but it is what we knew at the time.

Does this make sense?

Thanks.

Mike

From: Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf of John Jomo <john.jomo at tum.de>
Date: Wednesday, May 31, 2017 at 3:29 AM
To: Michael A Heroux <maherou at sandia.gov>, Trilinos Users <trilinos-users at trilinos.org>
Subject: Re: [Trilinos-Users] Segmentation fault when using setPrecOperator and user defined preconditoner


Hallo Mike,.

the exception occurs AztecOO.cpp in the function Epetra_Aztec_precond(...) and is related to lines 1530 and 1531

1530: int ierr = A->ApplyInverse(*X, *Y);
1531: (ierr!=0) throw X->ReportError("Error in call to Epetra_Operator for preconditioner", ierr);

The ApplyInverse function seems to return an error code -3 in the Epetra_CrsMatrix::Solve( .. ) function (Epetra_CrsMatrix.cpp:1692)

It seems to me that I might be using the SetPrecOperator Interface in the wrong way. I actually only want to apply my user-defined preconditioner as a left preconditioner:  S A x = S y.
The matrix I pass to the SetPrecOperator function is the matrix S itself and not its inverse. Is this the intended use of the function?

I am a bit confused by the ApplyInverse function in Epetra_Aztec_precond(..). Is the AZ_PRECOND object meant to be S or its inverse?

Does the Epetra_Aztec_precond function just check if the preconditioner is valid?

Thanks for your help

John.


On 30.05.2017 22:05, Heroux, Michael A wrote:
John,

Can you send the error output?

Mike

From: Trilinos-Users <trilinos-users-bounces at trilinos.org><mailto:trilinos-users-bounces at trilinos.org> on behalf of John Jomo <john.jomo at tum.de><mailto:john.jomo at tum.de>
Date: Monday, May 29, 2017 at 10:39 AM
To: Trilinos Users <trilinos-users at trilinos.org><mailto:trilinos-users at trilinos.org>
Subject: [EXTERNAL] [Trilinos-Users] Segmentation fault when using setPrecOperator and user defined preconditoner


Hallo,

I want to apply a user-defined preconditioner when using Aztec00 through the function setPrecOperator() but get an exception when the iterate function is called on my AzteC00 object. The exception seems to be related to a bad_cast.

Here is a code snippet.

Teuchos::ParameterList mySolverParameterlist;
mySolverParameterlist.set( "AZ_output", AZ_summary );
mySolverParameterlist.set( "AZ_tol", 1e-10 );
mySolverParameterlist.set( "AZ_conv", AZ_rhs );
mySolverParameterlist.set( "AZ_solver", AZ_cg );
mySolverParameterlist.set( "Max_Iters", 8000 );

Epetra_LinearProblem problem( A, x, b );

AztecOO solver(problem);

EpetraFECrsMatrixPtr preconditioner = myEpetraLinearSystem.computePreconditionerMatrix();

solver.SetParameters( mySolverParameterlist );
solver.SetPrecOperator( preconditioner );
solver.Iterate( mySolverParameterlist.get("Max_Iters",100), mySolverParameterlist.get( "AZ_tol",1e-8) );



I tried following the advice in the AzteC00 examples or in the following thread

https://trilinos.org/pipermail/trilinos-users/2016-January/005276.html



My user defined Preconditioner is an algebraic preconditoner which I store as a Epetra_FECrsMatrix. I compute the values of the preconditioner in the function computePreconditionerMatrix() and call FillComplete when finished.

A Epetra_FECrsMatrix should be a Epetra_Operator so I do not see why code doesn't work. Is there anything I am missing?

Thanks for the help.



bests,



John




--

John Jomo M.Sc.

Technische Universität München

Computation in Engineering

Simulation in Applied Mechanics - SAM

Arcisstraße 21

80333 München

Tel.:     0049 / 89 / 289 25064

Fax:      0049 / 89 / 289 25051

E-Mail:   john.jomo at tum.de<mailto:john.jomo at tum.de><mailto:john.jomo at tum.de><mailto:john.jomo at tum.de>

Internet: www.cie.bgu.tum.de<http://www.cie.bgu.tum.de><http://www.cie.bgu.tum.de/><http://www.cie.bgu.tum.de/>



--

John Jomo M.Sc.

Technische Universität München

Computation in Engineering

Simulation in Applied Mechanics - SAM

Arcisstraße 21

80333 München

Tel.:     0049 / 89 / 289 25064

Fax:      0049 / 89 / 289 25051

E-Mail:   john.jomo at tum.de<mailto:john.jomo at tum.de><mailto:john.jomo at tum.de><mailto:john.jomo at tum.de>

Internet: www.cie.bgu.tum.de<http://www.cie.bgu.tum.de><http://www.cie.bgu.tum.de/><http://www.cie.bgu.tum.de/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20170604/eaa9b623/attachment.html>


More information about the Trilinos-Users mailing list