Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Algorithm 婴儿车,如果有,机组人员/EREW_Algorithm_Parallel Processing_Theory_Prefix Sum - Fatal编程技术网

Algorithm 婴儿车,如果有,机组人员/EREW

Algorithm 婴儿车,如果有,机组人员/EREW,algorithm,parallel-processing,theory,prefix-sum,Algorithm,Parallel Processing,Theory,Prefix Sum,在我的并行算法书中,PRAM模型有以下伪代码: procedure PrefixSumPRAM( A, n ): BEGIN b := new Array(2*n-1); b[1] := SumPRAM(A, n); //this will load A with the computation tree and return the sum for i := 1 to ( log2(n) - 1 ) do BEGIN for all procID where

在我的并行算法书中,PRAM模型有以下伪代码:

procedure PrefixSumPRAM( A, n ):
BEGIN
   b := new Array(2*n-1);
   b[1] := SumPRAM(A, n); //this will load A with the computation tree and return the sum
   for i := 1 to ( log2(n) - 1 ) do
   BEGIN
      for all procID where (2^i) <= procID <= ((2^(i+1))-1) do in parallel
      BEGIN
          if odd(procID) then
               b[ procID ] := b[ procID/2 ];
          else
               b[ procID ] := b[ procID/2 ] - a[ procID+1 ];
      END
   END
END

在PRAM模型中,当id为偶数的处理器执行(例如)NOP指令时?

,有无限多的处理器和单个内存。尽管处理器通过每个时间步执行一条指令以锁定步进方式运行,但每个处理器保持其自己的状态,因此可以根据控制流以任意方式执行程序

在乘员式婴儿车中,两个处理器可以在同一时间步中读取同一内存位置,但在同一时间步中只有一个处理器可以写入任何内存位置。在EREW PRAM中,读取也不能同时发生

b[procID]:=b[procID/2];