Explicit Multi-Threading (XMT)
Summation Example
-
summation.c
-
xmtcc -o summation summation.c
-
xmtsim -cycle summation.sim
Prefix-Sum Assignment
-
Pages 19-21 of "Thinking in Parallel".
-
Modify example code.
-
xmtcc -o prefixsum prefixsum.c
-
xmtsim -cycle prefixsum.sim
Prefix-Min Assignment
-
Pages 21 (bottom) and 22.
-
Modify prefix-sum code.
Compaction Assignment
-
Page 21.
-
Picture on Page 22.
-
Uses prefix-sum.
Nearest-One Assignment
-
Page 22.
-
Technique is similar but not prescribed.
-
Two different approaches.
Segmented Prefix-Sum Assignment
-
Page 22.
-
Puts it all together.
-
Example:
| Data |
5 | 3 | 1 | 2 | 3 | 4 | 4 | 1 |
| Bits |
0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |
| Result |
0 | 3 | 4 | 6 | 3 | 7 | 11 | 12 |
-
Special Case:
| Data |
5 | 3 | 1 | 2 | 3 | 4 | 4 | 1 |
| Bits |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Result |
5 | 8 | 9 | 11 | 14 | 18 | 22 | 23 |
Merging-Ranking
-
merge_rank_SHELL.c
-
Pages 24 to 27.
-
Two parallel algorithms: surplus-log and partitioning
-
xmtsim -cycle -count merge_rank_SHELL.sim
Merge Sort
Selection
Back to PC