Research Article
On the Parallelization of Stream Compaction on a Low-Cost SDC Cluster
Algorithm 2
Parallel stream compaction.
| | Input: Vector I of length n | | | Input: Predicate function F | | | Input: Number of processes p | | | Input: pid of process | | | Output: Vector O of valid elements | | | Output: nvalid: the number of valid elements | | | Output: pos: position to write | | (1) | | | (2) | | | (3) | | | (4) | for to in parallel do | | (5) | if then | | (6) | | | (7) | end if | | (8) | end for | | (9) | for to in parallel do | | (10) | | | (11) | end for | | (12) | | | (13) | for to in parallel do | | (14) | Send nvalid to process | | (15) | end for | | (16) | if then | | (17) | for to in parallel do | | (18) | Receive | | (19) | | | (20) | end for | | (21) | end if | | (22) | for to in parallel do | | (23) | if then | | (24) | | | (25) | end if | | (26) | end for |
|