Data Partitioning. Figure 1-31: Communication Topologies. Regular Partitions

Similar documents
Lecture 3: Sorting 1

Parallel Computing. Slides credit: M. Quinn book (chapter 3 slides), A Grama book (chapter 3 slides)

Introduction to Indexing R-trees. Hong Kong University of Science and Technology

(Refer Slide Time: 00:02:00)

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

6. Parallel Volume Rendering Algorithms

Egemen Tanin, Tahsin M. Kurc, Cevdet Aykanat, Bulent Ozguc. Abstract. Direct Volume Rendering (DVR) is a powerful technique for

Topological Issues in Hexahedral Meshing

1. Meshes. D7013E Lecture 14

Lecture 13. Lecture 13: B+ Tree

Lecture 3: Art Gallery Problems and Polygon Triangulation

Adaptive-Mesh-Refinement Pattern

Principle Of Parallel Algorithm Design (cont.) Alexandre David B2-206

Parallel Systems Course: Chapter VIII. Sorting Algorithms. Kumar Chapter 9. Jan Lemeire ETRO Dept. Fall Parallel Sorting

Seminar on. A Coarse-Grain Parallel Formulation of Multilevel k-way Graph Partitioning Algorithm

Parallel Systems Course: Chapter VIII. Sorting Algorithms. Kumar Chapter 9. Jan Lemeire ETRO Dept. November Parallel Sorting

CS301 - Data Structures Glossary By

Aston Hall s A-Z of mathematical terms

Lecture 8 Parallel Algorithms II

Number/Computation. addend Any number being added. digit Any one of the ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9

Sorting Algorithms. Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar

Some Open Problems in Graph Theory and Computational Geometry

Prime Time (Factors and Multiples)

Lecture 9: Group Communication Operations. Shantanu Dutt ECE Dept. UIC

CS 6143 COMPUTER ARCHITECTURE II SPRING 2014

Algorithms and Applications

Basic Communication Operations Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar

CSC 447: Parallel Programming for Multi- Core and Cluster Systems

6th Grade Math. Parent Handbook

CMSC 754 Computational Geometry 1

CS 664 Segmentation. Daniel Huttenlocher

Chapter 4. Clustering Core Atoms by Location

Planar Point Location

having any value between and. For array element, the plot will have a dot at the intersection of and, subject to scaling constraints.

Cost Models for Query Processing Strategies in the Active Data Repository

CSIT5300: Advanced Database Systems

Mathematics Curriculum

Lecture 4: Principles of Parallel Algorithm Design (part 4)

Multi-Domain Pattern. I. Problem. II. Driving Forces. III. Solution

An Implementation of a Near-Linear Polygon Triangulation Algorithm for General Polygons

Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves

FIGURE 3. Two-Level Internet Address Structure. FIGURE 4. Principle Classful IP Address Formats

1 Introduction. Counting with Cubes. Barringer Winter MathCamp, 2016

Design of Parallel Algorithms. Models of Parallel Computation

Question Bank Subject: Advanced Data Structures Class: SE Computer

CS 614 COMPUTER ARCHITECTURE II FALL 2005

Matrix Multiplication on an Experimental Parallel System With Hybrid Architecture

Treewidth and graph minors

would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the inp

Basic Idea. The routing problem is typically solved using a twostep

CS256 Applied Theory of Computation

Physically-Based Laser Simulation

Scalable Algorithmic Techniques Decompositions & Mapping. Alexandre David

XVIII Open Cup named after E.V. Pankratiev Stage 1: Grand Prix of Romania, Sunday, September 17, 2017

SHARED MEMORY VS DISTRIBUTED MEMORY

CTI, November 19, 2015

Analysis of Algorithms

File Structures and Indexing

HPC Algorithms and Applications

Solutions to Problem 1 of Homework 3 (10 (+6) Points)

Physical Level of Databases: B+-Trees

UNIVERSITY OF WATERLOO Faculty of Mathematics

2 + (-2) = 0. Hinojosa 7 th. Math Vocabulary Words. Unit 1. Word Definition Picture. The opposite of a number. Additive Inverse

