Stencil Pattern ITCS 4/5145 Parallel computing, UNC-Charlotte, B. Wilkinson Jan 28, 2016 1.

Slides:



Advertisements
Similar presentations
Partial Differential Equations
Advertisements

Unsupervised Learning Clustering K-Means. Recall: Key Components of Intelligent Agents Representation Language: Graph, Bayes Nets, Linear functions Inference.
1 ITCS 4/5010 CUDA Programming, UNC-Charlotte, B. Wilkinson, Feb 26, 2013, DyanmicParallelism.ppt CUDA Dynamic Parallelism These notes will outline CUDA.
CSCI-455/552 Introduction to High Performance Computing Lecture 26.
Numerical Algorithms ITCS 4/5145 Parallel Computing UNC-Charlotte, B. Wilkinson, 2009.
CSCI 317 Mike Heroux1 Sparse Matrix Computations CSCI 317 Mike Heroux.
Chapter 13 Finite Difference Methods: Outline Solving ordinary and partial differential equations Finite difference methods (FDM) vs Finite Element Methods.
Solve an equation with variables on both sides
Monte Carlo Methods in Partial Differential Equations.
9.6 Other Heat Conduction Problems
Lecture 8 – Stencil Pattern Stencil Pattern Parallel Computing CIS 410/510 Department of Computer and Information Science.
Linear Systems Iterative Solutions CSE 541 Roger Crawfis.
Boyce/DiPrima 9 th ed, Ch 10.8: Laplace’s Equation Elementary Differential Equations and Boundary Value Problems, 9 th edition, by William E. Boyce and.
Engineering Analysis – Computational Fluid Dynamics –
ECE 1747H: Parallel Programming Lecture 2-3: More on parallelism and dependences -- synchronization.
April 24, 2002 Parallel Port Example. April 24, 2002 Introduction The objective of this lecture is to go over a simple problem that illustrates the use.
Solving Partial Differential Equation Numerically Pertemuan 13 Matakuliah: S0262-Analisis Numerik Tahun: 2010.
ERT 216 HEAT & MASS TRANSFER Sem 2/ Dr Akmal Hadi Ma’ Radzi School of Bioprocess Engineering University Malaysia Perlis.
Lecture Objectives: - Numerics. Finite Volume Method - Conservation of  for the finite volume w e w e l h n s P E W xx xx xx - Finite volume.
An Introduction to Computational Fluids Dynamics Prapared by: Chudasama Gulambhai H ( ) Azhar Damani ( ) Dave Aman ( )
Solving Equations with Variables on Both Sides. Review O Suppose you want to solve -4m m = -3 What would you do as your first step? Explain.
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! 1 ITCS 4/5145 Parallel Computing,
Relaxation Methods in the Solution of Partial Differential Equations
Numerical Algorithms Chapter 11.
EEE 431 Computational Methods in Electrodynamics
Courtesy: Dr. David Walker, Cardiff University
High Altitude Low Opening?
Boyce/DiPrima 10th ed, Ch 10.8: Laplace’s Equation Elementary Differential Equations and Boundary Value Problems, 10th edition, by William E. Boyce and.
Boyce/DiPrima 9th ed, Ch 10.8 Appendix A: Derivation of the Heat Conduction Equation Elementary Differential Equations and Boundary Value Problems, 9th.
Graphing and solving quadratic inequalities
Pattern Parallel Programming
Advanced Numerical Methods (S. A. Sahu) Code: AMC 51151
3.4 Solving Systems of Linear Equations in Three Variables
Stencil Pattern A stencil describes a 2- or 3- dimensional layout of processes, with each process able to communicate with its neighbors. Appears in simulating.
Using compiler-directed approach to create MPI code automatically
Pattern Parallel Programming
Solving One-Step Equations
Hidden Markov Models Part 2: Algorithms
ME/AE 339 Computational Fluid Dynamics K. M. Isaac Topic2_PDE
Numerical Algorithms • Parallelizing matrix multiplication
Solve an equation by combining like terms
Pipeline Pattern ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, 2012 slides5.ppt Oct 24, 2013.
Sathish Vadhiyar Courtesy: Dr. David Walker, Cardiff University
Stencil Quiz questions
CSE 541 – Numerical Methods
Stencil Quiz questions
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! ITCS 4/5145 Parallel Computing,
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! ITCS 4/5145 Parallel Computing,
CS6068 Applications: Numerical Methods
Objectives Solve systems of linear equations in two variables by elimination. Compare and choose an appropriate method for solving systems of linear equations.
COMP60621 Designing for Parallelism
Motion in One Dimension
Notes on Assignment 3 OpenMP Stencil Pattern
Solve and Graph 2x + 3 < 9 2x + 3 = x = x = 3
Using compiler-directed approach to create MPI code automatically
Finite Difference Method for Poisson Equation
Warm Up Solve for x. Simplify Simplify
Patterns Paraguin Compiler Version 2.1.
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! ITCS 4/5145 Parallel Computing,
Data Structures & Algorithms
Jacobi Project Salvatore Orlando.
Stencil Pattern ITCS 4/5145 Parallel computing, UNC-Charlotte, B. Wilkinson Oct 14, 2014 slides6b.ppt 1.
Matrix Addition and Multiplication
Quiz Questions Iterative Synchronous Pattern
Introduction to High Performance Computing Lecture 16
Stencil Pattern ITCS 4/5145 Parallel computing, UNC-Charlotte, B. Wilkinson StencilPattern.ppt Oct 14,
Shared memory programming
Example 2B: Solving Linear Systems by Elimination
Quiz Questions Iterative Synchronous Pattern
Home assignment #3 (1) (Total 3 problems) Due: 12 November 2018
Presentation transcript:

