Documente Academic
Documente Profesional
Documente Cultură
Exista (A,n, b)
(1) ex false
(2) forall i in parallel do
(3)
if A [i] = b then ex true
(4)
endif
(5) endfor
12
43
P3
P4
P5
26
92
3. Then, the array A is sorted by the first coordinate of the ordered pairs in
O(log p) time, which causes all data written to the same location to be
brought together in the output
(29,43)
(8,12)
P0
P0
(8,12)
(8,12)
P1
(29,43)
(29,43)
P1
P2
(29,43)
(29,43)
P3
(92,26)
(29,43)
(8,12)
(92,26)
P0
P1
P4
P5
Simulate
d
CRCW
global
memory
CRCW
global
memory
(8,12)
(29,43)
P2
P2
(29,43)
P3
P3
(29,43)
(92,26)
P4
P4
P5
P5
Simulate
d
sort
(8,12)
Simulating
step on an
EREW PRAM
12
43
29
26
92
4. Each EREW processor Pi now inspects A[i]=(lj,xj) and A[i-1]= (lk,xk), where j
and k are values in the range 0j,kp-1. If lj lk or i=0 then Pi writes the datum
xj to location lj in the global memory. Otherwise, the processor does nothing.
Demonstratie (continuare):
Fie un pas in CRCW de scriere:
1. Daca Pi scrie xi la adresa li, atunci in EREW, Pi scrie A[i]=(li , xi)
2. EREW sorteaza A dupa prima componenta
3. Fiecare Pi citeste A[i]=(lj , xj ) si A[i-1]= (lk , xk)
4. Daca i=0 sau lj lk , Pi scrie xj la adresa lj
Analog pentru un pas de citire.