Using Belos: Next-generation Iterative Solvers November 6 th, 2007 Using Belos: Next-generation Iterative Solvers November 6 th, 2007 Mike Heroux Rich.

Slides:



Advertisements
Similar presentations
Lists: An internal look
Advertisements

Chapter 6 Queues and Deques.
C++ Templates. What is a template? Templates are type-generic versions of functions and/or classes Template functions and template classes can be used.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy under contract.
Applied Linear Algebra - in honor of Hans SchneiderMay 25, 2010 A Look-Back Technique of Restart for the GMRES(m) Method Akira IMAKURA † Tomohiro SOGABE.
A Tutorial on Anasazi and Belos 2011 Trilinos User Group Meeting November 1st, 2011 Chris Baker David Day Mike Heroux Mark Hoemmen Rich Lehoucq Mike Parks.
Next Generation Iterative Solvers: Belos & Anasazi Next Generation Iterative Solvers: Belos & Anasazi November 3 rd, 9:30-10:30am Mike Heroux Ulrich Hetmaniuk.
Problem Uncertainty quantification (UQ) is an important scientific driver for pushing to the exascale, potentially enabling rigorous and accurate predictive.
MOOCHO and TSFCore object-oriented software and interfaces for the development of optimization and other advanced abstract numerical algorithms Roscoe.
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
CSE 332: C++ templates and generic programming I Motivation for Generic Programming in C++ We’ve looked at procedural programming –Reuse of code by packaging.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Page 1 Trilinos Software Engineering Technologies and Integration Capability Area Overview Roscoe A. Bartlett Department.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Design of an ODE Solver Environment. System of ODEs Consider the system of ODEs: Typically solved by forward Euler or 4th order Runge-Kutta.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 15: Linked data structures.
Teuchos: Utilities for Developers & Users November 4 th, 1:15-4:30pm Roscoe Bartlett Mike Heroux Kris Kampshoff Kevin Long Paul Sexton Heidi Thornquist.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
PyTrilinos: A Python Interface to Trilinos Bill Spotz Sandia National Laboratories Reproducible Research in Computational Geophysics August 31, 2006.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Page 1 Trilinos Software Engineering Technologies and Integration Capability Area Overview Roscoe A. Bartlett Department.
Page 1 Trilinos Software Engineering Technologies and Integration Numerical Algorithm Interoperability and Vertical Integration –Abstract Numerical Algorithms.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Page 1 Embedded Sensitivities and Optimization From Research to Applications Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation Sandia.
CSE 332: C++ Type Programming: Associated Types, Typedefs and Traits A General Look at Type Programming in C++ Associated types (the idea) –Let you associate.
Floating-Point Reuse in an FPGA Implementation of a Ray-Triangle Intersection Algorithm Craig Ulmer June 27, 2006 Sandia is a multiprogram.
Tammy Dahlgren with Tom Epperly, Scott Kohn, and Gary Kumfert Center for Applied Scientific Computing Common Component Architecture Working Group October.
1 ModelEvaluator Scalable, Extendable Interface Between Embedded Nonlinear Analysis Algorithms and Applications Roscoe A. Bartlett Department of Optimization.
ML: Multilevel Preconditioning Package Trilinos User’s Group Meeting Wednesday, October 15, 2003 Jonathan Hu Sandia is a multiprogram laboratory operated.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
C++ language first designed or implemented In 1980 by Bjarne Stroustrup, from Bell labs. that would receive formally this name at the end of 1983.
Solvers Made Easy (to use and use together) Thyra, Stratimikos, Handles and More... Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation.
Amesos Sparse Direct Solver Package Tim Davis, Mike Heroux, Rob Hoekstra, Marzio Sala, Ken Stanley, Heidi Thornquist, Jim Willenbring Trilinos Users Group.
1 Incorporating Iterative Refinement with Sparse Cholesky April 2007 Doron Pearl.
Query Execution Section 15.1 Shweta Athalye CS257: Database Systems ID: 118 Section 1.
An Overview of Anasazi An Overview of Anasazi November 2 nd, 2:15-3:15pm Chris Baker Ulrich Hetmaniuk Rich Lehoucq Heidi Thornquist (Lead) Sandia is a.
Danny Dunlavy, Andy Salinger Sandia National Laboratories Albuquerque, New Mexico, USA SIAM Parallel Processing February 23, 2006 SAND C Sandia.
Scalable Linear Algebra Capability Area Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation,
Thyra from a Developer's Perspective Roscoe A. Bartlett Department 1411: Optimization and Uncertainty Estimation Sandia National Laboratories Sandia is.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
New Features in ML 2004 Trilinos Users Group Meeting November 2-4, 2004 Jonathan Hu, Ray Tuminaro, Marzio Sala, Michael Gee, Haim Waisman Sandia is a multiprogram.
1 Stratimikos Unified Wrapper to Trilinos Linear Solvers and Preconditioners Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation Sandia.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Teuchos: Utilities for Developers & Users November 2nd, 3:30-4:30pm Roscoe Bartlett Mike Heroux Kris Kampshoff Kevin Long Paul Sexton Heidi.
Domain Decomposition in High-Level Parallelizaton of PDE codes Xing Cai University of Oslo.
Connections to Other Packages The Cactus Team Albert Einstein Institute
Thyra For Developers Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation Sandia National Laboratories Trilinos Users Group Meeting (Developers.
Using Thyra and Stratimikos to Build Blocked and Implicitly Composed Solver Capabilities Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation.
Trilinos Strategic (and Tactical) Planning Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United.
An Overview of Belos and Anasazi October 16 th, 11-12am Heidi Thornquist Teri Barth Rich Lehoucq Mike Heroux Computational Mathematics and Algorithms Sandia.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Generic Compressed Matrix Insertion P ETER G OTTSCHLING – S MART S OFT /TUD D AG L INDBO – K UNGLIGA T EKNISKA H ÖGSKOLAN SmartSoft – TU Dresden
Photos placed in horizontal position with even amount of white space between photos and header Sandia National Laboratories is a multi-program laboratory.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Recursion.
ML: A Multilevel Preconditioning Package Copper Mountain Conference on Iterative Methods March 29-April 2, 2004 Jonathan Hu Ray Tuminaro Marzio Sala Sandia.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Combining Trilinos Packages To Solve Linear Systems Michael A. Heroux Sandia National Labs.
CSE 332: C++ STL iterators What is an Iterator? An iterator must be able to do 2 main things –Point to the start of a range of elements (in a container)
What’s New for Epetra Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin.
Page 1 Open-Source Software for Interfacing and Support of Large-scale Embedded Nonlinear Optimization Roscoe A. Bartlett
CSE 332: C++ templates and generic programming II Review: Concepts and Models Templates impose requirements on type parameters –Types that are plugged.
Examples (D. Schmidt et al)
Xing Cai University of Oslo
Programming with ANSI C ++
ModelEvaluator Scalable, Extendable Interface Between Embedded Nonlinear Analysis Algorithms and Applications Roscoe A. Bartlett Department of Optimization.
Trilinos Software Engineering Technologies and Integration
Lab 03 - Iterator.
Presentation transcript:

Using Belos: Next-generation Iterative Solvers November 6 th, 2007 Using Belos: Next-generation Iterative Solvers November 6 th, 2007 Mike Heroux Rich Lehoucq Mike Parks Heidi Thornquist (Lead) Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy under contract DE-AC04-94AL85000.

Outline  Introduction  Motivation  Belos design  What’s in Trilinos 8.0  Framework implementations  Current linear solver iterations  Parameter list driven solver managers  Stratimikos interface  Concluding Remarks  What’s next for Belos …

Introducing Belos  Next-generation linear solver library, written in templated C++.  Provide a generic framework for developing algorithms for solving large-scale linear problems.  Algorithm implementation is accomplished through the use of traits classes and abstract base classes:  ex.: MultiVecTraits, OperatorTraits  ex.: Iteration, SolverManager, StatusTest  Includes block linear solvers:  Higher operator performance.

Why Belos?  AztecOO provides solvers for Ax=b  What about solvers for:  Simultaneously solved systems w/ multiple-RHS: AX = B  Sequentially solved systems w/ multiple-RHS: AX i = B i, i=1,…,t  Sequences of multiple-RHS systems: A i X i = B i, i=1,…,t  Many advanced methods for these types of linear systems  Block methods: block GMRES [Vital], block CG/BICG [O’Leary]  “Seed” solvers: hybrid GMRES [Nachtigal, et al.]  Recycling solvers: recycled Krylov methods [Parks, et al.]  Restarting techniques, orthogonalization techiques, …  Efficient R&D of advanced linear solution methods requires:  Interoperability  Extensibility  Reusability

Belos Design Design Goal: Create a linear solver library that: 1.Provides an abstract interface to an operator-vector products, scaling, and preconditioning. 2.Allows the user to enlist any linear algebra package for the elementary vector space operations essential to the algorithm. (Epetra, PETSc, Thyra, etc.) 3.Allows the user to define convergence of any algorithm (a.k.a. status testing). 4.Allows the user to determine the verbosity level, formatting, and processor for the output. 5.Allows for easier R&D of new solvers through “managers” using “iterations” as the basic kernels.

void iterationA.iterate() { … while ( statusTest.checkStatus(this)!= Passed ) { … % Compute operator-vector product linProb->applyOp( P, AP ); % Compute  = P T AP MVT::MvTransMv( 1.0, P, AP,  ); … % Orthonormalize new direction vectors int rank = orthoMgr->normalize( *P ); … outputMgr->print(Belos::Debug, “something”); } Generic Iteration Kernel Status Test Generic Operator Interface Generic MultiVector Interface Output Manager Linear Problem Orthogonalization Manager

void iterationA.iterate() { … while ( statusTest.checkStatus(this)!= Passed ) { … % Compute operator-vector product linProb->applyOp( P, AP ); % Compute  = P T AP MVT::MvTransMv( 1.0, P, AP,  ); … % Orthonormalize new direction vectors int rank = orthoMgr->normalize( *P ); … outputMgr->print(Belos::Debug, “something”); } Generic Solver Manager Belos::ReturnType solverMgrA.solve() { … … … } Generic Iteration Kernel Solution Strategy

Belos Classes  MultiVecTraits and OperatorTraits  Traits classes for interfacing linear algebra  LinearProblem Class  Describes the problem and stores the answer  OrthoManager Class  Provide basic interface for orthogonalization  StatusTest Class  Control testing of convergence, etc.  OutputManager Class  Control verbosity and printing in a MP scenario  Iteration Class  Provide basic linear solver iteration interface.  SolverManager Class  Parameter list driven strategy object describing behavior of solver

What’s in Trilinos 8.0

Linear Algebra Interface  Belos::MultiVecTraits  Interface to define the linear algebra required by most iterative linear solvers: creational methods dot products, norms update methods initialize / randomize  Implementations: MultiVecTraits MultiVecTraits >  Belos::OperatorTraits  Interface to enable the application of an operator to a multivector.  Implementations: OperatorTraits OperatorTraits,Thyra::LinearOpBase >

Linear Problem Interface  Provides an interface between the basic iterations and the linear problem to be solved.  Templated class Belos::LinearProblem  Allows preconditioning to be removed from the algorithm.  Behavior defined through traits mechanisms.  Methods: setOperator(…) / getOperator() setLHS(…) / getLHS() setRHS(…) / getRHS() setLeftPrec(…) / getLeftPrec() / isLeftPrec() setRightPrec(…) / getRightPrec() / isRightPrec() apply(…) / applyOp(…) / applyLeftPrec(…) / applyRightPrec(…) setHermitian(…) / isHermitian() setProblem(…)

Orthogonalization Manager  Abstract interface to orthogonalization / orthonormalization routines for multivectors.  Abstract base class Belos::[Mat]OrthoManager  void innerProd(…) const;  void norm(…) const;  void project(…) const;  int normalize(…) const;  int projectAndNormalize(…) const;  magnitudeType orthogError(…) const;  magnitudeType orthonormError(…) const;  Implementations:  Belos::DGKSOrthoManager  Belos::ICGSOrthoManager  Belos::IMGSOrthoManager

StatusTest Interface  Informs linear solver iteration of change in state, as defined by user.  Similar to NOX / AztecOO.  Multiple criterion can be logically connected.  Abstract base class Belos::StatusTest  TestStatus checkStatus( Iteration * iterate );  TestStatus getStatus() const;  void clearStatus();  void reset();  ostream& print( ostream& os, int indent = 0 ) const;  Implementations:  Belos::StatusTestMaxIters  Belos::StatusTestGenResNorm  Belos::StatusTestImpResNorm  Belos::StatusTestOutput  Belos::StatusTestCombo

Output Manager Interface  Templated class that enables control of the linear solver output.  Behavior defined through traits mechanism  Belos::OutputManager  Get/Set Methods: void setVerbosity( int vbLevel ); int getVerbosity( ); ostream& stream( MsgType type );  Query Methods: bool isVerbosity( MsgType type );  Print Methods: void print( MsgType type, const string output );  Message Types: Belos::Errors, Belos::Warnings, Belos::IterationDetails, Belos::OrthoDetails, Belos::FinalSummary, Belos::TimingDetails, Belos::StatusTestDetails, Belos::Debug  Default is lowest verbosity ( Belos::Errors ), output on one processor.

Iteration Interface  Provides an abstract interface to Belos basic iteration kernels.  Abstract base class Belos::Iteration  int getNumIters() const; void resetNumIters(int iter);  Teuchos::RCP getNativeResiduals( … ) const;  Teuchos::RCP getCurrentUpdate() const;  int getBlockSize() const; void setBlockSize(int blockSize);  const LinearProblem & getProblem() const;  void iterate(); void initialize();  Iterations require these classes:  Belos::LinearProblem  Belos::OutputManager  Belos::StatusTest  Belos::OrthoManager  Implementations:  Belos::BlockGmresIter  Belos::BlockFGmresIter  Belos::PseudoBlockGmresIter  Belos::GCRODRIter  Belos::CGIter,  Belos::BlockCGIter

Solver Manager  Provides an abstract interface to Belos solver managers  solver strategies  Abstract base class Belos::SolverManager  void setProblem(…); void setParameters(…);  const Belos::LinearProblem & getProblem() const;  Teuchos::RCP getValidParameters() const;  Teuchos::RCP getCurrentParameters() const;  Belos::ReturnType solve();  Solvers are parameter list driven, take two arguments:  Belos::LinearProblem  Teuchos::ParameterList [validated]  Implementations:  Belos::BlockGmresSolMgr  Belos::PseudoBlockGmresSolMgr  Belos::GCRODRSolMgr  Belos::BlockCGSolMgr

 Belos::BlockGmresSolMgr  Performs regular and flexible block GMRES  Block size can be greater than, or less than, the number of right-hand sides  Adaptive block size; no deflation  Belos::PseudoBlockGmresSolMgr  Single-vector simultaneous GMRES solves (block size)  Iteration performs block application of operator-vector products  Easier deflation strategy; “Deflation Quorum”  Belos::GCRODRSolMgr  Single-vector Krylov subspace recycling solver written by Mike Parks  Validates iteration kernel design by using Belos::BlockGmresIter  Belos::BlockCGSolMgr  Performs single-vector and block CG  Block size can be greater than, or less than, the number of right-hand sides  Adaptive block size, deflation Solver Manager Implementations

Examples

Block CG Example (belos/example/BlockCG/BlockCGEpetraExFile.cpp) #include "BelosConfigDefs.hpp" #include "BelosLinearProblem.hpp" #include "BelosEpetraAdapter.hpp" #include "BelosBlockCGSolMgr.hpp“ … int main(int argc, char *argv[]) { typedef Epetra_MultiVector MV; typedef Epetra_Operator OP; … // Create AX=B Teuchos::RCP A; Teuchos::RCP X; Teuchos::RCP B; … // Create parameter list Teuchos::ParameterList belosList; belosList.set( "Block Size", blocksize ); belosList.set( "Maximum Iterations", maxiters ); belosList.set( "Convergence Tolerance", tol ); if (verbose) { belosList.set( "Verbosity", Belos::Errors + Belos::Warnings + Belos::TimingDetails + Belos::FinalSummary + Belos::StatusTestDetails ); belosList.set( "Output Frequency", frequency ); } else belosList.set( "Verbosity", Belos::Errors + Belos::Warnings ); // Construct an unpreconditioned linear problem Belos::LinearProblem problem( A, X, B ); problem.setHermitian(); bool set = problem.setProblem(); // VERY IMPORTANT! if (set == false) { return -1; } // Create an iterative solver manager Belos::BlockCGSolMgr newSolver( rcp(&problem,false), rcp(&belosList,false) ); // Perform solve Belos::ReturnType ret = newSolver.solve(); if ( ret!=Belos::Converged ) { // Belos did not converge! return -1; }

Preconditioned Block CG Example (belos/example/BlockCG/BlockPrecCGEpetraExFile.cpp) #include "BelosConfigDefs.hpp" #include "BelosLinearProblem.hpp" #include "BelosEpetraAdapter.hpp" #include "BelosBlockCGSolMgr.hpp“ … int main(int argc, char *argv[]) { typedef Epetra_MultiVector MV; typedef Epetra_Operator OP; … // Create AX=B Teuchos::RCP A; Teuchos::RCP X; Teuchos::RCP B; … // Create parameter list Teuchos::ParameterList belosList; belosList.set( "Block Size", blocksize ); belosList.set( "Maximum Iterations", maxiters ); belosList.set( "Convergence Tolerance", tol ); if (verbose) { belosList.set( "Verbosity", Belos::Errors + Belos::Warnings + Belos::TimingDetails + Belos::FinalSummary + Belos::StatusTestDetails ); belosList.set( "Output Frequency", frequency ); } else belosList.set( "Verbosity", Belos::Errors + Belos::Warnings ); // Construct an SPD preconditioner M // Anything that supports OP interface can go here! Teuchos::RCP M; … // Construct a preconditioned linear problem Belos::LinearProblem problem( A, X, B ); problem.setHermitian(); if (leftprec) problem.setLeftPrec( M ); else problem.setRightPrec( M ); bool set = problem.setProblem(); // VERY IMPORTANT! if (set == false) { return -1; } // Create an iterative solver manager Belos::BlockCGSolMgr newSolver( rcp(&problem,false), rcp(&belosList,false) ); // Perform solve Belos::ReturnType ret = newSolver.solve(); if ( ret!=Belos::Converged ) { // Belos did not converge! return -1; }

Preconditioned Block GMRES Example (belos/example/BlockGmres/BlockPrecGmresEpetraExFile.cpp) #include "BelosConfigDefs.hpp" #include "BelosLinearProblem.hpp" #include "BelosEpetraAdapter.hpp" #include "BelosBlockGmresSolMgr.hpp" … int main(int argc, char *argv[]) { typedef Epetra_MultiVector MV; typedef Epetra_Operator OP; … // Create AX=B Teuchos::RCP A; Teuchos::RCP X; Teuchos::RCP B; … // Create parameter list Teuchos::ParameterList belosList; belosList.set( "Num Blocks", maxsubspace ); belosList.set( "Block Size", blocksize ); belosList.set( "Maximum Iterations", maxiters ); belosList.set( "Maximum Restarts", maxrestarts ); belosList.set( "Convergence Tolerance", tol ); if (verbose) { belosList.set( "Verbosity", Belos::Errors + Belos::Warnings + Belos::TimingDetails + Belos::FinalSummary + Belos::StatusTestDetails ); belosList.set( "Output Frequency", frequency ); } else belosList.set( "Verbosity", Belos::Errors + Belos::Warnings ); // Construct a preconditioner M // Anything that supports OP interface can go here! Teuchos::RCP M; … // Construct a preconditioned linear problem Belos::LinearProblem problem( A, X, B ); if (leftprec) problem.setLeftPrec( M ); else problem.setRightPrec( M ); bool set = problem.setProblem(); // VERY IMPORTANT! if (set == false) { return -1; } // Create an iterative solver manager Belos::BlockGmresSolMgr newSolver( rcp(&problem,false), rcp(&belosList,false) ); // Perform solve Belos::ReturnType ret = newSolver.solve(); if ( ret!=Belos::Converged ) { // Belos did not converge! if ( newSolver.isLOADetected() ) { // Convergence was impeded by a loss of accuracy } return -1; }

 Stratimikos:  Thyra-based linear solver and preconditioner strategy package MultiVecTraits > OperatorTraits,Thyra::LinearOpBase >  Belos-Thyra-Tpetra interface  Stratimikos-Belos Interface  Intent: access current Belos solver managers using a factory interface  Implements Thyra::LinearOpWithSolveFactory / Thyra::LinearOpWithSolve  Stratimikos interface uses valid parameter list generated from Belos  Check out: stratimikos/adapters/belos/example/LOWSFactory/[Epetra/Tpetra] Stratimikos-Belos Interface

What’s next for Belos?  Belos provides a powerful framework for developing robust linear solvers, but there’s more work to do …  Future Development:  More performance improvements  More advanced solution methods  Check out the Trilinos Tutorial:  See Belos website for more info: