Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves

Similar documents
Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves

Joint Advanced Student School 2007 Martin Dummer

Memory Efficient Adaptive Mesh Generation and Implementation of Multigrid Algorithms Using Sierpinski Curves

2-3 Tree. Outline B-TREE. catch(...){ printf( "Assignment::SolveProblem() AAAA!"); } ADD SLIDES ON DISJOINT SETS

COSC 2011 Section N. Trees: Terminology and Basic Properties

Multi-way Search Trees. (Multi-way Search Trees) Data Structures and Programming Spring / 25

Adaptive-Mesh-Refinement Pattern

Distributed Newest Vertex Bisection

HPC Algorithms and Applications

March 20/2003 Jayakanth Srinivasan,

Chapter 20: Binary Trees

Adaptive Mesh Refinement (AMR)

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li

Motivation for B-Trees

(2,4) Trees. 2/22/2006 (2,4) Trees 1

1. Meshes. D7013E Lecture 14

Parallel Adaptive Tsunami Modelling with Triangular Discontinuous Galerkin Schemes

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology

Spatial Data Structures

CSCI-401 Examlet #5. Name: Class: Date: True/False Indicate whether the sentence or statement is true or false.

Spatial Data Structures

Chapter 11: Indexing and Hashing

1 The range query problem

Module 4: Index Structures Lecture 13: Index structure. The Lecture Contains: Index structure. Binary search tree (BST) B-tree. B+-tree.

Space-Filling Curves An Introduction

CS24 Week 8 Lecture 1

Spatial Data Structures

THE B+ TREE INDEX. CS 564- Spring ACKs: Jignesh Patel, AnHai Doan

1 Leaffix Scan, Rootfix Scan, Tree Size, and Depth

Chapter 12: Indexing and Hashing. Basic Concepts

Algorithms. Deleting from Red-Black Trees B-Trees

CS350: Data Structures B-Trees

Physical Level of Databases: B+-Trees

Introduction to Multigrid and its Parallelization

Sustainability and Efficiency for Simulation Software in the Exascale Era

Chapter 12: Indexing and Hashing

12/5/17. trees. CS 220: Discrete Structures and their Applications. Trees Chapter 11 in zybooks. rooted trees. rooted trees

Scan Primitives for GPU Computing

Trees. Eric McCreath

CS 171: Introduction to Computer Science II. Binary Search Trees

Computational Geometry

Tree traversals and binary trees

Introduction to Indexing 2. Acknowledgements: Eamonn Keogh and Chotirat Ann Ratanamahatana

A Parallel Algorithm for Adaptive Local Refinement of Tetrahedral Meshes Using Bisection

Spatial Data Structures

LECTURE 11 TREE TRAVERSALS

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

B-Trees. Version of October 2, B-Trees Version of October 2, / 22

COMP 250 Winter 2010 Exercises 6 - trees March 2010

Computer Science 210 Data Structures Siena College Fall Topic Notes: Priority Queues and Heaps

Advanced 3D-Data Structures

CIS265/ Trees Red-Black Trees. Some of the following material is from:

Technische Universität München Fakultät für Informatik. Computational Science and Engineering (Int. Master s Program)

LPT Codes used with ROAM Splitting Algorithm CMSC451 Honors Project Joseph Brosnihan Mentor: Dave Mount Fall 2015

CS115 - Module 8 - Binary trees

B-KD Trees for Hardware Accelerated Ray Tracing of Dynamic Scenes

CSE 554 Lecture 5: Contouring (faster)

Advanced Tree Data Structures

Data Structures and Organization (p.5 Recursion. Binary Trees)

CS 350 : Data Structures B-Trees

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1

An Introduction to Trees

Trees. Tree Structure Binary Tree Tree Traversals

Lecture Notes for Advanced Algorithms

Embedding a Planar Graph using a PQ-Tree

Spring 2017 B-TREES (LOOSELY BASED ON THE COW BOOK: CH. 10) 1/29/17 CS 564: Database Management Systems, Jignesh M. Patel 1

Uses for Trees About Trees Binary Trees. Trees. Seth Long. January 31, 2010

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

Spatial Data Structures

Geometric data structures:

2-3 and Trees. COL 106 Shweta Agrawal, Amit Kumar, Dr. Ilyas Cicekli

Balanced Search Trees

Trees Algorhyme by Radia Perlman

Trees! Ellen Walker! CPSC 201 Data Structures! Hiram College!

Multigrid Pattern. I. Problem. II. Driving Forces. III. Solution

Sorted Arrays. Operation Access Search Selection Predecessor Successor Output (print) Insert Delete Extract-Min

University of Illinois at Urbana-Champaign Department of Computer Science. Second Examination

Trees. Q: Why study trees? A: Many advance ADTs are implemented using tree-based data structures.

Klima-Exzellenz in Hamburg

CS 231: Algorithmic Problem Solving

An iterative, octree-based algorithm for distance computation between polyhedra with complex surfaces 1

Decision trees. Decision trees are useful to a large degree because of their simplicity and interpretability

A more efficient way of finding Hamiltonian cycle

Trees and Tree Traversal

Multidimensional Indexes [14]

Lecture 8 13 March, 2012

Hidden Surface Elimination: BSP trees

Main Memory and the CPU Cache

Fundamental Algorithms

Trees. CSE 373 Data Structures

Quadtrees and Meshing

Ray Tracing with Spatial Hierarchies. Jeff Mahovsky & Brian Wyvill CSC 305

Binary Trees

Section 5.5. Left subtree The left subtree of a vertex V on a binary tree is the graph formed by the left child L of V, the descendents

Surface Parameterization

Binary Search Tree (3A) Young Won Lim 6/2/18

Graph Partitioning for High-Performance Scientific Simulations. Advanced Topics Spring 2008 Prof. Robert van Engelen

CS102 Binary Search Trees

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 10 Notes. Class URL:

Introduction to Mobile Robotics Techniques for 3D Mapping

Transcription:

Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves Daniel Butnaru butnaru@in.tum.de Advisor: Michael Bader bader@in.tum.de JASS 08 Computational Science and Engineering Technical University Munich March 13, 2008 Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 1 / 31

1 Motivation 2 Triangular Grids Grid generation Refinement Tree Storing the Refinement Tree 3 Sierpinski Curve Sierpinski Curve. Definition and Construction Grid Traversal along the Sierpinski Curve Stacks 4 Parallelization Tree Partitioning Nice Properties Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 2 / 31

Outline 1 Motivation 2 Triangular Grids Grid generation Refinement Tree Storing the Refinement Tree 3 Sierpinski Curve Sierpinski Curve. Definition and Construction Grid Traversal along the Sierpinski Curve Stacks 4 Parallelization Tree Partitioning Nice Properties Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 3 / 31

Motivation Domain Discretization In numerically solving a PDE usually (1): a grid is layed over the domain. if the domain has singularities or changes in time using an adaptive grid is a better choice. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 4 / 31

Motivation Iterative Solver In numerically solving an elliptic PDE usually (2): a solver iterates over the grid nodes neighborhood information is used to update the nodes the solver can traverse the grid in several ways, but depending on the traversal strategy and the grid structure neighborhood information can be easily computed or needs to be stored Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 5 / 31

Motivation Parallelization We can partition the grid and split the computational effort on several processors. Parallelization Requirements load balancing. Each processor should work on equally sized partitions. reduced inter-processor communication. Short boundaries between the partitions. Adaptive Grids Constraints fast repartioning avoid redistributing existing nodes to other processors. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 6 / 31

Outline 1 Motivation 2 Triangular Grids Grid generation Refinement Tree Storing the Refinement Tree 3 Sierpinski Curve Sierpinski Curve. Definition and Construction Grid Traversal along the Sierpinski Curve Stacks 4 Parallelization Tree Partitioning Nice Properties Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 7 / 31

