Combining Trilinos Packages To Solve Linear Systems Michael A. Heroux Sandia National Labs.

Slides:



Advertisements
Similar presentations
Parallel Jacobi Algorithm Steven Dong Applied Mathematics.
Advertisements

Practical techniques & Examples
Advanced Computational Software Scientific Libraries: Part 2 Blue Waters Undergraduate Petascale Education Program May 29 – June
1 A Common Application Platform (CAP) for SURAgrid -Mahantesh Halappanavar, John-Paul Robinson, Enis Afgane, Mary Fran Yafchalk and Purushotham Bangalore.
Problem Uncertainty quantification (UQ) is an important scientific driver for pushing to the exascale, potentially enabling rigorous and accurate predictive.
8/23/ Trilinos Tutorial Overview and Basic Concepts Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated.
1 An Overview of Trilinos Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed.
CSCI 317 Mike Heroux1 Sparse Matrix Computations CSCI 317 Mike Heroux.
Avoiding Communication in Sparse Iterative Solvers Erin Carson Nick Knight CS294, Fall 2011.
Compositional Development of Parallel Programs Nasim Mahmood, Guosheng Deng, and James C. Browne.
PETSc Portable, Extensible Toolkit for Scientific computing.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
1 Web Based Interface for Numerical Simulations of Nonlinear Evolution Equations Ryan N. Foster & Thiab Taha Department of Computer Science The University.
Epetra Concepts Data management using Epetra Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation,
Introduction to Parallel Programming MapReduce Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and are licensed under.
8/22/ Trilinos Tutorial Overview and Basic Concepts Michael A. Heroux Sandia National Laboratories ACTS Toolkit Workshop 2006 Sandia is a multiprogram.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
What About Multicore? Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin.
Using Belos: Next-generation Iterative Solvers November 6 th, 2007 Using Belos: Next-generation Iterative Solvers November 6 th, 2007 Mike Heroux Rich.
CS 591x – Cluster Computing and Programming Parallel Computers Parallel Libraries.
1 Intel Mathematics Kernel Library (MKL) Quickstart COLA Lab, Department of Mathematics, Nat’l Taiwan University 2010/05/11.
Are their more appropriate domain-specific performance metrics for science and engineering HPC applications available then the canonical “percent of peak”
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
Integrating Trilinos Solvers to SEAM code Dagoberto A.R. Justo – UNM Tim Warburton – UNM Bill Spotz – Sandia.
Using PyTrilinos 2005 Trilinos Users Group Meeting 1 Nov :30-4:30 Bill Spotz.
PyTrilinos: A Python Interface to Trilinos Bill Spotz Sandia National Laboratories Reproducible Research in Computational Geophysics August 31, 2006.
Page 1 Trilinos Software Engineering Technologies and Integration Numerical Algorithm Interoperability and Vertical Integration –Abstract Numerical Algorithms.
Large-Scale Stability Analysis Algorithms Andy Salinger, Roger Pawlowski, Ed Wilkes Louis Romero, Rich Lehoucq, John Shadid Sandia National Labs Albuquerque,
Trilinos 101 (Part II) Creating and managing linear algebra data in Trilinos: Data management using Epetra and Teuchos Michael A. Heroux Sandia National.
Trilinos 101: Getting Started with Trilinos November 6, :30-9:30 a.m. Jim Willenbring Mike Heroux (Presenter)
Amesos Sparse Direct Solver Package Ken Stanley, Rob Hoekstra, Marzio Sala, Tim Davis, Mike Heroux Trilinos Users Group Albuquerque 3 Nov 2004.
(Business) Process Centric Exchanges
ML: Multilevel Preconditioning Package Trilinos User’s Group Meeting Wednesday, October 15, 2003 Jonathan Hu Sandia is a multiprogram laboratory operated.
6. Introduction to Spectral method. Finite difference method – approximate a function locally using lower order interpolating polynomials. Spectral method.
Solvers Made Easy (to use and use together) Thyra, Stratimikos, Handles and More... Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation.
PyTrilinos: a Python Interface to Selected Trilinos Packages Bill Spotz Trilinos Users Group Meeting November 2, 2004.
Amesos Sparse Direct Solver Package Tim Davis, Mike Heroux, Rob Hoekstra, Marzio Sala, Ken Stanley, Heidi Thornquist, Jim Willenbring Trilinos Users Group.
An Overview of Epetra Michael A. Heroux Sandia National Labs.
Amesos Interfaces to sparse direct solvers October 15, :30 – 9:30 a.m. Ken Stanley.
Scalable Linear Algebra Capability Area Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation,
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.
An Overview of Trilinos Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin.
1 Stratimikos Unified Wrapper to Trilinos Linear Solvers and Preconditioners Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation Sandia.
Epetra Tutorial Michael A. Heroux Sandia National Laboratories
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.
Trilinos 102: Advanced Concepts November 7, :30-9:30 a.m. Mike Heroux Jim Willenbring.
Domain Decomposition in High-Level Parallelizaton of PDE codes Xing Cai University of Oslo.
Introducing Tpetra and Kokkos Chris Baker/ORNL TUG 2009 November CSRI.
Thyra For Developers Roscoe A. Bartlett Department of Optimization & Uncertainty Estimation Sandia National Laboratories Trilinos Users Group Meeting (Developers.
Linear Algebra Libraries: BLAS, LAPACK, ScaLAPACK, PLASMA, MAGMA
An Overview of Belos and Anasazi October 16 th, 11-12am Heidi Thornquist Teri Barth Rich Lehoucq Mike Heroux Computational Mathematics and Algorithms Sandia.
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.
1 Spring 2003 Prof. Tim Warburton MA557/MA578/CS557 Lecture 34.
ML: A Multilevel Preconditioning Package Copper Mountain Conference on Iterative Methods March 29-April 2, 2004 Jonathan Hu Ray Tuminaro Marzio Sala Sandia.
An Overview of Meros Trilinos User’s Group Wednesday, November 2, 2005 Victoria Howle Computational Sciences and Mathematics Research Department (8962)
What’s New for Epetra Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin.
Trilinos Overview and Future Plans Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation, a.
A Parallel Hierarchical Solver for the Poisson Equation Seung Lee Deparment of Mechanical Engineering
Multipole-Based Preconditioners for Sparse Linear Systems. Ananth Grama Purdue University. Supported by the National Science Foundation.
1 Scientific Software Ecosystems Michael A. Heroux Sandia National Laboratories Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed.
DOE/Office of Science/ASCR (Sandia National Laboratories)
Xing Cai University of Oslo
Meros: Software for Block Preconditioning the Navier-Stokes Equations
Trilinos Software Engineering Technologies and Integration
Supported by the National Science Foundation.
Introduction to parallelism and the Message Passing Interface
Ph.D. Thesis Numerical Solution of PDEs and Their Object-oriented Parallel Implementations Xing Cai October 26, 1998.
Presentation transcript:

Combining Trilinos Packages To Solve Linear Systems Michael A. Heroux Sandia National Labs

Epetra User Class Categories  Sparse Matrices: RowMatrix, (CrsMatrix, VbrMatrix, FECrsMatrix, FEVbrMatrix)  Linear Operator:Operator: (AztecOO, ML, Ifpack)  Dense Matrices:DenseMatrix, DenseVector, BLAS, LAPACK, SerialDenseSolver  Vectors: Vector, MultiVector  Graphs:CrsGraph  Data Layout: Map, BlockMap, LocalMap  Redistribution:Import, Export, LbGraph, LbMatrix  Aggregates: LinearProblem  Parallel Machine: Comm, (SerialComm, MpiComm, MpiSmpComm)  Utilities: Time, Flops

Matrix Class Inheritance Details CrsMatrix and VbrMatrix inherit from: Distributed Object: How data is spread across machine. Computational Object: Performs FLOPS. BLAS: Use BLAS kernels. RowMatrix: An object from either class has a common row access interface (used by AztecOO).

LinearProblem Class  A linear problem is defined by:  Matrix A : An Epetra_RowMatrix or Epetra_Operator object. (often a CrsMatrix or VbrMatrix object.)  Vectors x, b : Vector objects.  To call AztecOO, first define a LinearProblem:  Constructed from A, x and b.  Once defined, can: Scale the problem (explicit preconditioning). Precondition it (implicitly). Change x and b.

AztecOO  Aztec is the workhorse solver at Sandia:  Extracted from the MPSalsa reacting flow code.  Installed in dozens of Sandia apps.  external licenses.  AztecOO leverages the investment in Aztec:  Uses Aztec iterative methods and preconditioners.  AztecOO improves on Aztec by:  Using Epetra objects for defining matrix and RHS.  Providing more preconditioners/scalings.  Using C++ class design to enable more sophisticated use.  AztecOO interfaces allows:  Continued use of Aztec for functionality.  Introduction of new solver capabilities outside of Aztec.

A Simple Epetra/AztecOO Program // Header files omitted… int main(int argc, char *argv[]) { MPI_Init(&argc,&argv); // Initialize MPI, MpiComm Epetra_MpiComm Comm( MPI_COMM_WORLD ); // ***** Create x and b vectors ***** Epetra_Vector x(Map); Epetra_Vector b(Map); b.Random(); // Fill RHS with random #s // ***** Create an Epetra_Matrix tridiag(-1,2,-1) ***** Epetra_CrsMatrix A(Copy, Map, 3); double negOne = -1.0; double posTwo = 2.0; for (int i=0; i<NumMyElements; i++) { int GlobalRow = A.GRID(i); int RowLess1 = GlobalRow - 1; int RowPlus1 = GlobalRow + 1; if (RowLess1!=-1) A.InsertGlobalValues(GlobalRow, 1, &negOne, &RowLess1); if (RowPlus1!=NumGlobalElements) A.InsertGlobalValues(GlobalRow, 1, &negOne, &RowPlus1); A.InsertGlobalValues(GlobalRow, 1, &posTwo, &GlobalRow); } A.FillComplete(); // Transform from GIDs to LIDs // ***** Map puts same number of equations on each pe ***** int NumMyElements = 1000 ; Epetra_Map Map(-1, NumMyElements, 0, Comm); int NumGlobalElements = Map.NumGlobalElements(); // ***** Report results, finish *********************** cout << "Solver performed " << solver.NumIters() << " iterations." << endl << "Norm of true residual = " << solver.TrueResidual() << endl; MPI_Finalize() ; return 0; } // ***** Create/define AztecOO instance, solve ***** AztecOO solver(problem); solver.SetAztecOption(AZ_precond, AZ_Jacobi); solver.Iterate(1000, 1.0E-8); // ***** Create Linear Problem ***** Epetra_LinearProblem problem(&A, &x, &b);

AztecOO Extensibility  AztecOO is designed to accept externally defined:  Operators (both A and M): The linear operator A is accessed as an Epetra_Operator. Users can register a preconstructed preconditioner as an Epetra_Operator.  RowMatrix: If A is registered as a RowMatrix, Aztec’s preconditioners are accessible. Alternatively M can be registered separately as an Epetra_RowMatrix, and Aztec’s preconditioners are accessible.  StatusTests: Aztec’s standard stopping criteria are accessible. Can override these mechanisms by registering a StatusTest Object.

AztecOO understands Epetra_Operator Epetra_Operator Methods Documentation  AztecOO is designed to accept externally defined:  Operators (both A and M).  RowMatrix (Facilitates use of AztecOO preconditioners with external A).  StatusTests (externally- defined stopping criteria).

AztecOO Understands Epetra_RowMatrix Epetra_RowMatrix Methods

AztecOO UserOp/UserMat Recursive Call Example Trilinos/packages/aztecoo/example/AztecOO_RecursiveCall 1. Poisson2dOperator A(nx, ny, comm); // Generate nx by ny Poisson operator 2. Epetra_CrsMatrix * precMatrix = A.GeneratePrecMatrix(); // Build tridiagonal approximate Poisson 3. Epetra_Vector xx(A.OperatorDomainMap()); // Generate vectors (xx will be used to generate RHS b) 4. Epetra_Vector x(A.OperatorDomainMap()); 5. Epetra_Vector b(A.OperatorRangeMap()); 6. xx.Random(); // Generate exact x and then rhs b 7. A.Apply(xx, b); 8. // Build AztecOO solver that will be used as a preconditioner 9. Epetra_LinearProblem precProblem; 10. precProblem.SetOperator(precMatrix); 11. AztecOO precSolver(precProblem); 12. precSolver.SetAztecOption(AZ_precond, AZ_ls); 13. precSolver.SetAztecOption(AZ_output, AZ_none); 14. precSolver.SetAztecOption(AZ_solver, AZ_cg); 15. AztecOO_Operator precOperator(&precSolver, 20); 16. Epetra_LinearProblem problem(&A, &x, &b); // Construct linear problem 17. AztecOO solver(problem); // Construct solver 18. solver.SetPrecOperator(&precOperator); // Register Preconditioner operator 19. solver.SetAztecOption(AZ_solver, AZ_cg); 20. solver.Iterate(Niters, 1.0E-12);

Ifpack/AztecOO Example Trilinos/packages/aztecoo/example/IfpackAztecOO 1. // Assume A, x, b are define, LevelFill and Overlap are specified 2. Ifpack_IlukGraph IlukGraph(A.Graph(), LevelFill, Overlap); 3. IlukGraph.ConstructFilledGraph(); 4. Ifpack_CrsRiluk ILUK (IlukGraph); 5. ILUK.InitValues(A); 6. assert(ILUK->Factor()==0); // Note: All Epetra/Ifpack/AztecOO method return int err codes 7. double Condest; 8. ILUK.Condest(false, Condest); // Get condition estimate 9. if (Condest > tooBig) { 10. ILUK.SetAbsoluteThreshold(Athresh); 11. ILUK.SetRelativeThreshold(Rthresh); 12. Go back to line 4 and try again 13. } 14. Epetra_LinearProblem problem(&A, &x, &b); // Construct linear problem 15. AztecOO solver(problem); // Construct solver 16. solver.SetPrecOperator(&ILUK); // Register Preconditioner operator 17. solver.SetAztecOption(AZ_solver, AZ_cg); 18. solver.Iterate(Niters, 1.0E-12); 19.// Once this linear solutions complete and the next nonlinear step is advanced, 20.// we will return to the solver, but only need to execute steps 4 on down…

Multiple Stopping Criteria  Possible scenario for stopping an iterative solver:  Test 1: Make sure residual is decreased by 6 orders of magnitude. And  Test 2: Make sure that the inf-norm of true residual is no more 1.0E-8. But  Test 3: do no more than 200 iterations.  Note: Test 1 is cheap. Do it before Test 2.

AztecOO StatusTest classes  AztecOO_StatusTest:  Abstract base class for defining stopping criteria.  Combo class: OR, AND, SEQ AztecOO_StatusTest Methods

AztecOO/StatusTest Example Trilinos/packages/aztecoo/example/AztecOO 1. // Assume A, x, b are define 2.Epetra_LinearProblem problem(&A, &x, &b); // Construct linear problem 3. AztecOO solver(problem); // Construct solver 4.AztecOO_StatusTestResNorm restest1(A, x, bb, 1.0E-6); 5.restest1.DefineResForm(AztecOO_StatusTestResNorm::Implicit, AztecOO_StatusTestResNorm::TwoNorm); 6.restest1.DefineScaleForm(AztecOO_StatusTestResNorm::NormOfInitRes, AztecOO_StatusTestResNorm::TwoNorm); 7.AztecOO_StatusTestResNorm restest2(A, x, bb, 1.0E-8); 8.restest2.DefineResForm(AztecOO_StatusTestResNorm::Explicit, AztecOO_StatusTestResNorm::InfNorm); 9.restest2.DefineScaleForm(AztecOO_StatusTestResNorm::NormOfRHS, AztecOO_StatusTestResNorm::InfNorm); 10.AztecOO_StatusTestCombo comboTest1(AztecOO_StatusTestCombo::SEQ, restest1, restest2); 11.AztecOO_StatusTestMaxIters maxItersTest(200); 12.AztecOO_StatusTestCombo comboTest2(AztecOO_StatusTestCombo::OR, maxItersTest1, comboTest1); 13.solver.SetStatusTest(&comboTest2); 14. solver.SetAztecOption(AZ_solver, AZ_cg); 15. solver.Iterate(Niters, 1.0E-12);

Summary  Trilinos packages are designed to interoperate.  Next generation linear solver packages are under development: Tpetra, TSF packages, Belos, Ifpack 3.0  AztecOO is the production “manager” class.  Flexibility comes from abstract base classes:  Epetra_Operator: All Epetra matrix classes implement. Best way to define A and M when coefficient info not needed.  Epetra_RowMatrix: All Epetra matrix classes implement. Best way to define A and M when coefficient info is needed.  AztecOO_StatusTest: A suite of parametrized status tests. An abstract interface for users to define their own. Ability to combine tests for sophisticated control of stopping.