Code Generation Tools for PDEs. Matthew Knepley PETSc Developer Mathematics and Computer Science Division Argonne National Laboratory



Similar documents
FEM Software Automation, with a case study on the Stokes Equations

Introduction to Engineering System Dynamics

Fast Multipole Method for particle interactions: an open source parallel library component

How High a Degree is High Enough for High Order Finite Elements?

Advanced Computational Software

Introduction Our choice Example Problem Final slide :-) Python + FEM. Introduction to SFE. Robert Cimrman

Implications for Library Developers of GPU Hardware

OpenFOAM Optimization Tools

Professional Organization Checklist for the Computer Science Curriculum Updates. Association of Computing Machinery Computing Curricula 2008

Division of Mathematical Sciences

EASTERN ARIZONA COLLEGE Differential Equations

Mesh Discretization Error and Criteria for Accuracy of Finite Element Solutions

Mathematical Libraries on JUQUEEN. JSC Training Course

Numerical Analysis. Professor Donna Calhoun. Fall 2013 Math 465/565. Office : MG241A Office Hours : Wednesday 10:00-12:00 and 1:00-3:00

Interactive simulation of an ash cloud of the volcano Grímsvötn

BookTOC.txt. 1. Functions, Graphs, and Models. Algebra Toolbox. Sets. The Real Numbers. Inequalities and Intervals on the Real Number Line

Bachelor of Games and Virtual Worlds (Programming) Subject and Course Summaries

Datavetenskapligt Program (kandidat) Computer Science Programme (master)

Mathematical Libraries and Application Software on JUROPA and JUQUEEN

FreeFem++-cs, the FreeFem++ Graphical Interface

MPI Hands-On List of the exercises

CS Machine Learning Identification of Duplicate Album Covers. Arrendondo, Brandon Jenkins, James Jones, Austin

NUMERICAL METHODS TOPICS FOR RESEARCH PAPERS

HPC enabling of OpenFOAM R for CFD applications

MayaVi: A free tool for CFD data visualization

A New Unstructured Variable-Resolution Finite Element Ice Sheet Stress-Velocity Solver within the MPAS/Trilinos FELIX Dycore of PISCEES

Using Oracle9i SCM for Software Configuration Management. An Oracle Technical White Paper July 2002

NIST/ITL CSD Biometric Conformance Test Software on Apache Hadoop. September National Institute of Standards and Technology (NIST)

An Overview of the Finite Element Analysis

CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler

Obfuscated Biology -MSc Dissertation Proposal- Pasupula Phaninder University of Edinburgh March 31, 2011

Schedule WRF model executions in parallel computing environments using Python

PARAMETRIC MODELING. David Rosen. December By carefully laying-out datums and geometry, then constraining them with dimensions and constraints,

Iterative Solvers for Linear Systems

Yousef Saad University of Minnesota Computer Science and Engineering. CRM Montreal - April 30, 2008

Software Modeling and Verification

Load balancing Static Load Balancing

Course Descriptions - Computer Science and Software Engineering

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

CS Matters in Maryland CS Principles Course

Experiences of numerical simulations on a PC cluster Antti Vanne December 11, 2002

Matlab and Simulink. Matlab and Simulink for Control

Load Balancing and Termination Detection

LEHMAN COLLEGE OF THE CITY UNIVERSITY OF NEW YORK DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE CURRICULUM CHANGE

CORRELATED TO THE SOUTH CAROLINA COLLEGE AND CAREER-READY FOUNDATIONS IN ALGEBRA

Dual Degree Agreement Computer Science / Applied Mathematics

How To Develop Software

Solved with COMSOL Multiphysics 4.3

Automatic Script Generation Based on User-System Interactions

Master of Science in Computer Science

Static vs. Dynamic. Lecture 10: Static Semantics Overview 1. Typical Semantic Errors: Java, C++ Typical Tasks of the Semantic Analyzer

Visualization of Adaptive Mesh Refinement Data with VisIt

GiPSi: An Open Source/Open Architecture Software Development Framework for Surgical Simulation

Introduction to the Finite Element Method

2. Advance Certificate Course in Information Technology

Oliver Röhrle Ulrich Rüde Barbara Wohlmuth. Garching, September 17/18, 2012

(Refer Slide Time: 2:03)

Modeling of Earth Surface Dynamics and Related Problems Using OpenFOAM

