版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Parallel Programmingin C with MPI and OpenMP,Michael J. Quinn,Chapter 13,Finite Difference Methods,Outline,Ordinary and partial differential equations Finite difference methods Vibrating string problem Steady state heat distribution problem,Ordinary and Partial Differential Equations,Ordinary differ
2、ential equation: equation containing derivatives of a function of one variable Partial differential equation: equation containing derivatives of a function of two or more variables,Examples of Phenomena Modeled by PDEs,Air flow over an aircraft wing Blood circulation in human body Water circulation
3、in an ocean Bridge deformations as its carries traffic Evolution of a thunderstorm Oscillations of a skyscraper hit by earthquake Strength of a toy,Model of Sea Surface Temperaturein Atlantic Ocean,Courtesy MICOM group at the Rosenstiel School of Marine and Atmospheric Science, University of Miami,S
4、olving PDEs,Finite element method Finite difference method (our focus) Converts PDE into matrix equation Result is usually a sparse matrix Matrix-based algorithms represent matrices explicitly Matrix-free algorithms represent matrix values implicitly (our focus),Linear Second-order PDEs,Linear secon
5、d-order PDEs are of the form where A - H are functions of x and y only Elliptic PDEs: B2 - AC 0,Difference Quotients,Formulas for 1st, 2d Derivatives,Vibrating String Problem,Vibrating string modeled by a hyperbolic PDE,Solution Stored in 2-D Matrix,Each row represents state of string at some point
6、in time Each column shows how position of string at a particular point changes with time,Discrete Space, Time Intervals Lead to 2-D Matrix,Heart of Sequential C Program,uj+1i = 2.0*(1.0-L)*uji + L*(uji+1 + uji-1) - uj-1i;,Parallel Program Design,Associate primitive task with each element of matrix E
7、xamine communication pattern Agglomerate tasks in same column Static number of identical tasks Regular communication pattern Strategy: agglomerate columns, assign one block of columns to each task,Result of Agglomeration and Mapping,Communication Still Needed,Initial values (in lowest row) are compu
8、ted without communication Values in black cells cannot be computed without access to values held by other tasks,Ghost Points,Ghost points: memory locations used to store redundant copies of data held by neighboring processes Allocating ghost points as extra columns simplifies parallel algorithm by a
9、llowing same loop to update all cells,Matrices Augmentedwith Ghost Points,Lilac cells are the ghost points.,Communication in an Iteration,This iteration the process is responsible for computing the values of the yellow cells.,Computation in an Iteration,This iteration the process is responsible for
10、computing the values of the yellow cells. The striped cells are the ones accessed as the yellow cell values are computed.,Complexity Analysis,Computation time per element is constant, so sequential time complexity per iteration is (n) Elements divided evenly among processes, so parallel computationa
11、l complexity per iteration is (n / p) During each iteration a process with an interior block sends two messages and receives two messages, so communication complexity per iteration is (1),Isoefficiency Analysis,Sequential time complexity: (n) Parallel overhead: (p) Isoefficiency relation: n Cp To ma
12、intain the same level of efficiency, n must increase at the same rate as p If M(n) = n2, algorithm has poor scalability If matrix of 3 rows rather than m rows is used, M(n) = n and system is perfectly scalable,Replicating Computations,If only one value transmitted, communication time dominated by me
13、ssage latency We can reduce number of communications by replicating computations If we send two values instead of one, we can advance simulation two time steps before another communication,Replicating Computations,Without replication:,With replication:,Communication Time vs. Number of Ghost Points,S
14、teady State Heat Distribution Problem,Steam,Steam,Steam,Ice bath,Solving the Problem,Underlying PDE is the Poisson equation This is an example of an elliptical PDE Will create a 2-D grid Each grid point represents value of state state solution at particular (x, y) location in plate,Heart of Sequenti
15、al C Program,wij = (ui-1j + ui+1j + uij-1 + uij+1) / 4.0;,Parallel Algorithm 1,Associate primitive task with each matrix element Agglomerate tasks in contiguous rows (rowwise block striped decomposition) Add rows of ghost points above and below rectangular region controlled by process,Example Decomp
16、osition,16 16 grid divided among 4 processors,Complexity Analysis,Sequential time complexity:(n2) each iteration Parallel computational complexity: (n2 / p) each iteration Parallel communication complexity: (n) each iteration (two sends and two receives of n elements),Isoefficiency Analysis,Sequenti
17、al time complexity: (n2) Parallel overhead: (pn) Isoefficiency relation:n2 Cnp n Cp This implementation has poor scalability,Parallel Algorithm 2,Associate primitive task with each matrix element Agglomerate tasks into blocks that are as square as possible (checkerboard block decomposition) Add rows
18、 of ghost points to all four sides of rectangular region controlled by process,Example Decomposition,16 16 grid divided among 16 processors,Implementation Details,Using ghost points around 2-D blocks requires extra copying steps Ghost points for left and right sides are not in contiguous memory loca
19、tions An auxiliary buffer must be used when receiving these ghost point values Similarly, buffer must be used when sending column of values to a neighboring process,Complexity Analysis,Sequential time complexity:(n2) each iteration Parallel computational complexity: (n2 / p) each iteration Parallel
20、communication complexity: (n /p ) each iteration (four sends and four receives of n /p elements each),Isoefficiency Analysis,Sequential time complexity: (n2) Parallel overhead: (n p ) Isoefficiency relation:n2 Cn p n C p This system is perfectly scalable,Summary (1/4),PDEs used to model behavior of a wide variety of physical systems Realistic problems yield PDEs too difficult to solve analytically, so scientists solve them numerically Two most common numerical techniques for solving PDEs finite element method finite difference
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 胫骨结核模拟试题及答案
- 关于付款事项的协商与确认函6篇范本
- 计算机二级c语言模拟试题及答案
- 计算机等级考试一级Photoshop应用模拟试题及答案
- 金融常见面模拟试题目及参考答案
- 金融机构资金管理部面试模拟试题及参考答案
- 金融管理专业模拟试题及答案
- 数字媒体编辑创新贡献度考核表
- 门球教练员考模拟试题及答案
- 颅脑ct模拟试题及答案
- 2026年中央一号文件解读:农业废弃物资源化利用
- 多功能中成药灭菌柜设备验证方案
- 西方普世价值的实质
- 乡村建设工匠培训课
- 江苏无锡2015-2024年中考满分作文125篇
- 自动控制原理-胡寿松电子教案
- 儿童大班国画荷花课件
- 肺叶切除术麻醉管理要点
- 通信专业现场管理制度
- 机械设计 第11章 蜗杆传动学习课件
- 辅助生殖技术规章制度汇编
评论
0/150
提交评论