Linear Solvers

Linear Solvers in Sundance

Sundance has no built-in solvers; it uses Trilinos solvers. The simplest solvers to use are those that have been wrapped in the Trilinos Solver Framework (TSF) interface for solvers, but it is possible to use solvers that have not yet been wrapped in the TSF interface. You can specify a choice of linear solver in several ways: This document describes the first of these methods. Note that the solve() method of LinearProblem uses only TSF solvers, so in order to use that method you must either use a TSF solver or wrap your favorite solver in the TSF interface. A number of solver types are currently available through the TSF interface. There are several "native" TSF solvers, that is, solvers that have been implemented directly in terms of TSF objects. Additionally, the Aztec solvers are available through TSF.

In the following sections, we describe how to instantiate any of these solvers from an XML file, and how to write a solver specification in XML.

Creating a Solver Object from XML

The TSF LinearSolverBuilder object can create solvers specified in terms of a Trilinos ParameterList object. A ParameterList can be created in a number of ways, most simply by reading from an XML file. The use of these objects is shown in the following code fragment.
/* Read the parameters for the linear solver from an XML file */
ParameterXMLFileReader reader("../../examples-tutorial/bicgstab.xml");
ParameterList solverParams = reader.getParameters();

LinearSolver<double> linSolver = LinearSolverBuilder::createSolver(solverParams);
We next show how to write the XML for several solver types.

Writing Solver Parameter Lists in XML

Parameters are represented in XML as a Parameter entity, which has fields for a name, a type, and a value, for example
<Parameter name="Method" type="string" value="GMRES"/>
Solver parameters types are usually "string", "int", or "double". The parameters for a solver should be included in a ParameterList object with name "Linear Solver". In XML, this is written as follows.
<ParameterList name="Linear Solver">
   <!-- solver parameters go here -->
</ParameterList>
The solver package to be used (e.g., TSF, Aztec) should be specified with the Type parameter. Don't confuse this with the choice of solver algorithm, the specification of which is done in a way that may vary from package to package (in both native TSF and Aztec solvers, it is done using the "Method" parameter). To use an Aztec solver, one would include
<Parameter name="Type" type="string" value="Aztec"/>
in the parameter list above, or to use a native TSF solver one would include
<Parameter name="Type" type="string" value="TSF"/>

We now show two examples; the meaning of the parameters in each solver specification is described more fully in the sections on XML Specification of Native TSF Solvers and XML Specification of Aztec Solvers.

Example: Aztec's GMRES with ILU(k) preconditioning

<ParameterList name="Linear Solver">
   <Parameter name="Type" type="string" value="Aztec"/>
   <Parameter name="Method" type="string" value="GMRES"/>
   <Parameter name="Precond" type="string" value="Domain Decomposition"/>
   <Parameter name="Subdomain Solver" type="string" value="ILU"/>
   <Parameter name="Graph Fill" type="int" value="2"/>
   <Parameter name="Max Iterations" type="int" value="1000"/>
   <Parameter name="Tolerance" type="double" value="1e-6"/>
</ParameterList>

Example: Native TSF BICGSTAB with ILU(k) preconditioning

<ParameterList name="Linear Solver">
   <Parameter name="Type" type="string" value="TSF"/>
   <Parameter name="Method" type="string" value="BICGSTAB"/>
   <Parameter name="Graph Fill" type="int" value="1"/>
   <Parameter name="Max Iterations" type="int" value="800"/>
   <Parameter name="Precond" type="string" value="ILUK"/>
   <Parameter name="Tolerance" type="double" value="1e-12"/>
   <Parameter name="Verbosity" type="int" value="4"/>
</ParameterList>

XML Specification of Native TSF Solvers

XML Specification of Aztec Solvers

The Aztec family of solvers is accessible through specification by XML parameters. Aztec has many options; below we describe the XML parameters used to select amongst those options.

Aztec Options

An Aztec solver is specified at runtime through a set of parameters read from a block of XML. Each parameter has fields for a name, a type, and a value, for example
<Parameter name="Method" type="string" value="GMRES"/>
We can broadly classify Aztec parameters into two types: numerical parameters where the value is some number (either integer or real, depending on the parameter) and string parameters, where the value is a string chosen from a predefined set of options.

Aztec Solver Options

This section lists parameters that control the type of solve algorithm to be used by Aztec. The name of each parameter is given, followed by a list of legal values for that parameter.

Aztec Solver Numerical Parameters

This section lists the parameter names for the integer and double-valued parameters that are understood by Aztec. Note that not all parameters make sense with all solvers and preconditioners

Mapping to Aztec macro names

Internally, Aztec represents parameter and option values using C preprocessor macro names. To help map between the XML parameter names above and parameter and option names as given in the aztec documentation, we provide the following table of correspondences between names.
AZ_solver             "Method"
AZ_cg                 "CG"             
AZ_gmres              "GMRES"          
AZ_cgs                "CGS"            
AZ_tfqmr              "TFQMR"          
AZ_bicgstab           "BICGSTAB"       
AZ_lu                 "Direct"         
AZ_precond            "Precond"
AZ_none               "None"
AZ_Jacobi             "Jacobi"
AZ_Neumann            "Neumann Series"
AZ_sym_GS             "Symmetric Gauss-Seidel"
AZ_ls                 "Least-Squares Polynomial"
AZ_dom_decomp         "Domain Decomposition"
AZ_subdomain_solve    "Subdomain Solver"
AZ_lu                 "Approximate Sparse LU"
AZ_ilut               "Saad ILUT"
AZ_ilu                "ILU"
AZ_rilu               "RILU"
AZ_bilu               "Block ILU"
AZ_icc                "Incomplete Cholesky"
AZ_reorder            "Reorder ILU"
AZ_keep_info          "Keep Factorization"
AZ_graph_fill         "Graph Fill"
AZ_max_iter           "Max Iterations"
AZ_poly_ord           "Polynomial Order"
AZ_kspace             "Restart Size"
AZ_overlap            "Overlap"
AZ_tol                "Tolerance"
AZ_drop               "Drop Tolerance"
AZ_ilut_fill          "Fill Ratio"
AZ_omega              "Damping"
AZ_conv               "Residual Scaling"
AZ_r0                 "Initial"
AZ_rhs                "RHS"
AZ_Anorm              "Matrix"
AZ_sol                "Solution"
AZ_noscaled           "No Scaling"
AZ_output             "Verbosity"
AZ_all                "All"
AZ_none               "Silent"
AZ_warnings           "Warnings"
AZ_last               "Final Residual"
AZ_type_overlap       "Overlap Type"
AZ_standard           "Standard"
AZ_symmetric          "Symmetric"
AZ_reorder            "Reorder ILU"
AZ_keep_info          "Keep Factorization"
AZ_orthog             "GMRES Orthogonalization"
AZ_classic            "Classical Gram-Schmidt"
AZ_modified           "Modified Gram-Schmidt"
AZ_aux_vec            "Auxiliary Vector"
AZ_resid              "Residual"
AZ_rand               "Random"
AZ_reorder            "Reorder ILU"
AZ_keep_info          "Keep Factorization"
AZ_graph_fill         "Graph Fill"
AZ_max_iter           "Max Iterations"
AZ_poly_ord           "Polynomial Order"
AZ_kspace             "Restart Size"
AZ_overlap            "Overlap"
AZ_tol                "Tolerance"
AZ_drop               "Drop Tolerance"
AZ_ilut_fill          "Fill Ratio"
AZ_omega              "Damping"

Site Contact