




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Parallel Programmingin C with MPI and OpenMP,Michael J. Quinn,Chapter 2,Parallel Architectures,Outline,Interconnection networks Processor arrays Multiprocessors Multicomputers Flynns taxonomy,Interconnection Networks,Uses of interconnection networks Connect processors to shared memory Connect proces
2、sors to each other Interconnection media types Shared medium Switched medium,Shared versus Switched Media,Shared Medium,Allows only message at a time Messages are broadcast Each processor “listens” to every message Arbitration is decentralized Collisions require resending of messages Ethernet is an
3、example,Switched Medium,Supports point-to-point messages between pairs of processors Each processor has its own path to switch Advantages over shared media Allows multiple messages to be sent simultaneously Allows scaling of network to accommodate increase in processors,Switch Network Topologies,Vie
4、w switched network as a graph Vertices = processors or switches Edges = communication paths Two kinds of topologies Direct Indirect,Direct Topology,Ratio of switch nodes to processor nodes is 1:1 Every switch node is connected to 1 processor node At least 1 other switch node,Indirect Topology,Ratio
5、of switch nodes to processor nodes is greater than 1:1 Some switches simply connect other switches,Evaluating Switch Topologies,Diameter Bisection width Number of edges / node Constant edge length? (yes/no),2-D Mesh Network,Direct topology Switches arranged into a 2-D lattice Communication allowed o
6、nly between neighboring switches Variants allow wraparound connections between switches on edge of mesh,2-D Meshes,Evaluating 2-D Meshes,Diameter: (n1/2) Bisection width: (n1/2) Number of edges per switch: 4 Constant edge length? Yes,Binary Tree Network,Indirect topology n = 2d processor nodes, n-1
7、switches,Evaluating Binary Tree Network,Diameter: 2 log n Bisection width: 1 Edges / node: 3 Constant edge length? No,Hypertree Network,Indirect topology Shares low diameter of binary tree Greatly improves bisection width From “front” looks like k-ary tree of height d From “side” looks like upside d
8、own binary tree of height d,Hypertree Network,Evaluating 4-ary Hypertree,Diameter: log n Bisection width: n / 2 Edges / node: 6 Constant edge length? No,Butterfly Network,Indirect topology n = 2d processornodes connectedby n(log n + 1)switching nodes,Butterfly Network Routing,Evaluating Butterfly Ne
9、twork,Diameter: log n Bisection width: n / 2 Edges per node: 4 Constant edge length? No,Hypercube,Directory topology 2 x 2 x x 2 mesh Number of nodes a power of 2 Node addresses 0, 1, , 2k-1 Node i connected to k nodes whose addresses differ from i in exactly one bit position,Hypercube Addressing,Hy
10、percubes Illustrated,Evaluating Hypercube Network,Diameter: log n Bisection width: n / 2 Edges per node: log n Constant edge length? No,Shuffle-exchange,Direct topology Number of nodes a power of 2 Nodes have addresses 0, 1, , 2k-1 Two outgoing links from node i Shuffle link to node LeftCycle(i) Exc
11、hange link to node xor (i, 1),Shuffle-exchange Illustrated,0,1,2,3,4,5,6,7,Shuffle-exchange Addressing,Evaluating Shuffle-exchange,Diameter: 2log n - 1 Bisection width: n / log n Edges per node: 2 Constant edge length? No,Comparing Networks,All have logarithmic diameterexcept 2-D mesh Hypertree, but
12、terfly, and hypercube have bisection width n / 2 All have constant edges per node except hypercube Only 2-D mesh keeps edge lengths constant as network size increases,Vector Computers,Vector computer: instruction set includes operations on vectors as well as scalars Two ways to implement vector comp
13、uters Pipelined vector processor: streams data through pipelined arithmetic units Processor array: many identical, synchronized arithmetic processing elements,Why Processor Arrays?,Historically, high cost of a control unit Scientific applications have data parallelism,Processor Array,Data/instructio
14、n Storage,Front end computer Program Data manipulated sequentially Processor array Data manipulated in parallel,Processor Array Performance,Performance: work done per time unit Performance of processor array Speed of processing elements Utilization of processing elements,Performance Example 1,1024 p
15、rocessors Each adds a pair of integers in 1 sec What is performance when adding two 1024-element vectors (one per processor)?,Performance Example 2,512 processors Each adds two integers in 1 sec Performance adding two vectors of length 600?,2-D Processor Interconnection Network,Each VLSI chip has 16
16、 processing elements,if (COND) then A else B,if (COND) then A else B,if (COND) then A else B,Processor Array Shortcomings,Not all problems are data-parallel Speed drops for conditionally executed code Dont adapt to multiple users well Do not scale down well to “starter” systems Rely on custom VLSI f
17、or processors Expense of control units has dropped,Multiprocessors,Multiprocessor: multiple-CPU computer with a shared memory Same address on two different CPUs refers to the same memory location Avoid three problems of processor arrays Can be built from commodity CPUs Naturally support multiple use
18、rs Maintain efficiency in conditional code,Centralized Multiprocessor,Straightforward extension of uniprocessor Add CPUs to bus All processors share same primary memory Memory access time same for all CPUs Uniform memory access (UMA) multiprocessor Symmetrical multiprocessor (SMP),Centralized Multip
19、rocessor,Private and Shared Data,Private data: items used only by a single processor Shared data: values used by multiple processors In a multiprocessor, processors communicate via shared data values,Problems Associated with Shared Data,Cache coherence Replicating data across multiple caches reduces
20、 contention How to ensure different processors have same value for same address? Synchronization Mutual exclusion Barrier,Cache-coherence Problem,Memory,7,X,Cache-coherence Problem,Memory,7,X,7,Cache-coherence Problem,Memory,7,X,7,7,Cache-coherence Problem,Memory,2,X,7,2,Write Invalidate Protocol,7,
21、X,7,7,Cache control monitor,Write Invalidate Protocol,7,X,7,7,Intent to write X,Write Invalidate Protocol,7,X,7,Intent to write X,Write Invalidate Protocol,X,2,2,Distributed Multiprocessor,Distribute primary memory among processors Increase aggregate memory bandwidth and lower average memory access
22、time Allow greater number of processors Also called non-uniform memory access (NUMA) multiprocessor,Distributed Multiprocessor,Cache Coherence,Some NUMA multiprocessors do not support it in hardware Only instructions, private data in cache Large memory access time variance Implementation more diffic
23、ult No shared memory bus to “snoop” Directory-based protocol needed,Directory-based Protocol,Distributed directory contains information about cacheable memory blocks One directory entry for each cache block Each entry has Sharing status Which processors have copies,Sharing Status,Uncached Block not
24、in any processors cache Shared Cached by one or more processors Read only Exclusive Cached by exactly one processor Processor has written block Copy in memory is obsolete,Directory-based Protocol,Directory-based Protocol,Interconnection Network,7,X,Caches,Memories,Directories,X,U 0 0 0,Bit Vector,CP
25、U 0 Reads X,Interconnection Network,7,X,Caches,Memories,Directories,X,U 0 0 0,CPU 0 Reads X,Interconnection Network,7,X,Caches,Memories,Directories,X,S 1 0 0,CPU 0 Reads X,Interconnection Network,Caches,Memories,Directories,X,S 1 0 0,CPU 2 Reads X,Interconnection Network,Caches,Memories,Directories,
26、X,S 1 0 0,CPU 2 Reads X,Interconnection Network,Caches,Memories,Directories,X,S 1 0 1,CPU 2 Reads X,Interconnection Network,Caches,Memories,Directories,X,S 1 0 1,CPU 0 Writes 6 to X,Interconnection Network,Caches,Memories,Directories,X,S 1 0 1,Write Miss,CPU 0 Writes 6 to X,Interconnection Network,C
27、aches,Memories,Directories,X,S 1 0 1,Invalidate,CPU 0 Writes 6 to X,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0,6,X,CPU 1 Reads X,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0,Read Miss,CPU 1 Reads X,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0,Swit
28、ch to Shared,CPU 1 Reads X,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0,CPU 1 Reads X,Interconnection Network,Caches,Memories,Directories,X,S 1 1 0,CPU 2 Writes 5 to X,Interconnection Network,Caches,Memories,Directories,X,S 1 1 0,Write Miss,CPU 2 Writes 5 to X,Interconnection Networ
29、k,Caches,Memories,Directories,X,S 1 1 0,Invalidate,CPU 2 Writes 5 to X,Interconnection Network,Caches,Memories,Directories,X,E 0 0 1,5,X,CPU 0 Writes 4 to X,Interconnection Network,Caches,Memories,Directories,X,E 0 0 1,CPU 0 Writes 4 to X,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0
30、,Take Away,CPU 0 Writes 4 to X,Interconnection Network,Caches,Memories,Directories,X,E 0 1 0,CPU 0 Writes 4 to X,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0,CPU 0 Writes 4 to X,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0,CPU 0 Writes 4 to X,Interconnection Network
31、,Caches,Memories,Directories,X,E 1 0 0,4,X,CPU 0 Writes Back X Block,Interconnection Network,Caches,Memories,Directories,X,E 1 0 0,Data Write Back,CPU 0 Writes Back X Block,Interconnection Network,Caches,Memories,Directories,X,U 0 0 0,Multicomputer,Distributed memory multiple-CPU computer Same addre
32、ss on different processors refers to different physical memory locations Processors interact through message passing Commercial multicomputers Commodity clusters,Asymmetrical Multicomputer,Asymmetrical MC Advantages,Back-end processors dedicated to parallel computations Easier to understand, model,
33、tune performance Only a simple back-end operating system needed Easy for a vendor to create,Asymmetrical MC Disadvantages,Front-end computer is a single point of failure Single front-end computer limits scalability of system Primitive operating system in back-end processors makes debugging difficult
34、 Every application requires development of both front-end and back-end program,Symmetrical Multicomputer,Symmetrical MC Advantages,Alleviate performance bottleneck caused by single front-end computer Better support for debugging Every processor executes same program,Symmetrical MC Disadvantages,More difficult to maintain illusion of single “parallel computer” No simple way to balance program development workload among processors More difficult to achieve high performance when multiple processes on each processor,P
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《国际经济合作》课件-1、第一章 国际经济合作概论
- 美妆行业个性化定制服务模式在2025年的市场细分报告
- 农村电商服务站农村电商与农村金融服务创新与风险防范报告
- 工业互联网网络运维 课件 任务5.1-1 PLC组态配置-CPU与拓展模块添加
- 毕生发展心理学(第2版)课件 第十一章 青年期心理的发展
- 2019年河北省统一评标专家库评标专家考试模拟题及答案
- 数据挖掘 题目及答案
- 四川省安全员b证考试试题及答案
- 泰安市初三期中考试试题及答案
- 养护分包管理办法
- 用餐招待管理办法
- 2025年高校教师资格证之高等教育学题库附参考答案(综合卷)
- 2025年新游泳馆受伤赔偿协议书
- 智慧酒店AI大模型数字化平台规划设计方案
- 2025版大型活动现场清洁服务合同范本
- 数据系统使用管理办法
- 2025齐齐哈尔高等师范专科学校教师招聘考试试题
- 无人机管理使用暂行办法
- 2025年上海市中考招生考试数学真题试卷(真题+答案)
- 甲状腺结节的护理查房
- 2024年个人信用报告(个人简版)样本(带水印-可编辑)
评论
0/150
提交评论