let x = psum xs in pmap (\y. x+y) ys [27/07/10 20:50:20] Roman Leshchinskiy: let x = psums xs in x `seq` pmap (\y. x+y) ys [27/07/10 20:51:31] Ben Lippmeier: data ParRef a = ... [27/07/10 20:51:40] Simon Peyton Jones: I don't understand why one is ok and the other isn't! [27/07/10 20:53:04] Simon Peyton Jones: OK now I see. I was parsing it wrong! [27/07/10 20:57:57] Simon Peyton Jones: pmap :: (a :-> b) -> Arr a -> Arr b [27/07/10 20:58:59] Simon Peyton Jones: [11:50:19] Roman Leshchinskiy: let x = psums xs in x `seq` pmap (\y. x+y) ys <<< [27/07/10 20:59:43] Roman Leshchinskiy: let err = error "..." in pmap (\y. if y == 0 then err else ...) xs [27/07/10 21:00:10] Ben Lippmeier: pmap :: DeepDirect clo => (a -(clo)> b) -> Arr a -> Arr b [27/07/10 21:01:09] Manuel Chakravarty: BTW, Ben has a point here. This is the kind of stuff he did in his thesis [27/07/10 21:02:25] Simon Peyton Jones: let x = psum xs in pmap (\y. x+y) ys let x = psums xs in x `seq` pmap (\y. x+y) ys [27/07/10 21:02:40] Ben Lippmeier: x :: Direct r => Int r [27/07/10 21:03:15] Simon Peyton Jones: [12:02:24] Simon Peyton Jones: let x = psum xs in pmap (\y. x+y) ys let x = psums xs in x `seq` pmap (\y. x+y) ys <<< [27/07/10 21:05:22] Simon Peyton Jones: General question: what is the smallest language extension that would allow us to write unboxed function closures or whatever is necessary to express the idea that parallel functions can't (via a thunk) invoke a parallel function. [27/07/10 21:06:37] Roman Leshchinskiy: pmap :: (a :-> b) -> Arr a -> Arr b [27/07/10 21:07:18] Roman Leshchinskiy: data a :-> b = forall c. Clo c ( (# c, a #) -#> b ) [27/07/10 21:10:22] Roman Leshchinskiy: (a -#> b) -> (a -> b) [27/07/10 21:10:53] Simon Peyton Jones: not a function mk :: (a->b) -> (a -#> b) [27/07/10 21:11:01] Simon Peyton Jones: Language contruct (mk e) [27/07/10 21:13:59] Ben Lippmeier: spawn :: Empty c => (a -(c)> b) -> a -> b [27/07/10 21:14:26] Simon Peyton Jones: Or just spawn :: (a -#> b) -> a -> b [27/07/10 21:21:56] Roman Leshchinskiy: (a -> b) [27/07/10 21:22:30] Roman Leshchinskiy: (a -> b) -> (a :-> b) ----------------------------------------------------------------------------------------------- Notes from 10th August * Can unboxed functions refer to cafs? * x = 1 + 1 f = \# y -> y + x a -#> a * make it so the only thunks that unboxed function can force are passed in as its argument. * strict core language. \end{code} \TODO{Say something wrt not just using a strict language. We want this data parallel library to co-exist with existing Haskell ones. Laziness can make some code-motion optimisations easier (eg hoisting). Reference SAC custom language etc.} \TODO{We could force parSum to be evaluated sequentially, but that's not what we really wanted} \TODO{How are data parallel computations sequenced in the current library?} * Don't allow nested parallelism because: gang does not sync during parallel comps once gang is running all processor should be doing something don't want to spawn off a new gang, just reduce efficiency - context switching. If gang thread encounters parallel computation should just do it sequetially breaks cost model. if nested computation is expensive cant run in parallel load balancing breaks. Not obvious what gets executed in parallel and what doesn't. Nesting in a lazy language is something that happens dynamically, not statically. With vectoriser, transform gives static guarantee that something mapP'd runs in parallel. \begin{code} let xs = mapU expensive ys in mapUP (\z -> z + xs !: 0) zs \end{code} Want to guarantee that if you see (mapUP f xs) then it gets evaluated in parallel.