TWO-DIMENSIONAL FINITE ELEMENT ANALYSIS OF FORCED CONVECTION FLOW AND HEAT TRANSFER IN A LAMINAR CHANNEL FLOW

Design and Optimization of OpenFOAM-based CFD Applications for Hybrid and Heterogeneous HPC Platforms

Programming Languages & Tools

Finite Element Formulation for Beams - Handout 2 -

Doctor of Philosophy in Computer Science

How to Design and Create Your Own Custom Ext Rep

Improved metrics collection and correlation for the CERN cloud storage test framework

Web Services for Management Perl Library VMware ESX Server 3.5, VMware ESX Server 3i version 3.5, and VMware VirtualCenter 2.5

AN INTRODUCTION TO NUMERICAL METHODS AND ANALYSIS

Introduction to Linux and Cluster Basics for the CCR General Computing Cluster

Prepare the environment Practical Part 1.1

Dynamic Process Modeling. Process Dynamics and Control

Lab 7: Operational Amplifiers Part I

1 Finite difference example: 1D implicit heat equation

Numerical Algorithms Group. Embedded Analytics. A cure for the common code. Results Matter. Trust NAG.

Automated testing of CS UI using Selenium and Python

Arcane/ArcGeoSim, a software framework for geosciences simulation

Diploma Of Computing

Scalability evaluation of barrier algorithms for OpenMP

Input Output. 9.1 Why an IO Module is Needed? Chapter 9

SharePoint Integration Framework Developers Cookbook

ME6130 An introduction to CFD 1-1

G(s) = Y (s)/u(s) In this representation, the output is always the Transfer function times the input. Y (s) = G(s)U(s).

Parallel Programming for Multi-Core, Distributed Systems, and GPUs Exercises

Winter 2016 Course Timetable. Legend: TIME: M = Monday T = Tuesday W = Wednesday R = Thursday F = Friday BREATH: M = Methodology: RA = Research Area

Recovering Business Rules from Legacy Source Code for System Modernization

Parallel Computing using MATLAB Distributed Compute Server ZORRO HPC

Part I Courses Syllabus

Using Eclipse CDT/PTP for Static Analysis

AN APPROACH FOR SECURE CLOUD COMPUTING FOR FEM SIMULATION

Mathematics (MAT) MAT 061 Basic Euclidean Geometry 3 Hours. MAT 051 Pre-Algebra 4 Hours

Quality and Reliability in CFD

PARALLEL PROGRAMMING

Big Data: Rethinking Text Visualization

A PARALLEL GEOMETRIC MULTIGRID METHOD FOR FINITE ELEMENTS ON OCTREE MESHES

List of Problems Solved Introduction p. 1 Concept p. 1 Nodes p. 3 Elements p. 4 Direct Approach p. 5 Linear Spring p. 5 Heat Flow p.

Mathematical Modeling and Engineering Problem Solving

CS Standards Crosswalk: CSTA K-12 Computer Science Standards and Oracle Java Programming (2014)

Mesh Generation and Load Balancing

Algebra I Notes Relations and Functions Unit 03a

CHICAGO PUBLIC SCHOOLS (ILLINOIS) MATH & SCIENCE INITIATIVE COURSE FRAMEWORK FOR ALGEBRA Course Framework: Algebra

OpenFOAM Workshop. Yağmur Gülkanat Res.Assist.

Transcription:

Code Generation Tools for PDEs Matthew Knepley PETSc Developer Mathematics and Computer Science Division Argonne National Laboratory

Talk Objectives Introduce Code Generation Tools - Installation - Use - Customization Full Simulations - Simple input language (embedded in Python) - Customization - Simple Visualization Future Work

Motivation Many parts of a PDE simulation may be handled by a scripting language. However, for maximum effectiveness, the scripting language should be combined with code generation. FIAT - Element Construction FFC - Differential form manipulation PETSc 3 - Mesh interaction - Differential form integration - Operator assembly

Code Generation Tools

Bootstrap Install 1. Install BitKeeper from http://www.bitmover.com 2. Create a root directory, e.g. PETSc3 3. Install BuildSystem in PETSc3/sidl/BuildSystem cd PETSc3; mkdir sidl bk clone bk://sidl.bkbits.net/buildsystem sidl/buildsystem 4. Run the bootstrap installer./sidl/buildsystem/install/asebootstrap.py 5. Have beer and wait