6LPXODWLRQÃRIÃWKHÃ&RPPXQLFDWLRQÃ7LPHÃIRUÃDÃ6SDFH7LPH $GDSWLYHÃ3URFHVVLQJÃ$OJRULWKPÃRQÃDÃ3DUDOOHOÃ(PEHGGHG 6\VWHP

Polyominoes and Polyiamonds as Fundamental Domains for Isohedral Tilings of Crystal Class D 2

Polyominoes and Polyiamonds as Fundamental Domains for Isohedral Tilings of Crystal Class D 2

Common Core Vocabulary and Representations

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1

Dynamic Load Partitioning Strategies for Managing Data of Space and Time Heterogeneity in Parallel SAMR Applications

3 Identify shapes as two-dimensional (lying in a plane, flat ) or three-dimensional ( solid ).

Introduction VLSI PHYSICAL DESIGN AUTOMATION

6 Mathematics Curriculum

Ray Tracing Acceleration Data Structures

TELCOM2125: Network Science and Analysis

Geometry Geometry Grade Grade Grade

Indexing. Week 14, Spring Edited by M. Naci Akkøk, , Contains slides from 8-9. April 2002 by Hector Garcia-Molina, Vera Goebel

Figure 4.1: The evolution of a rooted tree.

Revised Sheet Metal Simulation, J.E. Akin, Rice University

COMP3121/3821/9101/ s1 Assignment 1

1 The range query problem

Sorting (Chapter 9) Alexandre David B2-206

Network-on-chip (NOC) Topologies

Glossary Common Core Curriculum Maps Math/Grade 6 Grade 8

Abstract. Die Geometry. Introduction. Mesh Partitioning Technique for Coextrusion Simulation

6. Algorithm Design Techniques

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

Computer Science 4U Unit 1. Programming Concepts and Skills Algorithms

CSCI2100B Data Structures Trees

Interconnection Networks: Topology. Prof. Natalie Enright Jerger

UNIVERSITY OF CALGARY. Subdivision Surfaces. Advanced Geometric Modeling Faramarz Samavati

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18

II (Sorting and) Order Statistics

Topologies. Maurizio Palesi. Maurizio Palesi 1

Appendix 14C: TIMSS 2015 Eighth Grade Mathematics Item Descriptions Developed During the TIMSS 2015 Benchmarking

We can use a max-heap to sort data.

On The Complexity of Virtual Topology Design for Multicasting in WDM Trees with Tap-and-Continue and Multicast-Capable Switches

The divide-and-conquer paradigm involves three steps at each level of the recursion: Divide the problem into a number of subproblems.

Intensity Transformations and Spatial Filtering

Patterns for! Parallel Programming!

Lecture 25: Bezier Subdivision. And he took unto him all these, and divided them in the midst, and laid each piece one against another: Genesis 15:10

Transcription:

Data In single-program multiple-data (SPMD) parallel programs, global data is partitioned, with a portion of the data assigned to each processing node. Issues relevant to choosing a partitioning strategy include: Load Imbalance Overhead A time cost is incurred whenever some nodes are kept idle while they wait for others to finish a task. Therefore, try to distribute the computational work evenly among the nodes. Communication Overhead Internode communication is often required for carrying out computations on partitioned data. Each internode message requires, at both the sending and the receiving nodes, a certain startup time plus a time proportional to the length of the message. In addition, each message incurs a latency which can exacerbate load imbalance. Therefore, try to minimize the communication-to-computation ratio. Programming Complexity The algorithms used to compute data partitions vary in the amount of programmer effort they require. Library routines are available for partitioning regular data structures. Custom routines may be required for irregular structures. In general, the more complex the partitioning algorithm, the better the resulting load balance and communication efficiency. In certain applications tracking or simulating complex systems, for example the distribution of computational work among the nodes can evolve, resulting in load imbalance. In some cases, adaptive repartitioning of the data may be required. In many algorithms, only elements near each other in the data structure enter into any single computational step. Schemes for the numerical solution of differential equations are often of this type. At every iteration, each entry in the data matrix is updated, based only on its own current value and the values of neighboring entries. In programs that perform computations only on neighboring data, internode communication typically occurs across the common boundaries of adjacent regions of the partitioned data. The distributed data structure is then characterized not only by the amount and internal organization of the data in each region, but also by the topology of the communication network that links adjacent regions across their common boundaries. Figure 1-31 shows two ways to partition a two-dimensional region, and the resulting communication topologies. Data 50

Figure 1-31: Communication Topologies 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 7 1 6 2 4 5 3 0 1 2 7 5 4 6 3 Global computations on distributed data often exploit a particular topology of message-passing links. In particular, sequential algorithms based on the principle of divide-and-conquer can often be made parallel using a tree topology. Common tree structures and algorithms based on them are discussed in the Trees section, below. Sometimes, partitioning can be avoided altogether. For instance, an array that is read often but seldom written can be copied onto each node. Any time a write is performed, all the nodes must be notified, in order to maintain data coherency. Data Partitioning Several approaches are available for partitioning a global data set among nodes. An appropriate choice in any particular case depends on the nature of the data and the computations to be performed on it. In general, simpler partitioning strategies apply to well-defined problem types, while more complex strategies can apply to a wider range of problems. The next few sections discuss a variety of strategies, in order of increasing complexity. Regular Partitions A data set with a particularly simple inherent geometry multidimensional arrays are a common example can be partitioned among nodes in a regular, repeating pattern. Matrices, for instance, can be divided up by row, by column, or by block, as illustrated in Figure 1-32: Data 51

Figure 1-32: Regular Partitioning By Row By Column By Block Of these three approaches, partitioning by block is often preferred when only elements near each other in the data structure enter into any single computational step. Such computations require interprocessor communication only along partition boundaries. Since the block partition creates a smaller total boundary-length (4 units, in the figure) than the other approaches (8 units), it has the smallest communication-to-computation ratio. The blocks of a partitioned array can be mapped onto the hypercube nodes simply and efficiently using gray codes. Each block (subarray) of data is assigned a code number that differs by only one bit from the code assigned to any of its neighbors, as shown in Figure 1-33: Figure 1-33: Gray Code Mapping 1 (001) 5 (101) 3 (011) 7 (111) 2 (010) 6 (110) 0 (000) 4 (100) The nodes of the ncube 2 hypercube have gray-code hardware addresses; nearest neighbors have processor ID (PID) numbers that differ only in a single bit. Once the data blocks have been assigned gray code numbers, each block is downloaded to the node whose PID matches (in its low-order bits) the code number of the block. In this way, the mesh communication topology Data 52

of the block-partitioned array is mapped into the hypercube topology so that neighboring data blocks always reside on neighboring nodes. This maximizes the data communication speed between nodes. Setting up a regular partition requires very little computational effort. A regular partition establishes a simple, mesh-like communications topology which is easily mapped into the hypercube with library routines. In many applications, however, regular partitioning can result in a load imbalance. Regular partitioning is useful primarily for problems in which all the data is subject to the same (or similar) computations. For example, consider a scheme for approximating a solution to a differential equation using a simple recurrence relation. In any iteration, the amount of computational work required for each entry in the data matrix is the same. In the case of an airflow simulation, a regular partition might divide the space into equal rectangular prisms. This is a good strategy for simulating a quiet volume, such as a wind-tunnel with uniform flow, where the air density and pressure are reasonably uniform. Each partition in this three-dimensional world would have only six neighbors. The small surface-area-to-volume ratio of the partitions would keep communication overhead low. If a jet engine were placed in the room, however, the resulting load imbalance would be intolerable. The air inside a rectangular prism close to the engine would require much more computation than the air in a prism of the same size in a corner of the room. In some applications, the computational work required to process a global data object is concentrated in certain locations of the data, but it is not known in advance which locations those will be. In a numerical integration scheme, for example, the evaluation of the function to be integrated may be more difficult in some regions than in others. In such cases, a regular partition can be used to enhance load balance by maximizing the dispersion of data. The diagram below represents the partition of a long vector (with 12,000 components) among four nodes, with no node being required to process any more than 100 contiguous entries. In this way, computationally intensive clusters of data (on the order of a few hundred components in length) will be dispersed evenly among the processors. (See Figure 1-34.) Figure 1-34: Maximum Dispersion Components 0-99 100-199 200-299 300-399 400-499 500-599 600-699 700-799 etc. Node Assignment 0 1 2 3 0 1 2 3 Data 53

Irregular Partitions Simple irregular partitions can sometimes be used when a regular partition would cause too great a load imbalance. In the airflow simulation, for example, the room could be divided up with a collection of horizontal planes of varying vertical distances from each other. The data and computations for each of the resulting slices is assigned to a different node. The slices will be thin where they contain part of the jet and thick where there is relatively little air movement. (See Figure 1-35.) Figure 1-35: Irregular Partition To compute such a partition, you would first estimate the density of computational work as a function of height, using either past experience or the physics of the problem. The height axis is then subdivided into the same number of intervals as there are nodes, in such a way that the computational work (the area under the density graph) is the same in each interval. (See Figure 1-36.) Data 54

Figure 1-36: Computation vs. Height Relative Density of Computational Height Above In the resulting partition, each region has only two neighbors. However, each of the boundaries has a very large surface area, creating communication overhead: the larger the surface area of a region, the greater the chance that a particle will cross the boundary and require internode communication. In general, the more complex the partitioning algorithm, the better the resulting load balance and communication efficiency. For each program, you must decide where the optimal trade-off between complexity and performance lies. Using arbitrarily shaped regions with low surface-area-to-volume ratios, you could in principle balance the computational load while minimizing communication overhead. This general optimization problem, however, is computationally intractable (NP-complete). Calculating even a near-optimal partition generally requires a great deal of computational effort. Another drawback of such a strategy is that the resulting communication topology may be highly irregular each node could have any number of neighbors, for example making communication routines difficult to program. There are partitioning methods of intermediate complexity. After dividing an area into bands of varying thickness, for example, one could go further, and subdivide each slice. A two dimensional area partitioned in such a way would look like Figure 1-37: Data 55

Figure 1-37: Two-Dimensional Irregular Partition. Such a partition is relatively easy to compute. It entails a slightly greater complexity in the communication network than is required for the simple partition into bands, however. Each region has exactly one right and one left neighbor, but a variable number of neighbors above and below. Each program element must therefore maintain a map of its upper and lower boundaries, showing which boundary communications must be directed to which neighbor. Other partitioning methods can be found. There is, for example, nothing sacrosanct about rectangular subregions. Efficient algorithms exist for dividing a large rectangle into triangular regions in such a way that: The regions are smaller and more numerous where the computational load is greatest. You must specify the distribution of computational work throughout the original rectangle as input data for the algorithm. The regions are not long and thin. A reasonable boundary-to-interior ratio must be maintained, so as to minimize communication overhead. Figure 1-38 illustrates an area partitioned using a method called Delaney triangulation. The computational load is concentrated in the middle left. Data 56

Figure 1-38: Delaney-Triangulated Rectangle Communication is usually simple in such a partition, since each region has exactly three neighbors along its edges. On the other hand, any message that has to pass through a vertex of one of the triangles requires special handling, since the number of regions sharing a vertex can be arbitrarily large. Algorithms for decomposing a three dimensional space into tetrahedra also exist, but they are complicated. Random-Access Data In the previous examples of partitioning, only data from predictable locations in a given data structure entered into any one computational step. In many applications, however, computations require data from unpredictable locations in a global data structure. In these cases, each item is typically stored together with information about its position in the global data structure. In sparse matrices, for example, the location of non-zero elements is unpredictable. A row index, a column index, or both, are therefore typically stored along with each non-zero value. Often, the records in a database are sorted in alphabetical order using a particular field. The value of that field for a given record encodes the location of the record. There are two approaches to partitioning such data: Data 57

Ad Hoc Optimization If possible, arrange the data so as to minimize the amount of data-movement required for the computations. Near-optimal partitions have been worked out in the research literature for many special cases. Data Permutation Partition the data in a conceptually simple way, and make use of library routines for sorting or other data permutations before each global computation. ncube 2 libraries contain routines for common data permutations like sorting, matrix transposition, and index-shuffling for fast fourier transforms. Permutation routines typically work in two stages. First they tag each piece of data with the ID of its destination node, then they move the data. Dynamic Repartitioning For applications in which the computational work required by each block of data is both predictable and constant in time, a static data partitioning, computed at the beginning of program execution, is appropriate. Otherwise, some form of adaptive repartitioning may be required to avoid processingload imbalances. There are three issues involved in such adaptive partitioning: Deciding when to repartition. Computing the new partition. Redistributing the data in the new partition. An airflow simulator used to predict weather would require dynamic repartitioning, because areas of computational intensiveness (e.g. storms) are in constant motion. You can compute a new partition for all the data after a predetermined number of simulation time steps, or you can set local criteria for the repartitioning of individual regions. In a particle simulation, you can detect shifts in the distribution of computational work by counting the particles each node is required to keep track of. For differential equations, mathematical methods exist for estimating the computational error in each region. In general, more computational effort should be devoted to regions where the error is greatest. In one common strategy, regions are partitioned more finely when the estimated error exceeds a predetermined value, and more coarsely when the estimated error is especially small. In this way, computational resources are adaptively deployed to maintain a predictable degree of accuracy throughout the computation. To compute a new partition, you can use the same algorithms that are available for computing a static partition. You simply provide the algorithm with information about the current distribution of computational work. Once the new partition has been computed, data needs to be redistributed among the nodes. The choice of algorithm for redistributing the data depends heavily on the nature of the partition. Data 58

Often the calculation and redistribution steps can be interleaved. Consider the airflow simulation example discussed above, in which a room is divided into horizontal slices of varying thickness. Suppose that after some iterations of the main program, the distribution of computational work has changed, and new information has been collected about the density of computational work as a function of height. From this point, there are many ways to proceed. One possibility is the following: 1. Each node is provided a copy of the load-distribution information; all nodes then compute the room height at which half the computational work lies above, and half below. 2. Throughout the simulation, half of the nodes are responsible for the top half of the room, half for the bottom. Data is shifted as necessary from the "top half" nodes to the "bottom half" nodes, or vice-versa, so that each group will have the same total amount of work to do when the main program resumes. 3. The partitioning then proceeds recursively, with each group of nodes "top half" and "bottom half" computing the midpoint of its own computational load, shifting data as needed, and then splitting into two subgroups. 4. The computation ends when only one node is left in each subgroup. At this point, the data have been distributed so as to balance the computational work among all the nodes. This procedure is illustrated in Figure 1-39. Data 59

Figure 1-39: Dynamic Repartitioning Corresponding Data To First Group Of Nodes Corresponding Data To Other Group Of Nodes Data 60

Trees Using ncube 2 parallel library routines, you can easily construct algorithms that perform global computations on trees and related structures, particularly computations that require gathering or broadcasting information to all the nodes. Sequential algorithms based on a divide-and-conquer strategy can often be made parallel by using some kind of tree structure. Since the depth of a tree is typically related logarithmically to the number of nodes, the resulting parallel algorithms can be very efficient. The globalsum library routine is an example of such an algorithm. It computes the sum of a collection of numbers, each of which resides on a different node. The routine must be called by the program elements on all nodes. It returns the value of the sum to each node. The operation on a hypercube of eight nodes is illustrated in the time-line diagram below (Figure 1-40): Figure 1-40: Time-Line Diagram for Globalsum 0 1 2 3 4 5 6 7 Data is passed from node to node down the communication tree shown in Figure 1-41. At each node, the data from the child nodes is summed. After three communication-and-computation steps (3=log 2 8), node 0 knows the sum of the numbers from all nodes. Data 61

Figure 1-41: Communication Tree for Globalsum 1 3 5 7 0 2 4 6 Eight such trees can be traced in the time-line diagram, each with a different node at its root. Globalsum therefore returns the same value the sum of all the numbers to every node. A collection of interlaced trees like the eight in our example is called a Banyan net. Banyan nets can be used by calling a library routine similar to globalsum, or by writing a custom routine to perform globally any associative operation that works on two numbers or other data items at a time. The communication tree shown in the diagram above spans the hypercube in such a way that nodes connected in the tree are nearest neighbors in the hypercube. This reduces communication overhead, but not by very much. The message-routing hardware of the ncube 2 makes communication between distant nodes almost as fast as that between nearest neighbors. The main advantage of this tree is its conceptual simplicity and ease of programming. In general, choose a tree topology based on the requirements of your problem and the availability of useful algorithms. Mapping your tree onto the hypercube should be your last step. For instance, in the communication tree illustrated above, the number of children belonging to a node the fanout of the node varies from node to node. Node 0 has three children, while node 2 has only one child. Suppose a great deal of memory is required in each node, per child. Then to distribute the memory burden evenly would require a balanced tree structure, like the binary tree illustrated in Figure 1-42: Data 62

Figure 1-42: Binary Tree 15 7 8 9 10 11 12 13 14 3 4 5 6 1 2 0 Of the sixteen nodes in the binary tree, none has more than two children, so the memory burden in our hypothetical example is distributed fairly evenly. Binary trees, moreover, allow certain important functions to be computed easily. For example, the parent of node N is the node whose address is the largest integer which does not exceed (N-1)/2. On the other hand, a binary tree cannot be mapped into the hypercube in a way that preserves nearest neighbors. Research literature on parallel programming abounds in special-purpose tree structures and algorithms exploiting them. For example, a near-binary tree has been found that can be mapped onto the hypercube so that neighbors are preserved. This tree controls fanout like a binary tree, but its use requires more complicated algorithms. The following table summarizes the main properties of the tree structures discussed in this section. Tree Structure Maximum Fanout Mapped as Neighbors? Parent of Node N Hypercube Dimension of Hypercube yes N-2 k, where 2 k is the largest power of 2 that divides N Binary 2 no Greatest integer not exceeding (N-1)/2 n-ary n no Greatest integer not exceeding (N-1)/n Near-Binary 2 yes Complicated Data 63