/[escript]/trunk/escriptcore/src/SolverOptions.h
ViewVC logotype

Diff of /trunk/escriptcore/src/SolverOptions.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6798 by aellery, Wed Nov 7 23:58:41 2018 UTC revision 6799 by aellery, Mon Mar 25 05:53:58 2019 UTC
# Line 27  namespace escript { Line 27  namespace escript {
27  This enum defines the options for solving linear/non-linear systems with escript.  This enum defines the options for solving linear/non-linear systems with escript.
28    
29  SO_DEFAULT: use escript defaults for specific option  SO_DEFAULT: use escript defaults for specific option
 SO_TARGET_CPU: use CPUs to solve system  
 SO_TARGET_GPU: use GPUs to solve system  
30    
 SO_PACKAGE_CUSP: CUDA sparse linear algebra package  
31  SO_PACKAGE_MKL: Intel's MKL solver library  SO_PACKAGE_MKL: Intel's MKL solver library
32  SO_PACKAGE_PASO: PASO solver package  SO_PACKAGE_PASO: PASO solver package
33  SO_PACKAGE_TRILINOS: The TRILINOS parallel solver class library from Sandia National Labs  SO_PACKAGE_TRILINOS: The TRILINOS parallel solver class library from Sandia National Labs
# Line 56  SO_METHOD_ROWSUM_LUMPING: Matrix lumping Line 53  SO_METHOD_ROWSUM_LUMPING: Matrix lumping
53  SO_METHOD_TFQMR: Transpose Free Quasi Minimal Residual method  SO_METHOD_TFQMR: Transpose Free Quasi Minimal Residual method
54    
55  SO_PRECONDITIONER_AMG: Algebraic Multi Grid  SO_PRECONDITIONER_AMG: Algebraic Multi Grid
 SO_PRECONDITIONER_AMLI: Algebraic Multi Level Iteration  
56  SO_PRECONDITIONER_GAUSS_SEIDEL: Gauss-Seidel preconditioner  SO_PRECONDITIONER_GAUSS_SEIDEL: Gauss-Seidel preconditioner
57  SO_PRECONDITIONER_ILU0: The incomplete LU factorization preconditioner with no fill-in  SO_PRECONDITIONER_ILU0: The incomplete LU factorization preconditioner with no fill-in
58  SO_PRECONDITIONER_ILUT: The incomplete LU factorization preconditioner with fill-in  SO_PRECONDITIONER_ILUT: The incomplete LU factorization preconditioner with fill-in
# Line 73  SO_INTERPOLATION_CLASSIC: classical inte Line 69  SO_INTERPOLATION_CLASSIC: classical inte
69  SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING: classical interpolation in AMG with enforced  SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING: classical interpolation in AMG with enforced
70  SO_INTERPOLATION_DIRECT: direct interpolation in AMG  SO_INTERPOLATION_DIRECT: direct interpolation in AMG
71    
 SO_COARSENING_AGGREGATION: AMG and AMLI coarsening using (symmetric) aggregation  
 SO_COARSENING_CIJP: BoomerAMG parallel coarsening method CIJP  
 SO_COARSENING_CIJP_FIXED_RANDOM: BoomerAMG parallel coarsening method CIJP by using fixed random vector  
 SO_COARSENING_FALGOUT: BoomerAMG parallel coarsening method falgout  
 SO_COARSENING_HMIS: BoomerAMG parallel coarsening method HMIS  
 SO_COARSENING_PMIS: BoomerAMG parallel coarsening method PMIS  
 SO_COARSENING_RUGE_STUEBEN: AMG and AMLI coarsening method by Ruge and Stueben  
 SO_COARSENING_STANDARD: AMG and AMLI standard coarsening using measure of importance of the unknowns  
 SO_COARSENING_YAIR_SHAPIRA: AMG and AMLI coarsening method by Yair-Shapira  
   
