正在加载图片...
buf[i-m/2]=bd (2.3)for=0tom2-ldo/*将前数据块移至后数据块的位置上*/ =0 to n-1 de a计+m2=a[i end f (2. 4)for i=0 to m/2-1 do b计+m/2]=b d fo (2.5)接收p-2号处理器发送的数据块作为自己的前数据块 (26)将bfer中的后数据块发送给编号为p-2的处理器 3)ir( my-rank=p-1)and( my-rank mod2=0)then/*处理器p1且其为偶数* (3.1)将后数据块发送给编号为p2的处理器 (3,2)fori=0tom/2-1do/*将前数据块移至后数据块的位置上* orj=0 to n-l do a计+m2=a nd fo (3. 3)for i=0 to m/2-1 do b计+m/2]=b end ior (34)接收p-2号处理器发送的数据块作为自己的前数据块 (4)if(( my-rank≠p-l)and( my-rank≠0)then/其它的处理器* (4)f(my- rank mod2=0)then/偶数号处理器* ()将前数据块发送给编号为 my rank+1的处理器 (i)将后数据块发送给编号为 my rank-1的处理器 (in)接收编号为 my rank-1的处理器发送的数据块作为自己的前 数据块 (iv)接收编号为 my rank+1的处理器发送的数据块作为自己的后 数据块 else/*奇数号处理器* (v)for=0tom-1do/*将前后数据块保存在缓冲区buer中* for户=0ton-ld (vifor i=0 to m-l do buf[]=b[i nd for (ⅶi)接收编号为 my rank-1的处理器发送的数据块作为自己的前 数据块buf [i-m/2] =b[i] end for (2.3)for i=0 to m/2-1 do /*将前数据块移至后数据块的位置上*/ for j=0 to n-1 do a[i+m/2,j]=a[i,j] end for end for (2.4)for i=0 to m/2-1 do b[i+m/2] =b[i] end for (2.5)接收 p-2 号处理器发送的数据块作为自己的前数据块 (2.6)将 buffer 中的后数据块发送给编号为 p-2 的处理器 end if (3)if ((my-rank=p-1) and ( my-rank mod 2=0)) then /*处理器 p-1 且其为偶数*/ (3.1)将后数据块发送给编号为 p-2 的处理器 (3.2)for i=0 to m/2-1 do /*将前数据块移至后数据块的位置上*/ for j=0 to n-1 do a[i+m/2,j]=a[i,j] end for end for (3.3)for i=0 to m/2-1 do b[i+m/2] =b[i] end for (3.4)接收 p-2 号处理器发送的数据块作为自己的前数据块 end if (4)if ((my-rank ≠ p-1) and ( my-rank ≠ 0)) then /*其它的处理器*/ (4.1)if (my-rank mod 2=0) then /*偶数号处理器*/ (i)将前数据块发送给编号为 my_rank+1 的处理器 (ii)将后数据块发送给编号为 my_rank-1 的处理器 (ii)接收编号为 my_rank-1 的处理器发送的数据块作为自己的前 数据块 (iv)接收编号为 my_rank+1 的处理器发送的数据块作为自己的后 数据块 else /*奇数号处理器*/ (v)for i=0 to m-1 do /* 将前后数据块保存在缓冲区 buffer 中*/ for j=0 to n-1 do buffer[i,j]=a[i,j] end for end for (vi)for i=0 to m-1 do buf[i] =b[i] end for (vii)接收编号为 my_rank-1 的处理器发送的数据块作为自己的前 数据块
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有