Splitting Data into Independent Chunks
Data parallel work can apply one operation to several disjoint parts of input, then combine compatible results.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a count
Split six records into two groups of three and count valid rows in each. If those counts are two and one, the total is three. Associative combining explains why adding works.
Check hidden dependencies
Each chunk may need information from its neighbors if the operation uses adjacent pairs. Retain a boundary reading or use a different partition. Neighbor comparisons give the relevant dependence.[1]
Cover every source index exactly once
Divide ten independent records into chunks of width four. The resulting half-open intervals are \([0,4),[4,8),[8,10)\). The shorter final interval still belongs to the work. If each item has a unique output location, workers can fill disjoint positions. See fixed-size batches.
Worker 1: indices 0–3
Worker 2: indices 4–7
Worker 3: indices 8–9
Total visits 4+4+2=10
Check whether adjacent chunks really are independent
A computation using neighboring values can need extra read-only boundary data. Avoid writing overlapping outputs. Test sizes below, exactly at and just above a chunk boundary.