72  SO_REORDERING_DEFAULT: the reordering method recommended by the solver  SO_REORDERING_DEFAULT: the reordering method recommended by the solver
73  SO_REORDERING_MINIMUM_FILL_IN: Reorder matrix to reduce fill-in during factorization  SO_REORDERING_MINIMUM_FILL_IN: Reorder matrix to reduce fill-in during factorization
74  SO_REORDERING_NESTED_DISSECTION: Reorder matrix to improve load balancing during factorization  SO_REORDERING_NESTED_DISSECTION: Reorder matrix to improve load balancing during factorization
# Line 92  enum SolverOptions Line 78  enum SolverOptions
78  {  {
79      SO_DEFAULT,      SO_DEFAULT,
80    
     // Solver targets  
     SO_TARGET_CPU,  
     SO_TARGET_GPU,  
   
81      // Solver packages      // Solver packages
     SO_PACKAGE_CUSP,  
82      SO_PACKAGE_MKL,      SO_PACKAGE_MKL,
83      SO_PACKAGE_PASO,      SO_PACKAGE_PASO,
84      SO_PACKAGE_TRILINOS,      SO_PACKAGE_TRILINOS,
# Line 127  enum SolverOptions Line 108  enum SolverOptions
108    
109      // Preconditioners      // Preconditioners
110      SO_PRECONDITIONER_AMG,      SO_PRECONDITIONER_AMG,
     SO_PRECONDITIONER_AMLI,  
111      SO_PRECONDITIONER_GAUSS_SEIDEL,      SO_PRECONDITIONER_GAUSS_SEIDEL,
112      SO_PRECONDITIONER_ILU0,      SO_PRECONDITIONER_ILU0,
113      SO_PRECONDITIONER_ILUT,      SO_PRECONDITIONER_ILUT,
# Line 146  enum SolverOptions Line 126  enum SolverOptions
126      SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING,      SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING,
127      SO_INTERPOLATION_DIRECT,      SO_INTERPOLATION_DIRECT,
128    
     // Coarsening methods  
     SO_COARSENING_AGGREGATION,  
     SO_COARSENING_CIJP,  
     SO_COARSENING_CIJP_FIXED_RANDOM,  
     SO_COARSENING_FALGOUT,  
     SO_COARSENING_HMIS,  
     SO_COARSENING_PMIS,  
     SO_COARSENING_RUGE_STUEBEN,  
     SO_COARSENING_STANDARD,  
     SO_COARSENING_YAIR_SHAPIRA,  
   
129      SO_REORDERING_DEFAULT,      SO_REORDERING_DEFAULT,
130      SO_REORDERING_MINIMUM_FILL_IN,      SO_REORDERING_MINIMUM_FILL_IN,
131      SO_REORDERING_NESTED_DISSECTION,      SO_REORDERING_NESTED_DISSECTION,
# Line 206  public: Line 175  public:
175      void resetDiagnostics(bool all=false);      void resetDiagnostics(bool all=false);
176    
177      /**      /**
178            Initial settings
179        */
180        void setup();
181    
182        /**
183          Updates diagnostic information          Updates diagnostic information
184    
185          \param key name of diagnostic (a python string in the list "num_iter",          \param key name of diagnostic (a python string in the list "num_iter",
# Line 260  public: Line 234  public:
234      bool hasConverged() const;      bool hasConverged() const;
235    
236      /**      /**
         Sets the key of the coarsening method to be applied in AMG or AMLI  
   
         \param coarsening the coarsening method, one of  
             `SO_DEFAULT`, `SO_COARSENING_YAIR_SHAPIRA`,  
             `SO_COARSENING_RUGE_STUEBEN`, `SO_COARSENING_AGGREGATION`,  
             `SO_COARSENING_CIJP_FIXED_RANDOM`, `SO_COARSENING_CIJP`,  
             `SO_COARSENING_FALGOUT`, `SO_COARSENING_PMIS`,  
             `SO_COARSENING_HMIS`  
     */  
     void setCoarsening(int coarsening);  
   
     /**  
         Returns the key of the coarsening algorithm to be applied for AMG or AMLI  
     */  
     SolverOptions getCoarsening() const;  
   
     /**  
         Sets the minimum size of the coarsest level matrix in AMG or AMLI  
   
         \param size minimum size of the coarsest level matrix .  
     */  
     void setMinCoarseMatrixSize(int size);  
   
     /**  
         Returns the minimum size of the coarsest level matrix in AMG or AMLI  
     */  
     int getMinCoarseMatrixSize() const;  
   
     /**  
237          Sets the preconditioner to be used.          Sets the preconditioner to be used.
238    
239          \param preconditioner key of the preconditioner to be used, one of          \param preconditioner key of the preconditioner to be used, one of
# Line 310  public: Line 255  public:
255      SolverOptions getPreconditioner() const;      SolverOptions getPreconditioner() const;
256    
257      /**      /**
         Sets the smoother to be used.  
   
         \param smoother key of the smoother to be used, should be in  
                `SO_PRECONDITIONER_JACOBI`, `SO_PRECONDITIONER_GAUSS_SEIDEL`  
   
         \note Not all packages support all smoothers. It can be assumed that a  
               package makes a reasonable choice if it encounters an unknown  
               smoother.  
     */  
     void setSmoother(int smoother);  
   
     /**  
         Returns the key of the smoother to be used.  
     */  
     SolverOptions getSmoother() const;  
   
     /**  
258          Sets the solver method to be used. Use ``method``=``SO_METHOD_DIRECT``          Sets the solver method to be used. Use ``method``=``SO_METHOD_DIRECT``
259          to indicate that a direct rather than an iterative solver should be          to indicate that a direct rather than an iterative solver should be
260          used and use ``method``=``SO_METHOD_ITERATIVE`` to indicate that an          used and use ``method``=``SO_METHOD_ITERATIVE`` to indicate that an
# Line 354  public: Line 282  public:
282      SolverOptions getSolverMethod() const;      SolverOptions getSolverMethod() const;
283    
284      /**      /**
         Sets the solver target to be used. By default the solver is run on  
         the host CPU(s). If escript was compiled with GPU support then  
         `SO_TARGET_GPU` is a valid option and the solver will run on GPU(s)  
         if the package supports it.  
   
         \param target key of the solver target. Valid settings:  
                `SO_TARGET_CPU`, `SO_TARGET_GPU`  
   
     */  
     void setSolverTarget(int target);  
   
     /**  
         Returns the key of the solver target.  
     */  
     SolverOptions getSolverTarget() const;  
   
     /**  
285          Sets the solver package to be used as a solver.          Sets the solver package to be used as a solver.
286    
287          \param package key of the solver package to be used, should be in          \param package key of the solver package to be used, should be in
# Line 428  public: Line 339  public:
339      int _getRestartForC() const;      int _getRestartForC() const;
340    
341      /**      /**
         Sets the threshold for diagonal dominant rows which are eliminated  
         during AMG coarsening.  
     */  
     void setDiagonalDominanceThreshold(double threshold);  
   
     /**  
         Returns the threshold for diagonal dominant rows which are eliminated  
         during AMG coarsening.  
     */  
     double getDiagonalDominanceThreshold() const;  
   
     /**  
342          Sets the number of residuals in GMRES to be stored for          Sets the number of residuals in GMRES to be stored for
343          orthogonalization. The more residuals are stored the faster GMRES          orthogonalization. The more residuals are stored the faster GMRES
344          converges but more memory is required.          converges but more memory is required.
# Line 477  public: Line 376  public:
376      int getIterMax() const;      int getIterMax() const;
377    
378      /**      /**
         Sets the maximum number of coarsening levels to be used in an algebraic  
         multi level solver or preconditioner  
   
         \param level_max maximum number of levels  
     */  
     void setLevelMax(int level_max);  
   
     /**  
         Returns the maximum number of coarsening levels to be used in an  
         algebraic multi level solver or preconditioner  
     */  
     int getLevelMax() const;  
   
     /**  
         Sets the cycle type (V-cycle or W-cycle) to be used in an algebraic  
         multi level solver or preconditioner  
   
         \param cycle_type the type of cycle  
     */  
     void setCycleType(int cycle_type);  
   
     /**  
         Returns the cycle type (V- or W-cycle) to be used in an algebraic multi  
         level solver or preconditioner  
     */  
     int getCycleType() const;  
   
     /**  
         Sets the threshold for coarsening in the algebraic multi level solver  
         or preconditioner  
   
         \param theta threshold for coarsening  
     */  
     void setCoarseningThreshold(double theta);  
   
     /**  
         Returns the threshold for coarsening in the algebraic multi level  
         solver or preconditioner  
     */  
     double getCoarseningThreshold() const;  
   
     /**  
379          Sets the number of sweeps in a Jacobi or Gauss-Seidel/SOR          Sets the number of sweeps in a Jacobi or Gauss-Seidel/SOR
380          preconditioner.          preconditioner.
381    
# Line 533  public: Line 390  public:
390      int getNumSweeps() const;      int getNumSweeps() const;
391    
392      /**      /**
         Sets the number of sweeps in the pre-smoothing step of a multi level  
         solver or preconditioner  
   
         \param sweeps number of sweeps  
     */  
     void setNumPreSweeps(int sweeps);  
   
     /**  
         Returns he number of sweeps in the pre-smoothing step of a multi level  
         solver or preconditioner  
     */  
     int getNumPreSweeps() const;  
   
     /**  
         Sets the number of sweeps in the post-smoothing step of a multi level  
         solver or preconditioner  
   
         \param sweeps number of sweeps  
     */  
     void setNumPostSweeps(int sweeps);  
   
     /**  
         Returns the number of sweeps in the post-smoothing step of a multi level  
         solver or preconditioner  
     */  
     int getNumPostSweeps() const;  
   
     /**  
393          Sets the relative tolerance for the solver          Sets the relative tolerance for the solver
394    
395          \param rtol relative tolerance          \param rtol relative tolerance
# Line 678  public: Line 507  public:
507      void setSymmetry(bool symmetry);      void setSymmetry(bool symmetry);
508    
509      /**      /**
510            Checks if the coefficient matrix is indicated to be Hermitian.
511    
512            \return true if a Hermitian PDE is indicated, false otherwise
513        */
514        bool isHermitian() const;
515    
516        /**
517            Sets the symmetry flag to indicate that the coefficient matrix is
518            Hermitian.
519        */
520        void setHermitianOn();
521    
522        /**
523            Clears the Hermitian flag for the coefficient matrix.
524        */
525        void setHermitianOff();
526    
527        /**
528            Sets the Hermitian flag for the coefficient matrix to ``flag``.
529    
530            \param Hermitian If true, the symmetry flag is set otherwise reset.
531        */
532        void setHermitian(bool hermitian);
533    
534        /**
535          Returns ``true`` if the solver is expected to be verbose.          Returns ``true`` if the solver is expected to be verbose.
536    
537          \return true if verbosity is on          \return true if verbosity is on
# Line 784  public: Line 638  public:
638      void setLocalPreconditioner(bool local);      void setLocalPreconditioner(bool local);
639    
640      /**      /**
         Sets the minimum sparsity at the coarsest level. Typically a direct  
         solver is used when the sparsity becomes larger than the set limit.  
   
         \param sparsity minimal sparsity  
     */  
     void setMinCoarseMatrixSparsity(double sparsity);  
   
     /**  
         Returns the minimum sparsity on the coarsest level. Typically  
         a direct solver is used when the sparsity becomes bigger than  
         the set limit.  
   
         \returns minimal sparsity  
     */  
     double getMinCoarseMatrixSparsity() const;  
   
     /**  
641          Sets the number of refinement steps to refine the solution when a          Sets the number of refinement steps to refine the solution when a
642          direct solver is applied.          direct solver is applied.
643    
# Line 815  public: Line 652  public:
652      int getNumRefinements() const;      int getNumRefinements() const;
653    
654      /**      /**
         Sets the number of refinement steps to refine the solution on the  
         coarsest level when a direct solver is applied.  
   
         \param refinements number of refinements  
     */  
     void setNumCoarseMatrixRefinements(int refinements);  
   
     /**  
         Returns the number of refinement steps to refine the solution on the  
         coarsest level when a direct solver is applied.  
     */  
     int getNumCoarseMatrixRefinements() const;  
   
     /**  
         Returns ``true`` if a panel is used to search for unknowns in the AMG  
         coarsening, The panel approach is normally faster but can lead to  
         larger coarse level systems.  
     */  
     bool usePanel() const;  
   
     /**  
         Sets the flag to use a panel to find unknowns in AMG coarsening  
     */  
     void setUsePanelOn();  
   
     /**  
         Sets the flag to use a panel to find unknowns in AMG coarsening to off  
     */  
     void setUsePanelOff();  
   
     /**  
         Sets the flag to use a panel to find unknowns in AMG coarsening  
   
         \param use If ``true``, a panel is used to find unknowns in AMG  
                coarsening  
     */  
     void setUsePanel(bool use);  
   
     /**  
         Sets the interpolation method for the AMG preconditioner.  
   
         \param interpolation key of the interpolation method to be used,  
                should be in  
                `SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING`,  
                `SO_INTERPOLATION_CLASSIC`, `SO_INTERPOLATION_DIRECT`  
     */  
     void setAMGInterpolation(int interpolation);  
   
     /**  
         Returns key of the interpolation method for the AMG preconditioner  
     */  
     SolverOptions getAMGInterpolation() const;  
   
     /**  
655          Sets the solver method for ODEs.          Sets the solver method for ODEs.
656    
657          \param solver key of the ODE solver method to be used, should be in          \param solver key of the ODE solver method to be used, should be in
# Line 900  public: Line 683  public:
683      */      */
684      boost::python::dict getTrilinosParameters() const;      boost::python::dict getTrilinosParameters() const;
685    
686        /**
687            Sets the dimension of the problem we are solving.
688        */
689        void setDim(int dim);
690    
691        /**
692            Returns the dimension of the problem we are solving.
693        */
694        int getDim();
695    
696  protected:  protected:
697      boost::python::dict trilinosParams;      boost::python::dict trilinosParams;
698    
     SolverOptions target;  
699      SolverOptions package;      SolverOptions package;
700      SolverOptions method;      SolverOptions method;
701      SolverOptions preconditioner;      SolverOptions preconditioner;
702      SolverOptions ode_solver;      SolverOptions ode_solver;
     SolverOptions smoother;  
703      SolverOptions reordering;      SolverOptions reordering;
     SolverOptions coarsening;  
     SolverOptions amg_interpolation_method;  
     int level_max;  
     double coarsening_threshold;  
704      int sweeps;      int sweeps;
     int pre_sweeps;  
     int post_sweeps;  
705      double tolerance;      double tolerance;
706      double absolute_tolerance;      double absolute_tolerance;
707      double inner_tolerance;      double inner_tolerance;
# Line 928  protected: Line 713  protected:
713      int restart; //0 will have to be None in python, will get tricky      int restart; //0 will have to be None in python, will get tricky
714      bool is_complex;      bool is_complex;
715      bool symmetric;      bool symmetric;
716        bool hermitian;
717      bool verbose;      bool verbose;
718      bool adapt_inner_tolerance;      bool adapt_inner_tolerance;
719      bool accept_convergence_failure;      bool accept_convergence_failure;
     int min_coarse_matrix_size;  
720      double relaxation;      double relaxation;
721      bool use_local_preconditioner;      bool use_local_preconditioner;
     double min_sparsity;  
722      int refinements;      int refinements;
723      int coarse_refinements;      int dim; // Dimension of the problem, either 2 or 3. Used internally
     bool use_panel;  
     double diagonal_dominance_threshold;  
     int cycle_type;  
724    
725      int num_iter;      int num_iter;
726      int num_level;      int num_level;

Legend:
Removed from v.6798  
changed lines
  Added in v.6799

  ViewVC Help
Powered by ViewVC 1.1.26