ADS14 Parallel Algorithms

summation problem

计算A(1)+…+A(N), 并行两个两个加,再并行第一次加法后的两个两个加

work load 是N, T(N)=logN

Prefix-Sums

计算A(1), A(1)+A(2),…, A(1)+A(2)+…+A(N)一共N个值。

C(i,j)的含义是:以C(i,j)为根的树,最右边的叶子加到A(1)的值

B是从下往上算,C是从上往下计算。

work load O(N), T(N)=O(logN)

Merging

找到A中每个元素在B中排名,B中每个元素在A中排名,在结果中的排名就是在A中排名+在B中排名。

因此,给了Rank,merge复杂度是T(N)=O(1), W(N)=O(N)

如果用二分查找法,N个元素并行查找,work load是O(NlogN), T(N)=O(logN)

如果使用顺序查找法,N个元素,work load 是O(N), T(N)=O(N)

如果使用p=N/logN个段, work load = O(N), T(N)=O(NlogN)

finding max

summation
和相邻的比较,大的进入上一层,最后时间一共O(logN),work load O(N)

all pairs
分为N^2个进程,每个进程做第i个和第j个比较,j是i后面任何一个, 将小的那个记录成1.

然后分成N个进程,每个进程检查这个元素是不是0,是0的就是最大元素。

work load 是N^2, T(N)=O(1)

doubly logarithmic

按照 N \sqrt N N 进行分组,T(N)=loglogN, W(N)=O(NloglogN)

按照h=loglogN进行分组

T(N)=O(loglogN), W(N)=O(N)

按照 n 7 8 n^{\frac 78} n87分组,work load 是O(N), T(N)=O(1)

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Author(s) Henri Casanova (Author), Arnaud Legrand (Author), Yves Robert (Author) Publisher: Chapman and Hall/CRC (July 17, 2008) ISBN-10: 1584889454 ISBN-13: 978-1584889458 Book Description Focusing on algorithms for distributed-memory parallel architectures, Parallel Algorithms presents a rigorous yet accessible treatment of theoretical models of parallel computation, parallel algorithm design for homogeneous and heterogeneous platforms, complexity and performance analysis, and essential notions of scheduling. The book extracts fundamental ideas and algorithmic principles from the mass of parallel algorithm expertise and practical implementations developed over the last few decades. In the first section of the text, the authors cover two classical theoretical models of parallel computation (PRAMs and sorting networks), describe network models for topology and performance, and define several classical communication primitives. The next part deals with parallel algorithms on ring and grid logical topologies as well as the issue of load balancing on heterogeneous computing platforms. The final section presents basic results and approaches for common scheduling problems that arise when developing parallel algorithms. It also discusses advanced scheduling topics, such as divisible load scheduling and steady-state scheduling. With numerous examples and exercises in each chapter, this text encompasses both the theoretical foundations of parallel algorithms and practical parallel algorithm design.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值