35 | | == Array library of flat and segmented operations == |
36 | | |
37 | | '''TODO:''' Here we need to document the structure of the current implementation with subpages for the more complicated aspects (e.g., representation types, distributed types, and gangs). Here a dump of an old description of the library structure (which may be somewhat out of date): |
38 | | {{{ |
39 | | Data.Array.Parallel.Lifted |
40 | | ... the final user types ... |
41 | | |
42 | | Data.Array.Parallel.Unlifted |
43 | | Re-exports Data.Array.Parallel.Unlifted.Parallel |
44 | | Data.Array.Parallel.Unlifted.Distributed |
45 | | Data.Array.Parallel.Unlifted.Segmented |
46 | | Data.Array.Parallel.Unlifted.Flat |
47 | | |
48 | | Data.Array.Parallel.Unlifted.Parallel |
49 | | Parallel operations over UArrs. No new data types! |
50 | | These operations each |
51 | | - convert the incoming (UArr t) to a Dist (UArr t) |
52 | | - run the operation in parallel using a gang |
53 | | - convert the result back to a (UArr t') |
54 | | Plus fusion rules, of course! |
55 | | |
56 | | Data.Array.Parallel.Unlifted.Distributed |
57 | | Logically: type Dist a = Array GangMember a |
58 | | That is, one 'a' per gang member |
59 | | Mutable version: MDist |
60 | | |
61 | | Element types: unboxed, and products, (), |
62 | | *and* UArr, SUArr, Segd. |
63 | | |
64 | | Data.Array.Parallel.Unlifted.Segmented |
65 | | Provides SUArr, which are segmented UArrs with exactly one nesting level |
66 | | Logically: type SUArr a = UArr (UArr a) |
67 | | Element types: unboxed, and products and (). |
68 | | |
69 | | Again, a mutable version MSUArr is defined internally. |
70 | | |
71 | | Data.Array.Parallel.Unlifted.Flat |
72 | | Provides immutable (UArr) arrays of unboxed |
73 | | values, and strict products thereof. |
74 | | |
75 | | Simply lifts BUArr to work over strict products (incl unit). |
76 | | Internally to Flat, we also define mutable (MUArr) arrays, |
77 | | but they aren't exported. |
78 | | |
79 | | .UArr: representation |
80 | | .Loop: main loop combinator over UArr, loopU |
81 | | .Fusion: fusion rules for loopU |
82 | | .Combinators: instantiate loopU (to get fold, scan, map etc) |
83 | | |
84 | | The exported maps and folds over these arrays are |
85 | | purely sequential |
86 | | |
87 | | Data.Array.Parallel.Arr.BUArr |
88 | | Arrays of *unboxed* values, immutable (BUArr t) and mutable (MBUArr |
89 | | t), indexed by Int. Supports slicing (= sub-segment) operations. |
90 | | |
91 | | ToDo: combine with UArray and STUArray? (But they are indexed by Ix.) |
92 | | |
93 | | ToDo: a common pattern (e.g. when filtering) is that we allocate a |
94 | | big mutable array, *partially* fill it, and then want to shrink to |
95 | | fixed size when freezing it. (This is needed in Don's ByteString |
96 | | library too.) |
97 | | |
98 | | |
99 | | Data.Array.Parallel.Base.Fusion |
100 | | Specialised combining functions that specialise loopU to be map, fold, etc |
101 | | They are also useful for loopBU; hence not in Unlifted.Flat |
102 | | |
103 | | Data.Array.Parallel.Arr.BBArr |
104 | | Similar to BUArr, but for strict, boxed values. |
105 | | Representation: Array, STArray. |
106 | | Main application: array of UArrs in Distibuted.Types |
107 | | }}} |