简体   繁体   English

如何证明并行算法的上限/下限?

[英]How does one prove an upper/lower bound of a parallel algorithm?

Suppose a Fibonacci algorithm: 假设斐波那契算法:

在此处输入图片说明

We are asked to prove the upper/lower bound of this algorithm. 我们要求证明该算法的上限/下限。

How do I proceed? 我该如何进行?

Update 更新

So I'll explain what I have done myself and show where I'm stuck. 因此,我将解释自己所做的事情,并说明遇到的困难。

I don't know why but I decided to use recurrence relation here to see where I can get my final result. 我不知道为什么,但是我决定在这里使用递归关系来查看在哪里可以获得最终结果。 But the reason why I doubt my working out is that Upper/lower bound is the identification of the "limitless" of an algorithm in terms of resources. 但是我怀疑我的工作的原因是上限/下限是根据资源确定算法的“无限”。

So, the parallel algorithm has: 因此,并行算法具有:

Work(n) = W(n - 1) + W(n - 2) + Θ(1) 功(n)= W(n-1)+ W(n-2)+Θ(1)

At this point, I decided to use recurrence relation - have no idea - 在这一点上,我决定使用递归关系-不知道-

Work(n) = [W(n - 1) + W(n - 2) + Θ(1)] + W(n - 2) + Θ(1)
        = W(n - 2) + W(n - 2) + 2Θ(1)
        = 2W(n - 2) + 2
        = Stuck here

Honestly, I don't know even if that makes sense. 老实说,即使这样我也不知道。

A formal solution was given: 给出了一个正式的解决方案: 在此处输入图片说明

But I didn't quite understand the steps that were taken above 但是我不太明白上面采取的步骤

I would say that the processors are of almost no concern since the recurrence is a tree and this tree has an exponential number of nodes. 我要说的是,处理器几乎没有问题,因为循环是一棵树,并且该树的节点数是指数的。 These nodes represent the merge that has to be done in each step. 这些节点表示在每个步骤中必须完成的合并。 So even if the number of processors is unlimited it does not help solving this recurrence as they can only compute something independently in the last row, ie, W(1) and W(0). 因此,即使处理器数量是无限的,它也无助于解决这种重复问题,因为它们只能在最后一行中独立地计算某些东西,即W(1)和W(0)。

I just saw in the comments that the sample solution was supplied and partially explained: Here some further "insight": The idea is to expand the recurrence and look for a way to collect the factors. 我仅在评论中看到提供了示例解决方案,并进行了部分解释:这里是一些进一步的“见解”:想法是扩大重复率,并寻找一种收集因素的方法。 Here they collect the 2 in a way that they apply an inequality: W(n-1)+W(n-2) >= 2 W(n-2). 在这里,他们以应用不等式的方式收集2:W(n-1)+ W(n-2)> = 2 W(n-2)。 So now you have W(n)>= 2 W(n-2). 因此,现在您有W(n)> = 2 W(n-2)。 How often do we subtract the 2 until we have W(0) on the right side? 我们多久减去2一次,直到右边有W(0)为止? n/2 times. n / 2次。 Then you end up with the Omega(2^(n/2)) lower bound. 然后以Omega(2 ^(n / 2))下界结束。 You can use the more or less same approach to show an upper bound. 您可以使用大致相同的方法来显示上限。

Just as a small side note, these bounds are not tight: Related Post 就像一个小小的注解,这些界限并不严格: 相关文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM