- 1、本文档共33页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Floyd’s Algorithm
Parallel Programmingwith MPI and OpenMP Michael J. Quinn Chapter 6 Floyd’s Algorithm Chapter Objectives Creating 2-D arrays Thinking about “grain size” Introducing point-to-point communications Reading and printing 2-D matrices Analyzing performance when computations and communications overlap Outline All-pairs shortest path problem Dynamic 2-D arrays Parallel algorithm design Point-to-point communication Block row matrix I/O Analysis and benchmarking All-pairs Shortest Path Problem Floyd’s Algorithm Why It Works Dynamic 1-D Array Creation Dynamic 2-D Array Creation Designing Parallel Algorithm Partitioning Communication Agglomeration and Mapping Partitioning Domain or functional decomposition? Look at pseudocode Same assignment statement executed n3 times No functional parallelism Domain decomposition: divide matrix A into its n2 elements Communication Agglomeration and Mapping Number of tasks: static Communication among tasks: structured Computation time per task: constant Strategy: Agglomerate tasks to minimize communication Create one task per MPI process Two Data Decompositions Comparing Decompositions Columnwise block striped Broadcast within columns eliminated Rowwise block striped Broadcast within rows eliminated Reading matrix from file simpler Choose rowwise block striped decomposition File Input Pop Quiz Point-to-point Communication Involves a pair of processes One process sends a message Other process receives the message Send/Receive Not Collective Function MPI_Send Function MPI_Recv Coding Send/Receive Inside MPI_Send and MPI_Recv Return from MPI_Send Function blocks until message buffer free Message buffer is free when Message copied to system buffer, or Message transmitted Typical scenario Message copied to system buffer Transmission overlaps computation Return from MPI_Recv Function blocks until message in buffer If message never arrives, function never returns Deadlock Deadlock: process waiting for a condition that will never become true Easy to
文档评论(0)