The PRAM Model for Parallel Computation (Chapter 2). References: [2, Akl, Ch 2], [3, Quinn, Ch 2], from references listed for Chapter 1, plus the following new reference:
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Parallel Computers
Parallel Computers
Parallel Computers
Parallel Computers
:SS S.
s1s1.
p0 = s0
p1 = s0 s1
.
pn-1= s0 s1 ... sn-1
Parallel Computers
forj = 0 to (lg n) -1, do
for i = 2j to n-1 do
h = i - 2j
si= sh si
endfor
endfor
Parallel Computers
Yi = (xi*k, xi*k+1, ..., xi*k+k-1)
Parallel Computers
Algorithm PRAM Prefix Computation processor IDs to control the actions of the processors. (X, ,S)
sk-1 ... sik-1 .
sik+j sik+j sik-1
for 0 j k-2.
= O(lg n- lg k) = (lg n - lg lg n)
= (lg n) = (k)
Parallel Computers
The requirements of this problem are to
Parallel Computers
2. Perform a prefix sum on S to obtain the destination di = si for each marked xi .
3. All PEs set m = sn , the nr of marked elements.
4. Reset si= 0 if xi is marked and si = 1 otherwise.
5. Perform a prefix sum on S and set di = si + m for each unmarked xi .
6. Each Pi copies array element xi into address di in X.
b1= an and bi= 0 for 1< i n)
Parallel Computers
[6] Joseph JaJa, An Introduction to Parallel Algorithms, Addison Wesley, pgs 160-173.
[7] R. Cole, Parallel Merge Sort, SIAM Journal on Computing, Vol. 17, 1988, pp. 770-785.
Parallel Computers
O((lg n) lg lg n) time
and uses O(n) processors which is much simpler is given in JaJa’s book (pg 158-160).
Parallel Computers
Parallel Computers
Parallel Computers
Parallel Computers
Parallel Computers
Parallel Computers
which match the previous lower bounds (up to a constant) and hence are optimal.
Parallel Computers
END OF CHAPTER 2
Parallel Computers
TO BE ADDED IN FUTURE: consisting of a binary tree for each PE that joins it to each memory location.
Parallel Computers
Parallel Computers