General Install For a general PETSc3 package name, you need to: 1. Download the package cd PETSc3; mkdir type bk clone bk://type.bkbits.net/name type/name 2. Build the package cd PETSc3/type/name;./make.py options NOTE: Configure and build options are both given to make.py

What Can Our Tools Do? Parse text into an AST We can also create and AST using the API Ex. Parse SIDL into the ASE representation Ex. Parse C and Python implementation code Transform one AST into another Ex. Transform a SIDL AST into a C AST for wrapper methods Output text (source code) from an AST Ex. Pretty print implementation code with regenerated bindings

What is an AST? A tree structure encoding the syntatic information in an expression. We may then associate semantic information with individual nodes or the tree itself. For example, our Expression Trees represent arithmetic expressions, so that: Leaves represent variables or constants Internal nodes represent operations on the leaves Here is an example tree representing 1 x y - 1 + x y

More General Expressions We allow more general expression than arithmetic in order to incorporate matrix algebra and weak form expressions Here is another tree representing t, 1 2 ( u + u T ), / t + 2 trans u u

What is a Visitor? The Visitor is a common CS pattern that arises during tree traversal. We want to separate code for managing tree nodes from code to traverse and decorate the tree. Each Visitor has: A visitfoo(foo f) method for each node type Foo Each Node has: An accept(visitor v) method, which calls the appropriate visit method on v, passing itself Thus a traversal will bounce back and forth between the visitfoo methods in the visitor, and the accept methods in the nodes. Since these are generic, the nodes need never be recompiled or relinked when a new visitor is added. This is ideal for a slowly changing set of node types, and rapidly changing set of visitors.

Using the Parser In the ASE Compiler package, we have a sample parser. This may be used to verify that files can be parsed and the SIDL references can be resolved. testerparser.py -help testerparser.py -resolve=0 -language=sidl sidl/sidl.sidl testerparser.py -includes=[../runtime/sidl/ase.sidl] -language=sidl sidl/sidl.sidl testerparser.py -language=python server-python-sidl/ase/compiler/sidl/type impl.py testerparser.py -includedirs="{cxx:[../runtime/server-python-ase,server-python-sidl,client-python]}" -language=cxx server-python-sidl/ase/compiler/sidl/type IOR.c

Using the Generator The FEM package has a sample source code generator for finite element integration routines. The user can chooose any FIAT element type and degree, and the generator will provide C code with a Python wrapper, both in a shared library. sourcegenerator.py --help sourcegenerator.py --generationdirectory=test-cxx --degree=3 sourcegenerator.py --generationdirectory=test-cxx --element=nonconforming

AST Base Class The base class is ASE.Compiler.Vertex which supports tree traversal, the Visitor pattern, an identifier, and simple attributes. clone(), copy() get/setparent(), get/setchildren() accept() get/setidentifier() get/setattribute()

Node Classes A new language requires only a parser implementing to ASE.Compiler.Parser, a pretty printer implementing ASE.Compiler.Output, and a set of node classes. The node classes must override the accept() function from ASE.Compiler.Vertex and handle nay dat specific to the node.

Full Simulation

Input Language We have a simple text language for input, incorporating: Arithmetic, +, -, *, /, ˆ, () abs(x) Coordinate functions, cos(x) exp(x) Continuum fields (known and unknown) Dual pairing,, Matrix operations, trans(u) det(u) vec(u) Differential operators, grad(u) div(u) curl(u)

A Sample Simulator This sample simulator allows the user to choose a sample domain, an element type, and a problem type. The simulator then: parses the equation, boundary conditions, and exact solution constructs the dynamic finite element library meshes the given domain creates and assembles the linear algebra objects applies boundary conditions solves the algebraic problem visualizes the result checks the L 2 error of the solution

Using the Simulator The simulation can be carried out on a series of refined meshes. For the Laplace operator, alternative integration routines are also available. simulation.py Poisson --help simulation.py Poisson --refinementlevels=5 --visualize simulation.py Poisson --Lshaped --useferrari

Performance Dominant computational costs are incurred by optimized code Element integration Operator assembly (some variations) Nonlinear and Linear solve

Parallelism Dominant communication handled by PETSc Vec and Mat assembly Matvec Other communication handled by Python MPI Mesh element ghosting Vec ghosting (determination and updating)

Visualization I use MayaVi for visualizing the solution fields. It is a Python wrapper for the VTK graphics pipeline. I currently write VTK format files, but I could use it directly from Python as a library.