[Trilinos-Users] AztecOO AZ_reuse question

Rajamanickam, Sivasankaran (-EXP) srajama at sandia.gov
Wed Mar 2 00:54:08 MST 2011


I am trying to use AztecOO for both inner and outer iterations in a new preconditioner. I create my new Ifpack style preconditioner. Set that as a preconditioner for my AztecOO  solver (solver1) for outer iteration. 

Inside my new preconditioner's compute 
  I create another AztecOO solver (solver2) (for inner iteration), set a smaller problem (for the Schur complement) and the other options. Set AZ_keep_info to 1, do a dummy iterate() so the preconditioner gets constructed. Then I set AZ_pre_calc to AZ_reuse and exit out of my compute.

Inside my new preconditioner's ApplyInverse
  I use the solver to solve for the Schur complement system. The expectation is that solve will use the already constructed preconditioner. However, I get

Error:	Did not find previous factorization (requested 
	by setting options[AZ_pre_calc] to AZ_reuse).
	To find this factorization, the following
	parameters must match the previous factorization:
		 1) Total number of unknowns.
		 2) options[AZ_overlap]
		 3) options[AZ_scaling]
		 4) options[AZ_precond]
		 5) options[AZ_reorder]
		 6) options[AZ_type_overlap]
		 7) options[AZ_subdomain_solve]
		 8) options[AZ_graph_fill]
		 9) params[AZ_ilut_fill]
		10) params[AZ_drop]
		11) data_org[AZ_name]
XXXP14 '*! 1.0266XXX -7923 208
(   -7923,     208  373793856) ==> P14 '*! 1.0266
( -914901,   15872  373827424) ==> vblock in gmres0
( -914901,     512  373746480) ==> ptrs in gmres0
( -914901,   10200  373817136) ==> general in gmres0
(    2073,      80  373754000) ==> T48 +1! 1.0295
(    2073,     208  373740272) ==> P48 +1! 1.0295
(    2077,     112  373740064) ==> x_reord P14 '*! 1.0266
(    2077,     612  373770976) ==> bindx P14 '*! 1.0266
(    2077,    1224  373738576) ==> val P14 '*! 1.0266
(    2077,      60  373748016) ==> iu P14 '*! 1.0266
(    2077,      60  373747856) ==> ordering P14 '*! 1.0266
(    2077,      60  373692640) ==> inv_ordering P14 '*! 1.0266
(    2077,     224  373692320) ==> A_over P14 '*! 1.0266
(    2077,      80  373768608) ==> T14 '*! 1.0266
(    2077,     208  373768320) ==> P14 '*! 1.0266

I tried setting the first 10 of the options in my compute explicitly, but that doesn't help. I don't how to set the data_org.

The following two cases work:
1. If I create a new solver every time inside my ApplyInverse method then it works fine. But that is terribly inefficient.

2. I tried two consecutive dummy iterate() calls within my compute then it works fine as well.

Here is some pseudo code
Inside the class definition I do
    Teuchos::RCP<Epetra_CrsMatrix> Sbar_;
    AztecOO *solver_;
    Epetra_MultiVector *Xs;
    Epetra_MultiVector *Bs;

In the compute I do 
 solver_  = new AztecOO() ;
 int err = solver_->SetUserMatrix(Sbar_.get());
 solver_->SetAztecOption(AZ_solver, AZ_gmres);
 solver_->SetAztecOption(AZ_precond, AZ_dom_decomp);
   // Do a dummy iterate to construct the preconditioner
    Epetra_Map BsMap(-1, Snr_, SRowElems_, 0, A_->Comm());
    Xs = new Epetra_MultiVector(BsMap, 1);
    Bs = new Epetra_MultiVector(BsMap, 1);
    Bs->PutScalar(1.0);
    solver_->SetLHS(Xs);
    solver_->SetRHS(Bs);
    solver_->Iterate(30, 1e-10);

    solver_->SetAztecOption(AZ_pre_calc, AZ_reuse);

    cout <<"Calling one more time in setup itself " << endl;
    Bs->PutScalar(2.0);
    solver_->Iterate(30, 1e-10); // This works

In the ApplyInverse
   Xs->PutScalar(0.0);
  Bs to random value
  solver_->Iterate(30, 1e-10); // This fails

Any help will be appreciated.

Thanks
Siva





More information about the Trilinos-Users mailing list