Constructing a triangular grid: Triangular Grids Grid generation start with a triangular domain recursively split the triangle by bisection the hypothenuse is always marked for splitting (a) G 1 (b) G 2 (c) G 7 To adaptively refine call the recursive bisection on the desired triangle (local splitting): Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 8 / 31

Refinement Tree Representing the Grid as a Binary Tree (1) We can represent the refinement of the grid as a binary tree: the root corresponds to the initial domain. the children of any other node correspond to the elements that were created when that node was refined the leafs are the individual triangles in the last refinement. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 9 / 31

Refinement Tree Representing the Grid as a Binary Tree (2) Further example: the numbers show correspondence between triangles of the grid and tree nodes unlabeled nodes have the same numbers as in the grid above them. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 10 / 31

Refinement Tree Conforming Grid non-conforming Refining one triangle might need a cascade of refinements to avoid hanging nodes. conforming For numerical reasons avoid situations where neighbour elements share no common edge (causing hanging nodes). Refining the blue triangle triggers also a refinement of the red one. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 11 / 31

Storing the Refinement Tree Bit Vector Mark the nodes in the tree with a bit value. 1 if the node is refined and 0 otherwise. We can this way store the corresponding structure of the adaptive grid in a single bit vector. (d) 11100011110000100 An appropriate Depth First Traversal of the tree can give a sequential order of grid cells Sierpinski Curve. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 12 / 31

Outline 1 Motivation 2 Triangular Grids Grid generation Refinement Tree Storing the Refinement Tree 3 Sierpinski Curve Sierpinski Curve. Definition and Construction Grid Traversal along the Sierpinski Curve Stacks 4 Parallelization Tree Partitioning Nice Properties Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 13 / 31

Sierpinski Curve Space Filling Curves Definition If f : I R n is a continuous function and I R is compact then the image f (I) := {f (x) R x I} is called a curve. R 2 f * (I) Definition If f (I) is a curve and the area (volume in 3D) is positive ( 0), then the curve is called a space filling curve. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 14 / 31

Sierpinski Curve Construction To (intuitively) construct the curve: determine the curve for each small triangle connect the subcurves in the correct order Sierpinski Curve for several iterations: 1 2 3 7 Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 15 / 31

Grid Traversal along the Sierpinski Curve Tree Traversal as Grid Traversal Numerical algorithms need neighborhood information to evaluate stencils. Our refinement tree representation: does not easily allow getting the immediate neighbours would need a lot of memory to store these neighborhood relations Idea: traverse the grid triangle by triangle in the order given by the Sierpinski curve: two neighbours are easily available (DFS traversal) grid partitioning by curve partitioning leads to good partition quality for the other neighbours we could use the concept of stacks (introduced later) Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 16 / 31

Grid Traversal along the Sierpinski Curve Example of a Grid Traversal Example of a grid traversal, triangle by triangle. 3 4 In 1 2 6 5 7 8 9 Out Note that we don t need to explicitly construct the curve: use only the refinement tree fix the Depth First Search to go first to the left child. set the left and right children in a consistent manner Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 17 / 31

Grid Traversal along the Sierpinski Curve Splitting Template Consider a triangle template with marked input-vertex (I) and output-vertex (O). To identify the order of the children start at the input-vertex of the parent. O 1 I 1 I 2 O 3 I3 O 2 I O 0 0 After the bisection: the subtriangle which contains the input-vertex of the parent is the left child in the refinement tree. the subtriangle which contains the output-vertex of the parent is the right child the DFS traversal will now run along the Sierpinski curve Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 18 / 31

Grid Traversal along the Sierpinski Curve Stacks - Cache Efficient Processing (1) Cell Oriented Processing: process cells along the Sierpinski curve for each cell we need access to the unknowns (nodes) classify the unknowns. Left of the curve - Blue. Right of the curve - Red. 5 4 2 6 7 In 1 3 Out Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 19 / 31

