1 / 9

What is Teuchos (TEF-hos)?

Teuchos: Utilities for Developers & Users November 2 nd , 3:30-4:30pm Roscoe Bartlett Mike Heroux Kris Kampshoff Kevin Long Paul Sexton Heidi Thornquist.

kyna
Télécharger la présentation

What is Teuchos (TEF-hos)?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Teuchos: Utilities forDevelopers & Users November 2nd, 3:30-4:30pmRoscoe BartlettMike HerouxKris KampshoffKevin LongPaul SextonHeidi Thornquist 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.

  2. What is Teuchos (TEF-hos)? • Lightweight, portable utility package • What’s new? • First release in Trilinos 4.0 • Templated BLAS/LAPACK interface • Templated serial dense matrix / vector • Timing classes • Templated parameter list • Numeric traits mechanisms ( ordinal / scalar ) • Memory management: • Reference-counted pointers • Pre-allocated workspace • Exception handling • Command-line parsing • “Extended” utilities: • XML parsing • MPI communicators / traits Users Developers

  3. Parameters can be input and retrieved with templated “set” and “get” methods, as well as helper functions. • Parameter lists can be queried for attributes. • No mechanism for “smart” queries of tags. • Parameters can be input and retrieved with templated “set” and “get” methods, as well as helper functions. // Has a solver been chosen? bool solver_defined = My_List.isParameter(“Solver”); // Has a preconditioner been chosen? bool prec_defined = My_List.isSublist(“Preconditioner”); // Has a double-precision drop tolerance been chosen? (Helper function) bool drop_tol = Teuchos::isParameterType<double>(Prec_List, “Drop Tolerance”); // What if we use the wrong parameter name? bool solve_tol = My_List.isParameter(“tolerance”); // Empty parameter list Teuchos::ParameterList My_List; // Setting parameters My_List.set("Max Iters", 1550); My_List.set("Tolerance", 1e-10); My_List.set("Solver", "GMRES"); // Create sublist Teuchos::ParameterList& Prec_List = My_List.sublist("Preconditioner"); // Setting parameters in sublist Prec_List.set("Type", "ILU"); Prec_List.set("Drop Tolerance", 1e-3); ReturnType foo_solver( Teuchos::ParameterList& solverPL,… ) { // Getting parameters int max_iters = solverPL.template<int> get("Max Iters"); std::string solver = getParameter(solverPL, “Solver”) double tol = solverPL.get("Tolerance", 1e-8); // Get sublist ( same as making sublist ) Teuchos::ParameterList precPL = solverPL.sublist("Preconditioner"); … return Ok; } Templated Parameter List • Design based on NOX parameter list • Adopted by Amesos, ML, Ifpack, AztecOO, … • Parameters can be numeric datatypes, pointers to vectors or functions, and other parameter lists.

  4. Numeric Traits Mechanisms Genericprogramming technique that uses templated interfaces to define the standard behavior of datatypes. • Assumed: addition, subtraction, multiplication, and division • OrdinalTraits • zero & one • int & long int • ScalarTraits • zero, one, magnitude type, absolute value, conjugate, square root, random number generator, … • std::numeric_limits • float, double, complex<float>, and complex<double> • Required: none, a compile-time check is performed. • What about arbitrary precision arithmetic?

  5. Arbitrary Precision LibrariesARPREC & GNU MP • ARPREC (Bailey, et. al.) • uses arrays of 64-bit floating-point numbers to represent high-precision floating-point numbers. • provides support for datatypes with differing precision levels. • --enable-teuchos-arprec • GNU MP • uses fullwords, arbitrary precision mantissa, and limited precision exponent to represent high-precision floating-point numbers. • platform specific kernels written in assembly language perform common inner-loop functions. • provides support for datatypes with differing precision levels. • --enable-teuchos-gmp • Caveat: Arbitrary precision arithmetic is expensive, but can be used selectively to overcome numerical inaccuracy.

  6. Templated BLAS Interface • Basic Linear Algebra Subroutines (BLAS) • Robust, high-performance dense vector-vector, matrix-vector, and matrix-matrix routines. • Written in Fortran • Fast and efficient • Fortran is highly portable; however, the interface between it and C++ is platform-dependent • Templated C++ wrappers for the BLAS Fortran routines are created through autoconf. • Two main benefits of using a templated interface • Template Specialization: template specialization can be used to support the four native datatypes of existing Fortran BLAS code. • General Implementation: a generic C++ implementation can be created to handle many arbitrary datatypes.

  7. Templated LAPACK Interface • Linear Algebra PACKage (LAPACK) • Robust, high-performance dense routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems. • Templated C++ wrappers for the LAPACK Fortran routines are created for the four native datatypes. • no general implementations at this time • Templated serial dense matrix / vector class designed to be compatible with BLAS/LAPACK interfaces. • Fortran-style storage • Similar to Epetra_SerialDenseMatrix

  8. Timing Classes • Teuchos::Time • Basic wall-clock timing class • Teuchos::TimeMonitor • Uses Teuchos::Time internally • Constructor starts timer, destructor stops it • Can also maintain an array of timers Teuchos::Time timer(“My Timer”); timer.start(); … timer.stop(); double comp_time = timer.totalElapsedTime()

  9. Teuchos Users Overview • Parameter list is easy to use and quickly being adopted by most Trilinos packages. • Numeric traits mechanism allows the use of arbitrary datatypes in templated code. • Such arithmetic may be expensive, but the increased precision may be required for ill-conditioned problems • Arbitrary-precision arithmetic can be used in only the places where it is needed most in order to retain speed • Templated tools libraries are essential for the development of templated solver libraries. • See Teuchos website for more info: http://software.sandia.gov/Trilinos/packages/teuchos

More Related