[Trilinos-Users] PETSc interface

Lucie Freret lfreret at arrow.utias.utoronto.ca
Thu May 1 08:31:18 MDT 2014


Hello Jed,

Thanks for your answer.
First of all, I must say that I'm new to Petsc and I have been working  
with Trilinos library for almost 6 months. I already have a solver  
which is working fine with Aztec (Gmres) + ML and I'd be curious to  
compare it with Petsc + ML (I successfully used Petsc with Gmres  
preconditioned by ASM).

Since I have 4 dof per node, I wanted to specify it to ML (as "PDE  
equations") but I couldn't find the keyword in Petsc. However, this is  
not my major concern. Actually I'm not able to reproduce the way ML is  
building the different coarse levels. To make it clear, when I use  
Petsc + ML, I get (for a given linear system) 7 coarse levels while I  
only get 4 with Aztec + ML. I couldn't find any examples online to  
help me to setup the ML parameters properly.

In case you may want to have a look, please find attached the setup ML  
options when using Petsc as the outer solver and when using Trilinos.

Thanks again,
Lucie



Quoting "Jed Brown" <jed at 59A2.org>:

> Lucie Freret <lfreret at arrow.utias.utoronto.ca> writes:
>
>> Hello Jed,
>>
>> Thanks a lot for your answer.
>>
>> I have already configured PETSc with --download-ml and run a test with
>> -pc_type ml but I'm not fully satisfied with this option.
>
> We (the PETSc developers) would be curious why not.
>
>> Instead of configuring PETSc with ML, I would like to use Trilinos
>> with PETSc interface. The example given in EpetraExt package deals
>> with a linear system using KSPsolve with ML as a preconditioner, which
>> is exactly what I'm looking for. For the time being I just want to
>> compile the test example, but unfortunately I'm getting some errors
>> when compiling it.
>
> I'll let whoever maintains that component reply.
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
      PetscOptionsSetValue("-pc_type","ml");
      PetscOptionsSetValue("-pc_ml_DampingFactor","1.0");
      PetscOptionsSetValue("-pc_ml_Threshold","0.0");
      PetscOptionsSetValue("-pc_ml_PrintLevel","10");
      PetscOptionsSetValue("-pc_ml_BlockScaling","true");
      PetscOptionsSetValue("-pc_ml_maxNlevels","10");
      PetscOptionsSetValue("-pc_ml_EnergyMinimization","2");
      PetscOptionsSetValue("-pc_ml_EnergyMinimizationCheap","false");
      PetscOptionsSetValue("-pc_ml_CoarsenScheme","Uncoupled");

      PetscOptionsSetValue("-pc_mg_Reusable","true");
      PetscOptionsSetValue("-pc_mg_cycles","2");
      PetscOptionsSetValue("-pc_mg_smoothdown","2");
      PetscOptionsSetValue("-pc_mg_smoothup","2");
     
      PetscOptionsSetValue("-mg_levels_ksp_type","richardson");
      PetscOptionsSetValue("-mg_levels_pc_type","asm");
      PetscOptionsSetValue("-mg_levels_ksp_max_it","1");
      PetscOptionsSetValue("-mg_levels_pc_factor_mat_ordering_type","rcm");
//       PetscOptionsSetValue("-mg_levels_pc_asm_overlap","0");
//       PetscOptionsSetValue("-mg_levels_pc_factor_levels","1");
      PetscOptionsSetValue("-mg_coarse_ksp_type","richardson");
      PetscOptionsSetValue("-mg_coarse_pc_type","asm");
      PetscOptionsSetValue("-mg_coarse_ksp_max_it","1");
//       PetscOptionsSetValue("-mg_coarse_pc_asm_overlap","0");
      
      PetscOptionsSetValue("-pc_factor_mat_ordering_type","rcm");
-------------- next part --------------
   Teuchos::ParameterList MLList;
   Teuchos::RCP< std::vector<int> > options = Teuchos::rcp(new std::vector<int>(AZ_OPTIONS_SIZE));
   Teuchos::RCP< std::vector<double> > params = Teuchos::rcp(new std::vector<double>(AZ_PARAMS_SIZE));
   ML_Epetra::SetDefaults("NSSA", MLList, &(*options)[0], &(*params)[0]);
  
   // Aggregation
   MLList.set("aggregation: type", "Uncoupled");
   MLList.set("aggregation: threshold", 0.0);
   MLList.set("aggregation: block scaling", true);

   // Smoother
   MLList.set("smoother: type", "ILU");
   MLList.set("smoother: pre or post", "post");
   MLList.set("smoother: sweeps", 2);
   MLList.set("coarse: type", "ILU");
   MLList.set("coarse: pre or post", "post");
   MLList.set("coarse: sweeps", 2);
   
   // Hierarchy
   MLList.set("reuse: enable", false);
   MLList.set("energy minimization: cheap", false);
   MLList.set("PDE equations", m_intParams[BLOCK_SIZE]);      
   MLList.set("use crs matrix storage", true);
   
   // Cycle control
   MLList.set("ML output", (int)10);
   MLList.set("eigen-analysis: type", "power-method");
   MLList.set("cycle applications", 2); 
   MLList.set("prec type", "MGV");
   MLList.set("max levels",max_levels);
   
   // Instantiate preconditioner
   m_prec = new ML_Epetra::MultiLevelPreconditioner(*m_matrix, MLList, true);


More information about the Trilinos-Users mailing list