Grid Traversal along the Sierpinski Curve Stacks - Cache Efficient Processing (2) Use a system of four stacks for fast and memory efficient access to unknowns: a read stack holds initial values of the unknowns two helper stacks - red and blue - to hold intermediary values write stack holds final values of the unknowns Processing: the 2 unknowns on common edge can be reused the 2 unknowns opposite to the common edge must be processed the top of the stacks will always have the unknowns needed to process the current triangle Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 20 / 31

Grid Traversal along the Sierpinski Curve Stacks - Cache Efficient Processing (3) Based on some rules we decide from which stack to take the needed unknowns and on which stack to put them on. 5 In 4 2 1 7 6 3 Out 4 1 blue red final 2 4 1 blue red final 2 5 1 4 blue red final 2 5 6 1 4 blue red final 7 2 5 6 1 4 blue red final 2 7 5 6 1 4 blue red final continues... Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 21 / 31

Outline 1 Motivation 2 Triangular Grids Grid generation Refinement Tree Storing the Refinement Tree 3 Sierpinski Curve Sierpinski Curve. Definition and Construction Grid Traversal along the Sierpinski Curve Stacks 4 Parallelization Tree Partitioning Nice Properties Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 22 / 31

Grid Partitioning Tree Partitioning In a parallel environment we can split the computational effort on several processors. Some observations: each of the processors should receive an equal slice of the grid. partitioning information can be handled globally and then sent to each processor adaptive refinement on a cell can lead to repartitioning processor inter-communication needed (when redistributing triangles) triangles need not necessarily require the same computational effort (like elements on the Dirichlet boundaries) node weights Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 23 / 31

Grid Partitioning REFTREE Algorithm Phase 1 REFTREE Algorithm Phase 1 (Labelling): 1 start with the refinement tree. 2 leaf nodes get a weight of 1, intermediary nodes 0. 3 each other node is labelled with the sum of the weights in the subtree rooted in that node. One Depth First Search is enough to label the entire tree (O(n)) Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 24 / 31

Grid Partitioning REFTREE Algorithm Phase 2 REFTREE Algorithm Phase 2 (Partitioning): 1 partition size P is cumulated sum at the root divided by number of processors 2 with a DFS examine the summed weights of the nodes. Initial sum S is 0. 3 consider the summed weight S n at node n Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 25 / 31

Grid Partitioning REFTREE Algorithm Phase 2 4 if S + S n P, add the the entire tree rooted in n to the partition. S = S + S n. 5 else if S + S n > P, continue with the subtrees of node n 6 stop when S = P One truncated Depth First Search is required to partition the entire tree. O(p log(n)) Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 26 / 31

Grid Partitioning Inter-Processor Communication for the pruning nodes (white) information will be exchanged each processor sends the weights it has for the pruning nodes all responses from other CPUs are summed up to give the weighted sum from the pruning points now each processor has enough information to perform another iteration. Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 27 / 31

REFTREE Algorithm Nice Properties Advantages of the REFTREE algorithm: produces almost equally sized partitions (with a difference of at most 1) creates connected partitions (for most of the used types of grids) fast enough not to affect the benefits of a fast multigrid solver after refining, the new partitions are similar to previous ones (reduces redistribution) Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 28 / 31

Wrap up Important points: Triangular grids created by recursive bisection grid can be represented and stored as a refinement tree Sierpinski Curve gives a linear traversal of the grid cells, thus simplifying storage In 4 5 2 7 1 6 3 Out Stacks add cache efficiency REFTREE algorithm is fast in creating equal and compact partitions using the refinement tree Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 29 / 31

References [Mitchell, 1991] William F. Mitchell. A refinement-tree based partitioning method for dynamic load balancing with adaptively refined grids [Bader, 2007] Bader, M., Schraufstetter, S., Vigh, C.A. and Behrens, J. Memory efficient adaptive mesh generation and implementation of multigrid algorithms using Sierpinski curves H. Sagen Space-filling Curves Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 30 / 31

Thank you! Questions? Parallelizing Adaptive Triangular Grids with Refinement Trees and Space Filling Curves March 13, 2008 31 / 31