基于消息传递的并行计算

上传人:l**** 文档编号:57675539 上传时间:2018-10-23 格式:PPT 页数:76 大小:587.50KB
返回 下载 相关 举报
基于消息传递的并行计算_第1页
第1页 / 共76页
基于消息传递的并行计算_第2页
第2页 / 共76页
基于消息传递的并行计算_第3页
第3页 / 共76页
基于消息传递的并行计算_第4页
第4页 / 共76页
基于消息传递的并行计算_第5页
第5页 / 共76页
点击查看更多>>
资源描述

《基于消息传递的并行计算》由会员分享,可在线阅读,更多相关《基于消息传递的并行计算(76页珍藏版)》请在金锄头文库上搜索。

1、并行计算 Parallel Computing,基于消息传递的并行计算,消息传递库,消息传递软件中最流行的是MPI和PVM, 它们能运行在所有的并行平台上, 包括SMP和PVP. 二者已经在Windows 和各种Unix平台上实现. 程序设计语言支持C, Fortran. 在国产的三大并行机系列神威、银河和曙光上都实现了对MPI和PVM和支持.,消息传递库PVM,开发时间: 始于1989年 开发单位: 美国Tennessee大学、Oak Ridge国家实验室和Emory大学联合研制 特点: 具有较好的适应性、可扩展性、可移植性和易使用性等特点, 源代码可以免费获取, 现已被用户广泛采纳. 现状

2、: 目前对它的研究和开发工作仍在各大学和研究机构进行. 尽管已经有越来越多的人开始使用MPI, 但PVM仍然是做并行处理最流行的软件之一. 随着它的不断流行, 已经被移植到PVP, SMP, MPP, 工作站和PC组成的机群系统.,消息传递库MPI,目标: 提供一个实际可用的、可移植的、高效的和灵活的消息传递接口标准. MPI以语言独立的形式来定义这个接口库, 并提供了与C、Fortran语言的绑定. 这个定义不包含任何专用于某个特别的制造商、操作系统或硬件的特性. MPI在并行计算界被广泛地接受.,消息传递库MPI,MPI的实现 建立在厂家专用的环境之上 IBM SP2的POE/MPL, I

3、ntel Paragon的OSF/Nx 公共的MPI环境: CHIMP Edinburg 大学 LAM(Local Area Multicomputer) Ohio超级计算中心 MPICH Argonne国家实验室与Mississippi州立大学 MPICH是MPI在各种机器上的可移植实现,可以安装在几乎所有的平台上: PC 工作站 SMP MPP COW,消息传递模式,关于通信模式, 用户需要理解的有三个方面: 共有多少个进程? 进程间如何同步? 如何管理通信缓冲区? 现在的消息传递系统多使用三种通信模式: 同步的消息传递 (Synchronous Message Passing) 阻塞的消

4、息传递 (Blocking Message Passing) 非阻塞的消息传递 (Nonblocking Message Passing),Synchronous Message Passing,Blocking and Nonblocking Message Passing,Blocking It has been used to describe routines that do not return until the transfer is completed. The routines are “blocked” from continuing. In that sense, the

5、 terms synchronous and blocking were synonymous. Non-blocking It has been used to describe routines that return whether or not the message had been received.,Send & Receive buffer,Process P: M=10; L1: send M to Q; L2: M=20; goto L1;,Process Q: L1: S= -100; L2: receive S from P; X=S+1;,Send & Receive

6、 buffer,M: send message buffer, or send buffer S : receive message buffer, or receive buffer,Blocking Buffered Send/Receive,For send routine, once the local actions have been completed and the message is safely on its way, the process can continue with subsequent work. Buffers can only be of finite

7、length and a point could be reached when the send routine is held up because all the available buffer space has been exhausted.,Generally, a message buffer needed between source and destination to hold message.,Non-Blocking Message Passing,It returns from the send or receive operation before it is s

8、emanticlly safe. They are generally accompanied by a check-status operation. One must be careful using non-blocking protocols since errors can result from unsafe access to data that being communicated.,非阻塞模式的安全,Process P: M=10; send M to Q; do some computation which does not change M; wait for M to

9、be sent; M=20;,Process Q: S=-100; receive S from P; do some computation which does not use S; wait for S to be received; X=S+1;,非阻塞模式下, 强制进程等待直到安全时再继续执行,非阻塞模式本身也会带来一些额外开销: 作为临时缓冲区用的内存空间 分配缓冲区的操作 将消息拷入和拷出临时缓冲区 执行一个额外的检测和等待函数,消息传递方式,消息传递方式,消息传递,消息传递的特点: 在消息传递模型中, 一个并行应用由一组进程组成, 每个进程的代码是本地的, 只能访问私有数据,

10、进程之间通过传递消息实现数据共享和进程同步. 优点: 用户可以对并行性的开发、数据分布和通信实现完全控制. 缺点: 要求程序员显式地处理通信问题, 如, 消息传递调用的位置, 数据移动, 数据复制, 数据操作, 数据的一致性等等. 对大多数科学计算程序来说, 消息传递模型的真正困难还在于显式的域分解, 也就是说, 将对相应数据的操作限定在指定的处理器上进行, 在每个处理器上只能看见整个分布数据的一部分. 无法以渐进的方式、通过逐步将串行代码转换成并行代码而开发出来. 大量的散布在程序各处的域分解要求整个程序由串行到并行的转换一次性实现, 而共享存储方法允许在现有的串行代码中插入并行说明从而实现

11、逐步转换.与之相比, 这是消息传递的一个明显的缺点.,PVM (Parallel Virtual Machine),PVM (Parallel Virtual Machine) is a package of libraries and runtime daemons that enables building parallel apps easily and efficiently Allows a collection of heterogeneous machines to be viewed and used as a single (virtual) parallel machine

12、.,Key attributes of PVM,Runs on every UNIX,Linux and WNT/W95 Runs over most physical networks (ethernet, FDDI, Myrinet, ATM, Shared-Memory) A heterogeneous collection of machines can be assembled and used as a Super Computer Programming is completely portable The underlying machine and network is tr

13、ansparent to the programmer/user Each user has his/hers own private VM,Heterogeneous Network Computing Model for PVM,Nodes may be heterogeneous in terms of architecture, data format, speed, and load. Performance can be optimized by assigning each individual task to most appropriate architecture,PVM

14、Computing Model,Application program is written as a collecting of interacting PVM tasks. These tasks can access PVM resources through a library of standard interface routines. These routines provide process control, communication, and synchronization mechanism across a network of heterogeneous machi

15、nes.,PVM Components:,- daemon , called pvmd3 or pvmd, resides on all the computers making up the virtual machine. - PVM library, contains user-callable routines for message passing, spawning processes, coordinating tasks, and modifying the virtual machine.,PVM Components - pvmd:,pvmd is responsible

16、for: providing inter-host point of contact task authentication executing processes on machines message routing transmitting messages from its application to a destination receiving and buffering messages from other pvmd s until the destination application can deal with them.,Starting PVM:,Type pvm p

17、vm add hostname pvm delete hostname pvm conf pvm ps a quit - quit the console prompt. pvm halt,PVM console,The available commands are add - followed by one or more host names, adds these hosts to the virtual machine. alias - defines or lists command aliases. conf - lists the configuration of the vir

18、tual machine including hostname, pvmd task ID, architecture type, and a relative speed rating. delete - followed by one or more host names, deletes these hosts from the virtual machine. PVM processes still running on these hosts are lost. echo - echo arguments. halt - kills all PVM processes including console, and then shuts down PVM. All daemons exit. help,

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号