Changes between Version 15 and Version 16 of DataParallel/Replicate
- Timestamp:
- 08/07/11 05:02:11 (23 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DataParallel/Replicate
v15 v16 34 34 Generally, we don't want to copy replicated data — it's a waste of space! We definitely don't want to do it for large data structures, and in particular, we don't want to do it for arrays. After all, that can change the asymptotic work complexity of a program. To keep it simple, we are for the moment focusing on avoiding replicating arrays, as this is were our practical problems are coming from at the moment. (Some cases of replicated scalars are also eliminated by fusion.) 35 35 36 NB: We will have to revisit replication of scalar structures as such scalar structures may be large trees. 37 36 38 === Repeated segments === 37 39 38 40 A replicated array results is always represented by a segmented array; more precisely, by a segmented array where a contiguous sequence of segments contains the same data. For example, we have 39 41 {{{ 40 replicateP 3 [:1, 2, 3:] = [:[:1, 2, 3:], [:1, 2, 3:], [:1, 2, 3:]:]42 replicatePA 3 [:1, 2, 3:] = [:[:1, 2, 3:], [:1, 2, 3:], [:1, 2, 3:]:] 41 43 where 42 44 [:[:1, 2, 3:], [:1, 2, 3:], [:1, 2, 3:]:] = ([:3, 3, 3:], [:1, 2, 3, 1, 2, 3, 1, 2, 3:]) … … 44 46 and 45 47 {{{ 46 replicateP^[:2, 3:] [:[:1, 2:], [:3:]:] = [:[:1, 2:], [:1, 2:], [:3:], [:3:], [:3:]:]48 expandPA [:2, 3:] [:[:1, 2:], [:3:]:] = [:[:1, 2:], [:1, 2:], [:3:], [:3:], [:3:]:] 47 49 where 48 50 [:[:1, 2:], [:1, 2:], [:3:], [:3:], [:3:]:] = ([:2, 2, 1, 1, 1:], [:1, 2, 1, 2, 3, 3, 3:]) 49 51 }}} 52 NB: `expandPA` is lifted replication; `expandPA` is the name we used in HtM. 50 53 51 54 === Collapse repeated segments ===