Stencil Pattern ITCS 4/5145 Parallel computing, UNC-Charlotte, B. Wilkinson Jan 28, 2016 1

Stencil Pattern Examples A stencil describes a 2- or 3- dimensional layout of processes, with each process able to communicate only with its neighbors. Appears in simulating many real-life situations. Examples Solving partial differential equations using discretized methods, which may be for: Modeling engineering structures Weather forecasting, see intro to course slides1a-1 Particle dynamics simulations Modeling chemical and biological structures 2

Stencil pattern On each iteration, each node communicates with neighbors to get stored computed values Two-way connection Compute node Source/sink 3

(Iterative synchronous) stencil pattern Often globally synchronous and iterative: Processes compute and communicate only with their neighbors, exchanging results Check termination condition Repeat Stop 4

Solving Laplace’s Equation Application example of stencil pattern Solving Laplace’s Equation Solve for f over the two-dimensional x-y space. For computer solution, finite difference methods appropriate Two-dimensional solution space “discretized” into large number of solution points.

Finite Difference Method

Point to the left Point to the right Point below Point above Average of the 4 neighboring points

Known as a Jacobi iteration – each value is computed from the values of the previous iteration.

Heat Distribution Problem -- Steady State Heat Equation Finding the static distribution of heat in a space (which is Laplace’s equation). Suppose a 2 dimensional space: An area has known temperatures along each of its borders (boundary conditions). Find the temperature distribution within. Each point taken to be the average of the four neighboring points There are points at the boundaries with fixed values. 9

Jacobi Iteration int main() { int i, j; double A[N][M], B[N][M]; … // A is initialized with data somehow for (time = 0; time < MAX_ITERATION; time++) { for (i = 1; i < N-1; i++) for (j = 1; j < M-1; j++) B[i][j] = (A[i-1][j] + A[i+1][j] + A[i][j-1] + A[i][j+1]) * 0.25; A[i][j] = B[i][j]; } ... Skip the boundary values Newly computed values are placed in a new array. Multiplying by 0.25 is faster than dividing by 4.0 Then copied back to the original.

Improved Jacobi Iteration int main() { int i, j, current, next; double A[2][N][M]; current = 0; next = 1; … // A[current][N][M] is initialized with data somehow for (time = 0; time < MAX_ITERATION; time++) { for (i = 1; i < N-1; i++) for (j = 1; j < M-1; j++) A[next][i][j] = (A[current][i-1][j] + A[current][i+1][j] + A[current][i][j-1] + A[current][i][j+1]) * 0.25; current = next; // swap values of current and next next = 1 - current; } // Final result is in A[current] ... Add another dimension of size 2 to A. A[0] is old A and A[1] is old B This avoids copying values back into the original array. We toggle between copies of the array

Application Example A room has four walls and a fireplace. Temperature of wall is 20°C, and temperature of fireplace is 100°C. Write a parallel program using Jacobi iteration to compute the temperature inside the room and plot (preferably in color) temperature contours at 10°C intervals. 12

Sample student output 13

Questions